双买交易行权价拆分为看涨行权价和看跌行权价,支持不同价位
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user