/// <summary>
        /// Historic Bar Data Request Message
        /// </summary>
        public bool HistoricBarDataRequest(HistoricDataRequest historicDataRequest)
        {
            try
            {
                // Get Blackwood BarType
                Pacmid.Messages.DBARTYPE bwBarType = BlackwoodBarTypeConvertor.GetBarType(historicDataRequest.BarType);

                // Send Historic Data Request
                _session.RequestHistoricData(historicDataRequest.Security.Symbol, bwBarType,
                                             new DateTime(historicDataRequest.StartTime.Ticks, DateTimeKind.Local),
                                             new DateTime(historicDataRequest.EndTime.Ticks, DateTimeKind.Local),
                                             historicDataRequest.Interval,
                                             Convert.ToUInt32(historicDataRequest.Id));

                if (Logger.IsInfoEnabled)
                {
                    Logger.Info("Historic Data Request Sent: " + historicDataRequest, _type.FullName, "RequestHistoricBarData");
                }
                return(true);
            }
            catch (Exception exception)
            {
                Logger.Error(exception, _type.FullName, "RequestHistoricBarData");
                return(false);
            }
        }
Exemple #2
0
        long ServerBlackwood_newUnknownRequest(MessageTypes t, string msg)
        {
            int          _depth = 0;
            MessageTypes ret    = MessageTypes.UNKNOWN_MESSAGE;

            switch (t)
            {
            case MessageTypes.DOMREQUEST:

                _depth = Convert.ToInt32(msg);
                v("received DOM request for depth: " + _depth);
                ret = MessageTypes.OK;
                break;

            case MessageTypes.ISSHORTABLE:
                return((long)(m_Session.GetStock(msg).IsHardToBorrow() ? 0 : 1));

            case MessageTypes.BARREQUEST:
                v("received bar request: " + msg);
                string[] r       = msg.Split(',');
                DBARTYPE barType = getBarTypeFromBW(r[(int)BarRequestField.BarInt]);
                int      tlDateS = int.Parse(r[(int)BarRequestField.StartDate]);
                int      tlTimeS = int.Parse(r[(int)BarRequestField.StartTime]);
                DateTime dtStart = TradeLink.Common.Util.ToDateTime(tlDateS, tlTimeS);
                int      tlDateE = int.Parse(r[(int)BarRequestField.StartDate]);
                int      tlTimeE = int.Parse(r[(int)BarRequestField.StartTime]);
                DateTime dtEnd   = TradeLink.Common.Util.ToDateTime(tlDateE, tlTimeE);
                uint     custInt = 1;
                if (!uint.TryParse(r[(int)BarRequestField.CustomInterval], out custInt))
                {
                    custInt = 1;
                }

                m_Session.RequestHistoricData(r[(int)BarRequestField.Symbol], barType, dtStart, dtEnd, custInt, ++bwHistReqID);
                ret = MessageTypes.OK;
                break;
            }
            return((long)ret);
        }