public void Load()
 {
     try {
         var file = GetLocalDataFile();
         if (File.Exists(file))
         {
             var list    = JToken.Parse(File.ReadAllText(file));
             var current = list.First;
             while (current != null)
             {
                 var manager = new TimeRangeManager();
                 var ranges  = current["TimeRanges"].ToObject <TimeRange[]>();
                 foreach (var range in ranges)
                 {
                     manager.AddRange(range);
                 }
                 var products = current["Products"].ToObject <string>();
                 var keys     = products.Split(',');
                 foreach (var key in keys)
                 {
                     _items[key] = manager;
                 }
                 current = current.Next;
             }
         }
     }
     catch (Exception) {
         // ignored
     }
 }
Esempio n. 2
0
 public QBTimeBarFactoryItem(Instrument instrument, long barSize, bool enableLog = false)
     : base(instrument, barSize, BarInput.Trade, ClockType.Exchange)
 {
     _enableLog = enableLog;
     if (_enableLog)
     {
         _logger = LogManager.GetLogger("tbg." + instrument.Symbol);
     }
     IncludeFirstTick = true;
     _timeRange       = MarketDataFilter.Instance.GetFilter(instrument);
     _clockType       = ClockType.Exchange;
 }
Esempio n. 3
0
 public static void SetTimeFilter(this Instrument inst, TimeRangeManager manager)
 {
     inst.Fields[QuantBoxConst.InstrumentTimeManagerOffset] = manager;
 }