17 using System.Collections.Generic;
26 private readonly DateTime _minExpiry;
27 private readonly DateTime _maxExpiry;
28 private readonly
string _market;
29 private readonly
int _symbolChainSize;
30 private readonly decimal _underlyingPrice;
31 private readonly decimal _maximumStrikePriceDeviation;
35 : base(settings, random)
40 _minExpiry = (settings.Start).AddDays(7);
41 _maxExpiry = (settings.End).AddDays(7);
42 _market = settings.Market;
43 _underlyingPrice = underlyingPrice;
44 _symbolChainSize = settings.ChainSymbolCount;
45 _maximumStrikePriceDeviation = maximumStrikePriceDeviation;
61 protected override IEnumerable<Symbol>
GenerateAsset(
string ticker =
null)
64 var underlying =
NextSymbol(_underlyingSecurityType, _market, ticker);
65 yield
return underlying;
67 var marketHours =
MarketHoursDatabase.GetExchangeHours(_market, underlying, _underlyingSecurityType);
70 var strikes =
new HashSet<decimal>();
71 for (var i = 0; i < _symbolChainSize; i++)
78 strike =
Random.
NextPrice(_underlyingSecurityType, _market, _underlyingPrice,
79 _maximumStrikePriceDeviation);
82 var order = 1 + Math.Log10((
double)strike);
83 strike = strike.RoundToSignificantDigits((
int)order);
86 while (!strikes.Add(strike));
91 yield
return Symbol.
CreateOption(underlying, _market, underlying.SecurityType.DefaultOptionStyle(), optionRight, strike, expiry);