xfunding: log submit failed orders

This commit is contained in:
c9s 2023-03-29 21:46:15 +08:00
parent 1383eb0401
commit d0566e23ec
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -624,7 +624,7 @@ func (s *Strategy) reduceFuturesPosition(ctx context.Context) {
return
}
createdOrders, err := s.futuresOrderExecutor.SubmitOrders(ctx, types.SubmitOrder{
submitOrder := types.SubmitOrder{
Symbol: s.Symbol,
Side: types.SideTypeBuy,
Type: types.OrderTypeLimitMaker,
@ -632,10 +632,11 @@ func (s *Strategy) reduceFuturesPosition(ctx context.Context) {
Price: orderPrice,
Market: s.futuresMarket,
ReduceOnly: true,
})
}
createdOrders, err := s.futuresOrderExecutor.SubmitOrders(ctx, submitOrder)
if err != nil {
log.WithError(err).Errorf("can not submit order")
log.WithError(err).Errorf("can not submit futures order: %+v", submitOrder)
return
}
@ -723,17 +724,18 @@ func (s *Strategy) syncFuturesPosition(ctx context.Context) {
return
}
createdOrders, err := s.futuresOrderExecutor.SubmitOrders(ctx, types.SubmitOrder{
submitOrder := types.SubmitOrder{
Symbol: s.Symbol,
Side: types.SideTypeSell,
Type: types.OrderTypeLimitMaker,
Quantity: orderQuantity,
Price: orderPrice,
Market: s.futuresMarket,
})
}
createdOrders, err := s.futuresOrderExecutor.SubmitOrders(ctx, submitOrder)
if err != nil {
log.WithError(err).Errorf("can not submit order")
log.WithError(err).Errorf("can not submit spot order: %+v", submitOrder)
return
}