Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckOptionCode ¶
Types ¶
type Option ¶
type Option struct { Code string `gorm:"type:varchar(64);not null"` // 期权code Stock string `gorm:"type:varchar(64);not null"` // 标的 ExerciseDate string `gorm:"not null"` // 行权日 Type string `gorm:"type:varchar(64);not null"` // 期权类型:put or call StrikePrice string `gorm:"not null"` // 行权价 ContractSize int64 `gorm:"not null"` // 合约数量 }
type OptionStrategy ¶
type OptionStrategy struct { ID Timestamps Name string `gorm:"type:varchar(128)"` Namespace string `gorm:"type:varchar(16)"` Labels string `gorm:"type:varchar(512)"` Code string `gorm:"type:varchar(64)"` }
func NewOptionStrategy ¶
func NewOptionStrategy(st enum.OptionStrategyEnum) *OptionStrategy
type OptionTrade ¶
type OptionTrade struct { ID Timestamps Option Sid uint // optionstrategy关联id Position string `gorm:"type:varchar(32)"` // seller or buyer BuyPrice string `gorm:"type:varchar(32)"` // 买价格 SellPrice string `gorm:"type:varchar(32)"` // 卖价格 Profit string `gorm:"type:varchar(32)"` // 收益 ProfitRate string `gorm:"type:varchar(32)"` // 收益率 Count int64 `gorm:"not null"` // 数量 Premium string `gorm:"not null"` // 期权权利金 Status string `gorm:"not null"` // 状态 Market string `gorm:"type:varchar(8)"` // 股票市场 HK/US OpenTime time.Time // 开仓时间 CloseTime time.Time // 平仓时间 }
func NewOptionTrade ¶
func NewOptionTrade(market, code string, optPositionEnum enum.OptionPositionEnum, price string) (*OptionTrade, error)
func (*OptionTrade) Roll ¶
func (trade *OptionTrade) Roll(closePrice, exerciseDate, sellPrice string) (*OptionTrade, error)
roll put
type StockTrade ¶
type StockTrade struct { ID Timestamps Stock OptionCode string `gorm:"type:varchar(8)"` // 期权code CostPrice string `gorm:"type:varchar(32);not null"` // 成本价 SellPrice string `gorm:"type:varchar(32);not null"` // 卖出价 Count int64 `gorm:"not null"` // 持仓数量 Profit string `gorm:"type:varchar(64)"` // 收益 Status string `gorm:"type:varchar(16)"` // 状态 Market string `gorm:"type:varchar(8)"` // 股票市场 HK/US }
func NewStockTrade ¶
func NewStockTrade(market, code, optionCode, price string, count int) (*StockTrade, error)
type Timestamps ¶
type Timestamps struct { CreateTime time.Time `gorm:"not null"` UpdateTime time.Time `gorm:"not null"` }
创建、更新时间
type TradeHistory ¶
type TradeHistory struct { ID Timestamps Code string `gorm:"type:varchar(16);not null"` // 代码 Name string `gorm:"type:varchar(64);not null"` // 名称 Direction string `gorm:"type:varchar(8);not null"` // 方向 Count string `gorm:"not null"` // 成交数 Price string `gorm:"not null"` // 成交价格 Amount string `gorm:"not null"` // 金额 TradeTime time.Time `gorm:"not null"` // 成交时间 }
func NewTradeHistory ¶
func NewTradeHistory() *TradeHistory
Source Files
¶
Click to show internal directories.
Click to hide internal directories.