public void ThrowsIfSecurityIsNotOption() { Assert.Throws <ArgumentException>(() => { _ = new OptionPriceModelPriceGenerator(_underlying); }); }
public void ThrowsIfSecurityIsNull() { Assert.Throws <ArgumentNullException>(() => { _ = new OptionPriceModelPriceGenerator(null); }); }
public void WarmedUpIfNotQLOptionPriceModel() { _option.PriceModel = Mock.Of <IOptionPriceModel>(); var blackScholesModel = new OptionPriceModelPriceGenerator(_option); Assert.True(blackScholesModel.WarmedUp); }
public void ReturnsNewPrice() { var priceModelMock = new Mock <IOptionPriceModel>(); priceModelMock .Setup(s => s.Evaluate(It.IsAny <Security>(), It.IsAny <Slice>(), It.IsAny <OptionContract>())) .Returns(new OptionPriceModelResult(1000, new Greeks())); _option.PriceModel = priceModelMock.Object; var randomPriceGenerator = new OptionPriceModelPriceGenerator(_option); Assert.AreEqual(1000, randomPriceGenerator.NextValue(50, new DateTime(2020, 1, 1))); }
public void WarmedUpSameQLOptionPriceModel(bool warmUp) { var volatilityModel = new Mock <IQLUnderlyingVolatilityEstimator>(); volatilityModel.SetupGet(s => s.IsReady).Returns(warmUp); _option.PriceModel = new QLOptionPriceModel(process => new AnalyticEuropeanEngine(process), volatilityModel.Object, null, null); var blackScholesModel = new OptionPriceModelPriceGenerator(_option); Assert.AreEqual(warmUp, blackScholesModel.WarmedUp); }