fix bug
This commit is contained in:
@@ -35,6 +35,7 @@ type CollectorOrder struct {
|
||||
TradedPrice float64 `json:"traded_price" gorm:"type:decimal(10,4);not null;default:0;column:traded_price;comment:成交均价"`
|
||||
TradedVolume int `json:"traded_volume" gorm:"not null;default:0;column:traded_volume;comment:成交数量"`
|
||||
OrderStatus int `json:"order_status" gorm:"not null;default:0;column:order_status;comment:订单状态"`
|
||||
OffsetFlag int `json:"offset_flag" gorm:"not null;default:0;column:offset_flag;comment:开平标志"`
|
||||
OrderTime int64 `json:"order_time" gorm:"not null;column:order_time;comment:下单时间戳"`
|
||||
OrderRemark string `json:"order_remark" gorm:"type:text;column:order_remark;comment:订单备注"`
|
||||
DataHash string `json:"data_hash" gorm:"type:varchar(64);not null;comment:数据哈希值(用于变化检测)"`
|
||||
|
||||
@@ -139,6 +139,10 @@ func (s *Storage) SaveStatus(status *types.Status, dataHash string) error {
|
||||
if order.StockCode == "" {
|
||||
continue
|
||||
}
|
||||
// 只存储成交的订单
|
||||
if order.OrderStatus != 56 {
|
||||
continue
|
||||
}
|
||||
var open_price float64
|
||||
var info types.OrderInfo
|
||||
err = json.Unmarshal([]byte(order.OrderRemark), &info)
|
||||
@@ -165,6 +169,7 @@ func (s *Storage) SaveStatus(status *types.Status, dataHash string) error {
|
||||
OrderTime: order.OrderTime,
|
||||
OrderRemark: order.OrderRemark,
|
||||
DataHash: dataHash,
|
||||
OffsetFlag: order.OffsetFlag,
|
||||
CollectedAt: now,
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ type Order struct {
|
||||
TradedPrice float64 `json:"traded_price"`
|
||||
TradedVolume int `json:"traded_volume"`
|
||||
Volume int `json:"volume"`
|
||||
OffsetFlag int `json:"offset_flag"`
|
||||
}
|
||||
|
||||
// Position 持仓信息
|
||||
|
||||
Reference in New Issue
Block a user