Skip to content

Commit

Permalink
BlackScholes. Specify underlying asset directly.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikasoukhov committed Jan 23, 2017
1 parent 67a221c commit 9f96d84
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Algo/Derivatives/BasketBlackScholes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,18 @@ public BasketBlackScholes(ISecurityProvider securityProvider, IMarketDataProvide
_innerModels = new InnerModelList(this);
}

/// <summary>
/// Initializes a new instance of the <see cref="BasketBlackScholes"/>.
/// </summary>
/// <param name="underlyingAsset">Underlying asset.</param>
/// <param name="dataProvider">The market data provider.</param>
public BasketBlackScholes(Security underlyingAsset, IMarketDataProvider dataProvider)
: base(underlyingAsset, dataProvider)
{
_innerModels = new InnerModelList(this);
_underlyingAsset = underlyingAsset;
}

private readonly InnerModelList _innerModels;

/// <summary>
Expand Down
32 changes: 32 additions & 0 deletions Algo/Derivatives/BlackScholes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,38 @@ public BlackScholes(Security option, ISecurityProvider securityProvider, IMarket
Option = option;
}

/// <summary>
/// Initializes a new instance of the <see cref="BlackScholes"/>.
/// </summary>
/// <param name="underlyingAsset">Underlying asset.</param>
/// <param name="dataProvider">The market data provider.</param>
protected BlackScholes(Security underlyingAsset, IMarketDataProvider dataProvider)
{
if (underlyingAsset == null)
throw new ArgumentNullException(nameof(underlyingAsset));

if (dataProvider == null)
throw new ArgumentNullException(nameof(dataProvider));

_underlyingAsset = underlyingAsset;
DataProvider = dataProvider;
}

/// <summary>
/// Initializes a new instance of the <see cref="BlackScholes"/>.
/// </summary>
/// <param name="option">Options contract.</param>
/// <param name="underlyingAsset">Underlying asset.</param>
/// <param name="dataProvider">The market data provider.</param>
public BlackScholes(Security option, Security underlyingAsset, IMarketDataProvider dataProvider)
: this(underlyingAsset, dataProvider)
{
if (option == null)
throw new ArgumentNullException(nameof(option));

Option = option;
}

/// <summary>
/// The provider of information about instruments.
/// </summary>
Expand Down

0 comments on commit 9f96d84

Please sign in to comment.