private void DataReceived(FSM_EventArgs.GooContract_With_Payload e) { OHLCQuote dataBar = e.Payload as OHLCQuote; if (e.Contract.HistoricalData.Data.ContainsKey(dataBar.Date) == false) { e.Contract.HistoricalData.Data.Add(dataBar.Date, dataBar); } }
// Received packet of historical data from TWS private static void Ibclient_HistoricalData(messages.HistoricalDataMessage hData) { // Data request is valid until HistoricalDataEnd is received. GooContract c = GetDataRequestContract(hData.RequestId, false); // Package the quote and send the data received event to the state machine. OHLCQuote quote = new OHLCQuote(hData.Date, hData.Open, hData.High, hData.Low, hData.Close); var e = new FSM_EventArgs.GooContract_With_Payload(c, quote); c.FSM.DownloadHistoricalData.FireEvent(FSM_DownloadHistoricalData.Events.HistoricalData, e); }