BlackScholes
Das Modell zur Berechnung der griechischen Werte nach der Black-Scholes-Formel.
Implementiert: IBlackScholes
Konstruktoren
protected BlackScholes(IMarketDataProvider dataProvider, DateTime? expirationTime)
blackScholes = BlackScholes(dataProvider, expirationTime)
Basiskonstruktor für geerbte Modelle.
- dataProvider
- Der Marktdatenanbieter.
- expirationTime
- Expliziter Optionsablaufmoment. Wenn null, wird Mitternacht von ExpiryDate verwendet, wenn verfügbar.
public BlackScholes(Security option, Security underlyingAsset, IMarketDataProvider dataProvider, DateTime? expirationTime)
blackScholes = BlackScholes(option, underlyingAsset, dataProvider, expirationTime)
Initialisiert eine neue Instanz von BlackScholes für eine bestimmte Option mit dem zugrunde liegenden Asset.
- option
- Optionskontrakt.
- underlyingAsset
- Basiswert.
- dataProvider
- Der Marktdatenanbieter.
- expirationTime
- Expliziter Optionsablaufmoment. Wenn null, wird Mitternacht von ExpiryDate verwendet, wenn verfügbar.
protected BlackScholes(Security underlyingAsset, IMarketDataProvider dataProvider, DateTime? expirationTime)
blackScholes = BlackScholes(underlyingAsset, dataProvider, expirationTime)
Initialisiert eine neue Instanz des BlackScholes nur für einen Basiswert (Nicht-Optionsmodelle).
- underlyingAsset
- Basiswert.
- dataProvider
- Der Marktdatenanbieter.
- expirationTime
- Expliziter Optionsablaufmoment. Wenn null, wird Mitternacht von ExpiryDate verwendet, wenn verfügbar.
Eigenschaften
public virtual IMarketDataProvider DataProvider { get; }
value = blackScholes.DataProvider
Der Marktdatenanbieter.
public decimal? DefaultDeviation { get; }
value = blackScholes.DefaultDeviation
Standardabweichung.
public virtual decimal Dividend { get; set; }
value = blackScholes.Dividend
blackScholes.Dividend = value
Dividendenbetrag auf Aktien.
public virtual DateTime? ExpirationTime { get; set; }
value = blackScholes.ExpirationTime
blackScholes.ExpirationTime = value
Expliziter Ablaufzeitpunkt. Wenn null, wird Mitternacht von ExpiryDate verwendet, wenn verfügbar.
protected OptionTypes OptionType { get; }
value = blackScholes.OptionType
Art der Option.
public decimal RiskFree { get; set; }
value = blackScholes.RiskFree
blackScholes.RiskFree = value
Der risikofreie Zinssatz.
public virtual int RoundDecimals { get; set; }
value = blackScholes.RoundDecimals
blackScholes.RoundDecimals = value
Die Anzahl der Dezimalstellen bei berechneten Werten ist -1, was bedeutet, dass keine Werte gerundet werden.
public virtual Security UnderlyingAsset { get; set; }
value = blackScholes.UnderlyingAsset
blackScholes.UnderlyingAsset = value
Basiswert.
Methoden
protected virtual decimal CalcDelta(decimal deviation, decimal assetPrice, double timeToExp)
result = blackScholes.CalcDelta(deviation, assetPrice, timeToExp)
To calculate the option delta from resolved inputs, before rounding.
- deviation
- Standard deviation.
- assetPrice
- Underlying asset price.
- timeToExp
- The option period before the expiration.
Rückgabe: Option delta.
protected virtual decimal CalcGamma(decimal deviation, decimal assetPrice, double timeToExp)
result = blackScholes.CalcGamma(deviation, assetPrice, timeToExp)
To calculate the option gamma from resolved inputs, before rounding.
- deviation
- Standard deviation.
- assetPrice
- Underlying asset price.
- timeToExp
- The option period before the expiration.
Rückgabe: Option gamma.
protected virtual decimal CalcPremium(decimal deviation, decimal assetPrice, double timeToExp)
result = blackScholes.CalcPremium(deviation, assetPrice, timeToExp)
To calculate the option premium from the model inputs already resolved by Decimal}).
- deviation
- Standard deviation.
- assetPrice
- Underlying asset price.
- timeToExp
- The option period before the expiration.
Rückgabe: The option premium.
protected virtual decimal CalcRho(decimal deviation, decimal assetPrice, double timeToExp)
result = blackScholes.CalcRho(deviation, assetPrice, timeToExp)
To calculate the option rho from resolved inputs, before rounding.
- deviation
- Standard deviation.
- assetPrice
- Underlying asset price.
- timeToExp
- The option period before the expiration.
Rückgabe: Option rho.
protected virtual decimal CalcTheta(decimal deviation, decimal assetPrice, double timeToExp)
result = blackScholes.CalcTheta(deviation, assetPrice, timeToExp)
To calculate the option theta from resolved inputs, before rounding.
- deviation
- Standard deviation.
- assetPrice
- Underlying asset price.
- timeToExp
- The option period before the expiration.
Rückgabe: Option theta.
protected virtual decimal CalcVega(decimal deviation, decimal assetPrice, double timeToExp)
result = blackScholes.CalcVega(deviation, assetPrice, timeToExp)
To calculate the option vega from resolved inputs, before rounding.
- deviation
- Standard deviation.
- assetPrice
- Underlying asset price.
- timeToExp
- The option period before the expiration.
Rückgabe: Option vega.
protected virtual double D1(decimal deviation, decimal assetPrice, double timeToExp)
result = blackScholes.D1(deviation, assetPrice, timeToExp)
Zur Berechnung des Parameters d1 der Optionserfüllungswahrscheinlichkeitsschätzung.
- deviation
- Standardabweichung.
- assetPrice
- Basiswert des Vermögens.
- timeToExp
- Optionsperiode vor dem Ablauf.
Rückgabe: Der d1-Parameter.
public virtual decimal? Delta(DateTime currentTime, decimal? deviation, decimal? assetPrice)
result = blackScholes.Delta(currentTime, deviation, assetPrice)
Um die Option Delta zu berechnen.
- currentTime
- Die aktuelle Zeit.
- deviation
- Standardabweichung.
- assetPrice
- Basiswert des Vermögens.
Rückgabe: Wenn der Wert gleich , dann ist die Wertberechnung derzeit unmöglich.
public virtual decimal? Gamma(DateTime currentTime, decimal? deviation, decimal? assetPrice)
result = blackScholes.Gamma(currentTime, deviation, assetPrice)
Um die Option Gamma zu berechnen.
- currentTime
- Die aktuelle Zeit.
- deviation
- Standardabweichung.
- assetPrice
- Basiswert des Vermögens.
Rückgabe: Wenn der Wert gleich ist, ist die Berechnung des Wertes derzeit unmöglich.
public decimal? GetAssetPrice(decimal? assetPrice)
result = blackScholes.GetAssetPrice(assetPrice)
Um den Preis des zugrunde liegenden Vermögenswertes zu erhalten.
- assetPrice
- Der Preis des Basiswerts, wenn er angegeben ist.
Rückgabe: Wenn der Wert gleich , dann ist die Wertberechnung derzeit unmöglich.
public virtual double? GetExpirationTimeLine(DateTime currentTime)
result = blackScholes.GetExpirationTimeLine(currentTime)
Die Zeit vor dem Ablauf Berechnung.
- currentTime
- Die aktuelle Zeit.
Rückgabe: Ist der Wert gleich , dann ist die Berechnung des Wertes derzeit unmöglich.
protected ValueTuple<decimal, decimal, double>? GetInputs(DateTime currentTime, decimal? deviation, decimal? assetPrice)
result = blackScholes.GetInputs(currentTime, deviation, assetPrice)
What every value of the model is computed from: the deviation the caller gives or the one quoted, the asset price the caller gives or the last trade, and the time left to expiry.
- currentTime
- The current time.
- deviation
- The standard deviation, or for the quoted one.
- assetPrice
- The price of the underlying asset, or for its last trade.
Rückgabe: The inputs, or when one of them is not known.
public virtual decimal? ImpliedVolatility(DateTime currentTime, decimal premium, decimal? assetPrice)
result = blackScholes.ImpliedVolatility(currentTime, premium, assetPrice)
To calculate the implied volatility.
- currentTime
- The current time.
- premium
- The option premium.
- assetPrice
- Underlying asset price.
Rückgabe: The implied volatility. If the value is equal to , then the value calculation currently is impossible.
internal bool IsExpired(DateTime currentTime)
result = blackScholes.IsExpired(currentTime)
Whether the option has expired by the given moment, as the model takes its expiry.
- currentTime
- The current time.
Rückgabe: when the expiry is known and is not later than .
internal decimal? Payoff(decimal? assetPrice)
result = blackScholes.Payoff(assetPrice)
What the option pays at its expiry, before rounding: its intrinsic value at the price of the underlying asset.
- assetPrice
- The price of the underlying asset if it is specified.
Rückgabe: The payoff. If the value is equal to , then the price of the underlying asset is unknown.
internal decimal? PayoffDelta(decimal? assetPrice)
result = blackScholes.PayoffDelta(assetPrice)
The slope of what the option pays at its expiry: the asset it delivers, one for one while it is in the money.
- assetPrice
- The price of the underlying asset if it is specified.
Rückgabe: The delta of the payoff. If the value is equal to , then the price of the underlying asset is unknown.
public virtual decimal? Premium(DateTime currentTime, decimal? deviation, decimal? assetPrice)
result = blackScholes.Premium(currentTime, deviation, assetPrice)
Um die Optionsprämie zu berechnen.
- currentTime
- Die aktuelle Zeit.
- deviation
- Standardabweichung.
- assetPrice
- Basiswert des Vermögens.
Rückgabe: Wenn der Wert gleich , dann ist die Wertberechnung derzeit unmöglich.
public virtual decimal? Rho(DateTime currentTime, decimal? deviation, decimal? assetPrice)
result = blackScholes.Rho(currentTime, deviation, assetPrice)
Um die Option rho zu berechnen.
- currentTime
- Die aktuelle Zeit.
- deviation
- Standardabweichung.
- assetPrice
- Basiswert des Vermögens.
Rückgabe: Wenn der Wert gleich , ist die Berechnung des Wertes derzeit unmöglich.
public virtual decimal? Theta(DateTime currentTime, decimal? deviation, decimal? assetPrice)
result = blackScholes.Theta(currentTime, deviation, assetPrice)
Um die Option Theta zu berechnen.
- currentTime
- Die aktuelle Zeit.
- deviation
- Standardabweichung.
- assetPrice
- Basiswert des Vermögens.
Rückgabe: Wenn der Wert gleich , dann ist die Wertberechnung derzeit unmöglich.
protected decimal? TryRound(decimal? value)
result = blackScholes.TryRound(value)
Um auf RoundDecimals zu runden.
- value
- Der Anfangswert.
Rückgabe: Der gerundete Wert.
public virtual decimal? Vega(DateTime currentTime, decimal? deviation, decimal? assetPrice)
result = blackScholes.Vega(currentTime, deviation, assetPrice)
Um die Option vega zu berechnen.
- currentTime
- Die aktuelle Zeit.
- deviation
- Standardabweichung.
- assetPrice
- Basiswert des Vermögens.
Rückgabe: Wenn der Wert gleich , ist die Berechnung des Wertes derzeit unmöglich.