双买交易行权价拆分为看涨行权价和看跌行权价,支持不同价位

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
fish
2026-07-28 14:37:53 +08:00
parent af3e359d24
commit 39c5e22ed6
4 changed files with 53 additions and 28 deletions
+4 -3
View File
@@ -188,7 +188,8 @@ class DualOptionTrade(Base):
id: Mapped[int] = mapped_column(primary_key=True)
product_code: Mapped[str] = mapped_column(String(10))
contract_code: Mapped[str] = mapped_column(String(10), index=True)
strike_price: Mapped[float] = mapped_column(Float)
call_strike_price: Mapped[float] = mapped_column(Float)
put_strike_price: Mapped[float] = mapped_column(Float)
call_open_price: Mapped[float] = mapped_column(Float)
put_open_price: Mapped[float] = mapped_column(Float)
call_open_fee: Mapped[float | None] = mapped_column(Float, nullable=True, default=0)
@@ -225,8 +226,8 @@ class DualOptionTrade(Base):
@property
def breakeven_upper(self) -> float:
return self.strike_price + self.total_premium
return self.call_strike_price + self.total_premium
@property
def breakeven_lower(self) -> float:
return self.strike_price - self.total_premium
return self.put_strike_price - self.total_premium