Esempio n. 1
0
        private void RaiseErrorMessage(ErrorEventArgs e)
        {
            var errorArgs    = TwsUtils.ConvertErrorArguments(e);
            var isHistorical = historicalDataRequests.TryGetValue(e.TickerId, out HistoricalDataRequest histReq);

            if (isHistorical)
            {
                var origId = subRequestIDMap.ContainsKey(histReq.RequestID)
                    ? subRequestIDMap[histReq.RequestID]
                    : histReq.RequestID;

                errorArgs.ErrorMessage +=
                    $" Historical Req: {histReq.Instrument.Symbol} @ {histReq.Frequency} From {histReq.StartingDate} To {histReq.EndingDate} - TickerId: {e.TickerId}  ReqID: {histReq.RequestID}";

                errorArgs.RequestID = origId;
            }
            else if (realTimeDataRequests.TryGetValue(e.TickerId, out RealTimeDataRequest rtReq)) //it's a real time request
            {
                errorArgs.ErrorMessage += $" RT Req: {rtReq.Instrument.Symbol} @ {rtReq.Frequency}";

                errorArgs.RequestID = rtReq.RequestID;
            }

            RaiseEvent(Error, this, errorArgs);
        }