From 290475911373e5c63e36ce278a33423fcf1f1004 Mon Sep 17 00:00:00 2001 From: edwin Date: Wed, 13 Mar 2024 14:54:29 +0800 Subject: [PATCH] pkg/exchange: remove the query after place order --- pkg/exchange/okex/exchange.go | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/pkg/exchange/okex/exchange.go b/pkg/exchange/okex/exchange.go index 85d6736ba8..622cdb0bc4 100644 --- a/pkg/exchange/okex/exchange.go +++ b/pkg/exchange/okex/exchange.go @@ -260,6 +260,7 @@ func (e *Exchange) SubmitOrder(ctx context.Context, order types.SubmitOrder) (*t orderReq.ClientOrderID(order.ClientOrderID) } + timeNow := time.Now() orders, err := orderReq.Do(ctx) if err != nil { return nil, err @@ -269,16 +270,21 @@ func (e *Exchange) SubmitOrder(ctx context.Context, order types.SubmitOrder) (*t return nil, fmt.Errorf("unexpected length of order response: %v", orders) } - orderRes, err := e.QueryOrder(ctx, types.OrderQuery{ - Symbol: order.Symbol, - OrderID: orders[0].OrderID, - ClientOrderID: orders[0].ClientOrderID, - }) + orderID, err := strconv.ParseUint(orders[0].OrderID, 10, 64) if err != nil { - return nil, fmt.Errorf("failed to query order by id: %s, clientOrderId: %s, err: %w", orders[0].OrderID, orders[0].ClientOrderID, err) - } - - return orderRes, nil + return nil, fmt.Errorf("failed to parse response order id: %w", err) + } + + return &types.Order{ + SubmitOrder: order, + Exchange: types.ExchangeOKEx, + OrderID: orderID, + Status: types.OrderStatusNew, + ExecutedQuantity: fixedpoint.Zero, + IsWorking: true, + CreationTime: types.Time(timeNow), + UpdateTime: types.Time(timeNow), + }, nil // TODO: move this to batch place orders interface /*