private void m_Session_OnHistMessage(object sender, BWHistResponse histMsg) { if (histMsg.Error.Length > 0) { debug("ERROR: " + histMsg.Error); } else { v(histMsg.Symbol + " received bar history data containing " + histMsg.bars.Length + " bars."); if (histMsg.bars != null && histMsg.bars.Length > 0) { string sym = histMsg.Symbol; foreach (BWBar bar in histMsg.bars) { int tlDate = TradeLink.Common.Util.ToTLDate(bar.time); int tlTime = TradeLink.Common.Util.ToTLTime(bar.time); Bar tlBar = new BarImpl((decimal)bar.open, (decimal)bar.high, (decimal)bar.low, (decimal)bar.close, (int)bar.volume, tlDate, tlTime, sym, (int)histMsg.Interval); for (int i = 0; i < tl.NumClients; i++) { tl.TLSend(BarImpl.Serialize(tlBar), MessageTypes.BARRESPONSE, i.ToString()); } } } //else if (histMsg.ticks != null && histMsg.ticks.Length > 0) //{ // foreach (BWTickData tick in histMsg.ticks) // { // Tick tlTick = new TickImpl(tick.symbol); // tlTick.ask = (decimal)tick.askprice; // tlTick.AskSize = (int)tick.asksize; // tlTick.bid = (decimal)tick.bidprice; // tlTick.BidSize = (int)tick.bidsize; // tlTick.trade = (decimal)tick.price; // tlTick.size = (int)tick.size; // } //} } }
private void m_Session_OnHistMessage(object sender, BWHistResponse histMsg) { if (histMsg.Error.Length > 0) { debug("ERROR: " + histMsg.Error); } else { v(histMsg.Symbol + " received bar history data containing " + histMsg.bars.Length + " bars."); if (histMsg.bars != null && histMsg.bars.Length > 0) { string sym = histMsg.Symbol; foreach (BWBar bar in histMsg.bars) { int tlDate = TradeLink.Common.Util.ToTLDate(bar.time); int tlTime = TradeLink.Common.Util.ToTLTime(bar.time); Bar tlBar = new BarImpl((decimal)bar.open, (decimal)bar.high, (decimal)bar.low, (decimal)bar.close, (int)bar.volume, tlDate, tlTime,sym,(int)histMsg.Interval); for (int i = 0; i < tl.NumClients; i++) tl.TLSend(BarImpl.Serialize(tlBar), MessageTypes.BARRESPONSE, i.ToString()); } } //else if (histMsg.ticks != null && histMsg.ticks.Length > 0) //{ // foreach (BWTickData tick in histMsg.ticks) // { // Tick tlTick = new TickImpl(tick.symbol); // tlTick.ask = (decimal)tick.askprice; // tlTick.AskSize = (int)tick.asksize; // tlTick.bid = (decimal)tick.bidprice; // tlTick.BidSize = (int)tick.bidsize; // tlTick.trade = (decimal)tick.price; // tlTick.size = (int)tick.size; // } //} } }