public HistoricalDataMessage(int reqId, IBApi.Bar bar) { RequestId = reqId; Date = bar.Time; Open = bar.Open; High = bar.High; Low = bar.Low; Close = bar.Close; Volume = bar.Volume; Count = bar.Count; Wap = bar.WAP; }
public override void historicalData(int reqId, IBApi.Bar bar) { Tuple <ISubject <Bar>, bool> historical_data; if (_historicalDataDict.TryGetValue(reqId, out historical_data)) { DateTime timestamp; if (historical_data.Item2) // intraday { long epochtime = long.Parse(bar.Time); // the "time" string is in Epoch seconds timestamp = Epoch.AddSeconds(epochtime); } else { timestamp = DateTime.ParseExact(bar.Time, "yyyyMMdd", DateTimeFormatInfo.InvariantInfo); } historical_data.Item1.OnNext(new Bar(timestamp.Ticks, (decimal)bar.Open + Zero00, (decimal)bar.High + Zero00, (decimal)bar.Low + Zero00, (decimal)bar.Close + Zero00, bar.Volume, (decimal)bar.WAP)); } }