using YLErp.Modules.CalculationModule;
namespace YLErp.Modules.CalcModules
{
///
/// 障碍期权计算测试
///
[TestClass]
public class BarrierOptionCalcTest : UnitTestBase
{
[TestMethod("卖出障碍期权,PV应为负值但得到正值")]
public void BarrierOptionCalcTest1()
{
var json = ReadResourceFile("TradeJson\\BarrierTrade1.json");
var td = JsonHelper.Deserialize(json);
Assert.IsNotNull(td);
var result = OptionCalculatorV2.GetOptionValueResult(new DateTime(2021, 5, 24), td, new OptionValueCalcRequest(0.03)
{
spotPrices = new[] { 6544.1218 },
vols = new[] { 0.1598 }
}, out _);
Assert.IsTrue(result.Pv < 0);
}
}
}