Almost finish basic functionalities
All checks were successful
Backend CI / unit-test (push) Successful in 36s
All checks were successful
Backend CI / unit-test (push) Successful in 36s
This commit is contained in:
@@ -64,43 +64,53 @@ class ExchangesRead(ExchangesBase):
|
||||
|
||||
class CycleBase(SQLModel):
|
||||
friendly_name: str | None = None
|
||||
symbol: str
|
||||
exchange_id: int
|
||||
underlying_currency: UnderlyingCurrency
|
||||
status: str
|
||||
start_date: date
|
||||
end_date: date | None = None
|
||||
funding_source: str | None = None
|
||||
capital_exposure_cents: int | None = None
|
||||
loan_amount_cents: int | None = None
|
||||
loan_interest_rate_bps: int | None = None
|
||||
trades: list[TradeRead] | None = None
|
||||
exchange: ExchangesRead | None = None
|
||||
|
||||
|
||||
class CycleCreate(CycleBase):
|
||||
user_id: int
|
||||
symbol: str
|
||||
exchange_id: int
|
||||
underlying_currency: UnderlyingCurrency
|
||||
start_date: date
|
||||
|
||||
|
||||
class CycleUpdate(CycleBase):
|
||||
id: int
|
||||
|
||||
|
||||
class CycleRead(CycleCreate):
|
||||
id: int
|
||||
|
||||
|
||||
class TradeBase(SQLModel):
|
||||
user_id: int
|
||||
friendly_name: str | None
|
||||
friendly_name: str | None = None
|
||||
symbol: str
|
||||
exchange: str
|
||||
exchange_id: int
|
||||
underlying_currency: UnderlyingCurrency
|
||||
trade_type: TradeType
|
||||
trade_strategy: TradeStrategy
|
||||
trade_date: date
|
||||
trade_time_utc: datetime
|
||||
quantity: int
|
||||
price_cents: int
|
||||
gross_cash_flow_cents: int
|
||||
commission_cents: int
|
||||
net_cash_flow_cents: int
|
||||
notes: str | None
|
||||
notes: str | None = None
|
||||
cycle_id: int | None = None
|
||||
|
||||
|
||||
class TradeCreate(TradeBase):
|
||||
user_id: int | None = None
|
||||
trade_time_utc: datetime | None = None
|
||||
gross_cash_flow_cents: int | None = None
|
||||
net_cash_flow_cents: int | None = None
|
||||
quantity_multiplier: int = 1
|
||||
expiry_date: date | None = None
|
||||
strike_price_cents: int | None = None
|
||||
is_invalidated: bool = False
|
||||
@@ -108,7 +118,19 @@ class TradeCreate(TradeBase):
|
||||
replaced_by_trade_id: int | None = None
|
||||
|
||||
|
||||
class TradeRead(TradeBase):
|
||||
class TradeNoteUpdate(BaseModel):
|
||||
id: int
|
||||
is_invalidated: bool
|
||||
invalidated_at: datetime | None
|
||||
notes: str | None = None
|
||||
|
||||
|
||||
class TradeFriendlyNameUpdate(BaseModel):
|
||||
id: int
|
||||
friendly_name: str
|
||||
|
||||
|
||||
class TradeRead(TradeCreate):
|
||||
id: int
|
||||
|
||||
|
||||
SessionsCreate.model_rebuild()
|
||||
CycleBase.model_rebuild()
|
||||
|
||||
Reference in New Issue
Block a user