Add Python overload for OptionPriceModelResult (#9277)
Report Generator Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Syntax Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled
API Tests / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled

* Add python overload for OptionPriceModelResult constructor

* Solve review comments

* Update regression algorithms
This commit is contained in:
JosueNina
2026-02-10 14:48:57 -05:00
committed by GitHub
parent 769843b118
commit 63209a3fd3
4 changed files with 84 additions and 10 deletions
@@ -62,12 +62,17 @@ class CustomOptionPriceModel():
contract = parameters.contract
underlying = contract.underlying_last_price
strike = contract.strike
greeks = Greeks(0.5, 0.2, 0.15, 0.05, 0.1, 2.0)
if contract.right == OptionRight.CALL:
intrinsic = max(0, underlying - strike)
else:
intrinsic = max(0, strike - underlying)
# Delta and Rho are negative for a put
greeks.delta *= -1
greeks.rho *= -1
theoretical_price = intrinsic + 1.0
implied_volatility = 0.2
return OptionPriceModelResult(theoretical_price, Greeks(0.5, 0.1, 0.2, -0.05, 0.1, 2.0))
return OptionPriceModelResult(theoretical_price, implied_volatility, greeks)