Добрый день
private static Security CreateStrike(decimal strike, decimal oi, decimal iv, OptionTypes type, DateTime expiryDate, Security asset, decimal? lastTrade)
{
var s = new Security
{
Code = "RI {0} {1}".Put(type == OptionTypes.Call ? 'C' : 'P', strike),
Strike = strike,
OpenInterest = oi,
ImpliedVolatility = iv,
HistoricalVolatility = iv,
OptionType = type,
ExpiryDate = expiryDate,
Board = ExchangeBoard.Forts,
UnderlyingSecurityId = asset.Id,
LastTrade = lastTrade == null ? null : new Trade { Price = lastTrade.Value },
Volume = 999,//RandomGen.GetInt(10000),
Type = SecurityTypes.Option,
//TheorPrice = 1212m,
};
s.BestBid = new Quote(s, s.StepPrice ?? 1m * RandomGen.GetInt(100), s.VolumeStep ?? 1m * RandomGen.GetInt(100), Sides.Buy);
s.BestAsk = new Quote(s, s.BestBid.Price.Max(s.StepPrice ?? 1m * RandomGen.GetInt(100)), s.VolumeStep ?? 1m * RandomGen.GetInt(100), Sides.Sell);
return s;
}
var asset = new Security
{
Id = "RIH5@FORTS",
PriceStep = 10,
};
asset.BestBid = new Quote(asset, asset.StepPrice ?? 1m * RandomGen.GetInt(100), asset.VolumeStep ?? 1m * RandomGen.GetInt(100), Sides.Buy);
asset.BestAsk = new Quote(asset, asset.BestBid.Price.Max(asset.StepPrice ?? 1m * RandomGen.GetInt(100)), asset.VolumeStep ?? 1m * RandomGen.GetInt(100), Sides.Sell);
asset.LastTrade = new Trade
{
Security = asset,
Price = 105000,
};
var expiryDate = new DateTime(2014, 09, 15);
var currDate = new DateTime(2014, 08, 02);
var securities = new List<Security>
{
asset,
CreateStrike(105000, 10, 60, OptionTypes.Call, expiryDate, asset, 105000),
CreateStrike(105000, 10, 50, OptionTypes.Put, expiryDate, asset, 105000)
};
var dummyProvider = new DummyProvider(securities, new[]
{
new Position
{
Security = asset,
//CurrentValue = -100,
}
});
Security blackScholesOption = CreateStrike(105000, 10, 60, OptionTypes.Call, expiryDate, asset, 105000);
BlackScholes blackScholes = new BlackScholes(blackScholesOption, asset, dummyProvider);
Значения по грекам получаю успешно. (blackScholes.Delta(new DateTimeOffset(new DateTime(2014, 08, 02))))
Не могу разобраться как получить TheorPrice. (blackScholes.Option.TheorPrice = null)