Ejemplo n.º 1
0
 Dictionary <int, int> _bar_con_map;                             //DbBarId to contract
 public MarketDataDownloader(int strategy_id, string config, IBApi.EClientInterface socket)
     : base(strategy_id, config, socket)
 {
     _db  = DBAccess.DBAccess.instance;
     _tg  = TickerGenerator.instance;
     _msg = Messenger.instance;
     fromConfig(config);
 }
Ejemplo n.º 2
0
        public Strategy(int strategy_id, string config, IBApi.EClientInterface socket)
        {
            _socket = socket;
            id      = strategy_id;
            XmlDocument xml = new XmlDocument();

            xml.LoadXml(config);
            XmlNode xn1    = xml.SelectSingleNode("/Config");
            XmlNode common = xn1.SelectSingleNode("Common");

            _time_zone     = common["TimeZone"].InnerText;
            _zone          = mapDotNetTimeZone(_time_zone);
            _start_time    = TimeSpan.Parse(common["StartTime"].InnerText);
            _end_time      = TimeSpan.Parse(common["EndTime"].InnerText);
            _calendar_name = common["Calendar"].InnerText;
            _calendar      = mapCalendar(_calendar_name);
            if (common.SelectSingleNode("BarType") == null)
            {
                _bar_type = "TRADES";
            }
            else
            {
                _bar_type = (common["BarType"].InnerText).ToUpper();
            }
            _db  = DBAccess.DBAccess.instance;
            _tg  = TickerGenerator.instance;
            _tm  = ThreadManager.instance;
            _mm  = MarketDataManager.instance;
            _om  = OrderManager.instance;
            _msg = Messenger.instance;
            _realtimeBarEvent  = _tm.createEvent();
            _reqContractMap    = new Dictionary <int, int>();
            _contractReqMap    = new Dictionary <int, int>();
            _contracts         = new List <int>();
            _contractDetailMap = new Dictionary <int, ContractDetails>();
        }