binance: add updated time field

This commit is contained in:
c9s 2022-03-06 18:32:33 +08:00
parent f3577a4182
commit af2070b908

View File

@ -102,7 +102,6 @@ type ExecutionReportEvent struct {
} }
func (e *ExecutionReportEvent) Order() (*types.Order, error) { func (e *ExecutionReportEvent) Order() (*types.Order, error) {
switch e.CurrentExecutionType { switch e.CurrentExecutionType {
case "NEW", "CANCELED", "REJECTED", "EXPIRED": case "NEW", "CANCELED", "REJECTED", "EXPIRED":
case "REPLACED": case "REPLACED":
@ -113,7 +112,6 @@ func (e *ExecutionReportEvent) Order() (*types.Order, error) {
orderCreationTime := time.Unix(0, e.OrderCreationTime*int64(time.Millisecond)) orderCreationTime := time.Unix(0, e.OrderCreationTime*int64(time.Millisecond))
return &types.Order{ return &types.Order{
Exchange: types.ExchangeBinance,
SubmitOrder: types.SubmitOrder{ SubmitOrder: types.SubmitOrder{
Symbol: e.Symbol, Symbol: e.Symbol,
ClientOrderID: e.ClientOrderID, ClientOrderID: e.ClientOrderID,
@ -123,10 +121,13 @@ func (e *ExecutionReportEvent) Order() (*types.Order, error) {
Price: e.OrderPrice, Price: e.OrderPrice,
TimeInForce: types.TimeInForce(e.TimeInForce), TimeInForce: types.TimeInForce(e.TimeInForce),
}, },
Exchange: types.ExchangeBinance,
IsWorking: e.IsOnBook,
OrderID: uint64(e.OrderID), OrderID: uint64(e.OrderID),
Status: toGlobalOrderStatus(binance.OrderStatusType(e.CurrentOrderStatus)), Status: toGlobalOrderStatus(binance.OrderStatusType(e.CurrentOrderStatus)),
ExecutedQuantity: e.CumulativeFilledQuantity, ExecutedQuantity: e.CumulativeFilledQuantity,
CreationTime: types.Time(orderCreationTime), CreationTime: types.Time(orderCreationTime),
UpdateTime: types.Time(orderCreationTime),
}, nil }, nil
} }