Checks / verify (push) Failing after 9m52s
统一单入口 Go 工程与前端依赖目录,增加后台供应商配置、候选审核、计划预算、成交冲正、持仓复盘和站内通知。接入策略版本、Python 回测、可配置 A 股公开行情及 zap 文件轮转日志,补充迁移、契约与验证。
94 lines
3.6 KiB
Go
94 lines
3.6 KiB
Go
package model
|
|
|
|
import "time"
|
|
|
|
type TradeFill struct {
|
|
ID string `db:"id" json:"id"`
|
|
AccountID string `db:"account_id" json:"account_id"`
|
|
PlanID *string `db:"plan_id" json:"plan_id"`
|
|
IdempotencyKey string `db:"idempotency_key" json:"idempotency_key"`
|
|
InputHash string `db:"input_hash" json:"-"`
|
|
PostedSequence int64 `db:"posted_sequence" json:"-"`
|
|
Side string `db:"side" json:"side"`
|
|
Symbol string `db:"symbol" json:"symbol"`
|
|
Exchange string `db:"exchange" json:"exchange"`
|
|
Name string `db:"name" json:"name"`
|
|
Quantity int64 `db:"quantity" json:"quantity,string"`
|
|
PriceMinor int64 `db:"price_minor" json:"-"`
|
|
FeeMinor int64 `db:"fee_minor" json:"-"`
|
|
CashDeltaMinor int64 `db:"cash_delta_minor" json:"-"`
|
|
RealizedMinor int64 `db:"realized_minor" json:"-"`
|
|
Price string `json:"price"`
|
|
Fee string `json:"fee"`
|
|
CashDelta string `json:"cash_delta"`
|
|
RealizedPnL string `json:"realized_pnl"`
|
|
OccurredAt time.Time `db:"occurred_at" json:"occurred_at"`
|
|
SellableAt *time.Time `db:"sellable_at" json:"sellable_at"`
|
|
Note string `db:"note" json:"note"`
|
|
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
|
Reversed bool `json:"reversed"`
|
|
}
|
|
|
|
func (TradeFill) TableName() string { return "veyra_trade_fill" }
|
|
|
|
type TradeReversal struct {
|
|
ID string `db:"id" json:"id"`
|
|
FillID string `db:"fill_id" json:"fill_id"`
|
|
ActorID string `db:"actor_id" json:"actor_id"`
|
|
Reason string `db:"reason" json:"reason"`
|
|
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
|
}
|
|
|
|
func (TradeReversal) TableName() string { return "veyra_trade_reversal" }
|
|
|
|
type PositionLot struct {
|
|
ID string `db:"id"`
|
|
AccountID string `db:"account_id"`
|
|
BuyFillID string `db:"buy_fill_id"`
|
|
Symbol string `db:"symbol"`
|
|
Exchange string `db:"exchange"`
|
|
RemainingQuantity int64 `db:"remaining_quantity"`
|
|
RemainingCostMinor int64 `db:"remaining_cost_minor"`
|
|
SellableAt time.Time `db:"sellable_at"`
|
|
CreatedAt time.Time `db:"created_at"`
|
|
}
|
|
|
|
func (PositionLot) TableName() string { return "veyra_position_lot" }
|
|
|
|
type FillAllocation struct {
|
|
ID string `db:"id"`
|
|
SellFillID string `db:"sell_fill_id"`
|
|
LotID string `db:"lot_id"`
|
|
Quantity int64 `db:"quantity"`
|
|
CostMinor int64 `db:"cost_minor"`
|
|
}
|
|
|
|
func (FillAllocation) TableName() string { return "veyra_fill_allocation" }
|
|
|
|
type PositionSummary struct {
|
|
Symbol string `json:"symbol"`
|
|
Exchange string `json:"exchange"`
|
|
Name string `json:"name"`
|
|
Quantity string `json:"quantity"`
|
|
SellableQuantity string `json:"sellable_quantity"`
|
|
CostBasis string `json:"cost_basis"`
|
|
MarketValue *string `json:"market_value"`
|
|
UnrealizedPnL *string `json:"unrealized_pnl"`
|
|
}
|
|
type LedgerReview struct {
|
|
TradeCount int64 `json:"trade_count"`
|
|
SellCount int64 `json:"sell_count"`
|
|
ProfitableSellCount int64 `json:"profitable_sell_count"`
|
|
LosingSellCount int64 `json:"losing_sell_count"`
|
|
BuyOutflow string `json:"buy_outflow"`
|
|
SellInflow string `json:"sell_inflow"`
|
|
TotalFees string `json:"total_fees"`
|
|
}
|
|
type PortfolioSummary struct {
|
|
Review LedgerReview `json:"review"`
|
|
AccountID string `json:"account_id"`
|
|
CashBalance string `json:"cash_balance"`
|
|
RealizedPnL string `json:"realized_pnl"`
|
|
Positions []PositionSummary `json:"positions"`
|
|
}
|