예제 #1
0
 public OptionChain(Symbol canonicalOptionSymbol, DateTime time, BaseData underlying, IEnumerable <BaseData> trades, IEnumerable <BaseData> quotes, IEnumerable <OptionContract> contracts, IEnumerable <Symbol> filteredContracts)
 {
     Time              = time;
     Underlying        = underlying;
     Symbol            = canonicalOptionSymbol;
     DataType          = MarketDataType.OptionChain;
     FilteredContracts = filteredContracts.ToHashSet();
     Ticks             = new Ticks(time);
     TradeBars         = new TradeBars(time);
     QuoteBars         = new QuoteBars(time);
     Contracts         = new OptionContracts(time);
     foreach (var trade in trades)
     {
         var tick = trade as Tick;
         if (tick != null)
         {
             List <Tick> ticks;
             if (!Ticks.TryGetValue(tick.Symbol, out ticks))
             {
                 ticks = new List <Tick>();
                 Ticks[tick.Symbol] = ticks;
             }
             ticks.Add(tick);
             continue;
         }
         var bar = trade as TradeBar;
         if (bar != null)
         {
             TradeBars[trade.Symbol] = bar;
         }
     }
     foreach (var quote in quotes)
     {
         var tick = quote as Tick;
         if (tick != null)
         {
             List <Tick> ticks;
             if (!Ticks.TryGetValue(tick.Symbol, out ticks))
             {
                 ticks = new List <Tick>();
                 Ticks[tick.Symbol] = ticks;
             }
             ticks.Add(tick);
             continue;
         }
         var bar = quote as QuoteBar;
         if (bar != null)
         {
             QuoteBars[quote.Symbol] = bar;
         }
     }
     foreach (var contract in contracts)
     {
         Contracts[contract.Symbol] = contract;
     }
 }
예제 #2
0
 public OptionChain(Symbol canonicalOptionSymbol, DateTime time)
 {
     Time              = time;
     Symbol            = canonicalOptionSymbol;
     DataType          = MarketDataType.OptionChain;
     Ticks             = new Ticks(time);
     TradeBars         = new TradeBars(time);
     QuoteBars         = new QuoteBars(time);
     Contracts         = new OptionContracts(time);
     FilteredContracts = new HashSet <Symbol>();
 }