BasketBlackScholes
Portfolio model for calculating the values of Greeks by the Black-Scholes formula.
Inherits: BlackScholes
Constructors
public BasketBlackScholes(IMarketDataProvider dataProvider, IPositionProvider positionProvider, DateTime? expirationTime)
basketBlackScholes = BasketBlackScholes(dataProvider, positionProvider, expirationTime)
Initializes a new instance of the BasketBlackScholes.
- dataProvider
- The market data provider.
- positionProvider
- The position provider.
- expirationTime
- Explicit options expiration moment for the whole basket. If null, models' own settings are used.
public BasketBlackScholes(Security underlyingAsset, IMarketDataProvider dataProvider, IPositionProvider positionProvider, DateTime? expirationTime)
basketBlackScholes = BasketBlackScholes(underlyingAsset, dataProvider, positionProvider, expirationTime)
Initializes a new instance of the BasketBlackScholes with explicit underlying.
- underlyingAsset
- Underlying asset.
- dataProvider
- The market data provider.
- positionProvider
- The position provider.
- expirationTime
- Explicit options expiration moment for the whole basket.
Properties
public override DateTime? ExpirationTime { get; set; }
value = basketBlackScholes.ExpirationTime
basketBlackScholes.ExpirationTime = value
Explicit expiration moment. If null, ExpiryDate is used when available: with its time of day, or at the board's expiry time for a date alone.
public IInnerModelList InnerModels { get; }
value = basketBlackScholes.InnerModels
Information about options.
public IPositionProvider PositionProvider { get; set; }
value = basketBlackScholes.PositionProvider
basketBlackScholes.PositionProvider = value
The position provider.
public override int RoundDecimals { set; }
basketBlackScholes.RoundDecimals = value
The number of decimal places at calculated values. The default is -1, which means no values rounding.
public override Security UnderlyingAsset { get; }
value = basketBlackScholes.UnderlyingAsset
Underlying asset.
Methods
public override decimal? Delta(DateTime currentTime, decimal? deviation, decimal? assetPrice)
result = basketBlackScholes.Delta(currentTime, deviation, assetPrice)
To calculate the option delta.
- currentTime
- The current time.
- deviation
- Standard deviation.
- assetPrice
- Underlying asset price.
Returns: The option delta. If the value is equal to , then the value calculation currently is impossible.
public override decimal? Gamma(DateTime currentTime, decimal? deviation, decimal? assetPrice)
result = basketBlackScholes.Gamma(currentTime, deviation, assetPrice)
To calculate the option gamma.
- currentTime
- The current time.
- deviation
- Standard deviation.
- assetPrice
- Underlying asset price.
Returns: The option gamma. If the value is equal to , then the value calculation currently is impossible.
public override double? GetExpirationTimeLine(DateTime currentTime)
result = basketBlackScholes.GetExpirationTimeLine(currentTime)
The time before expiration calculation.
- currentTime
- The current time.
Returns: The time remaining until expiration. If the value is equal to , then the value calculation currently is impossible.
public override decimal? ImpliedVolatility(DateTime currentTime, decimal premium, decimal? assetPrice)
result = basketBlackScholes.ImpliedVolatility(currentTime, premium, assetPrice)
To calculate the implied volatility.
- currentTime
- The current time.
- premium
- The option premium.
- assetPrice
- Underlying asset price.
Returns: The implied volatility. If the value is equal to , then the value calculation currently is impossible.
public override decimal? Premium(DateTime currentTime, decimal? deviation, decimal? assetPrice)
result = basketBlackScholes.Premium(currentTime, deviation, assetPrice)
To calculate the option premium.
- currentTime
- The current time.
- deviation
- Standard deviation.
- assetPrice
- Underlying asset price.
Returns: The option premium. If the value is equal to , then the value calculation currently is impossible.
private decimal? ProcessOptions(Func<BlackScholes, decimal?> func)
result = basketBlackScholes.ProcessOptions(func)
To sum a value over the options of the basket, each weighted by the position in it.
- func
- The value of one option.
Returns: The sum; when an option the book holds cannot be valued, for the sum of the others is not the book's.
public override decimal? Rho(DateTime currentTime, decimal? deviation, decimal? assetPrice)
result = basketBlackScholes.Rho(currentTime, deviation, assetPrice)
To calculate the option rho.
- currentTime
- The current time.
- deviation
- Standard deviation.
- assetPrice
- Underlying asset price.
Returns: The option rho. If the value is equal to , then the value calculation currently is impossible.
public override decimal? Theta(DateTime currentTime, decimal? deviation, decimal? assetPrice)
result = basketBlackScholes.Theta(currentTime, deviation, assetPrice)
To calculate the option theta.
- currentTime
- The current time.
- deviation
- Standard deviation.
- assetPrice
- Underlying asset price.
Returns: The option theta. If the value is equal to , then the value calculation currently is impossible.
public override decimal? Vega(DateTime currentTime, decimal? deviation, decimal? assetPrice)
result = basketBlackScholes.Vega(currentTime, deviation, assetPrice)
To calculate the option vega.
- currentTime
- The current time.
- deviation
- Standard deviation.
- assetPrice
- Underlying asset price.
Returns: The option vega. If the value is equal to , then the value calculation currently is impossible.