binance: fix binance order type for limit maker

This commit is contained in:
c9s 2021-10-18 00:41:41 +08:00
parent 759b6a812b
commit e3431ef970
2 changed files with 10 additions and 4 deletions

View File

@ -105,6 +105,10 @@ func toGlobalTicker(stats *binance.PriceChangeStats) types.Ticker {
func toLocalOrderType(orderType types.OrderType) (binance.OrderType, error) {
switch orderType {
case types.OrderTypeLimitMaker:
return binance.OrderTypeLimitMaker, nil
case types.OrderTypeLimit:
return binance.OrderTypeLimit, nil
@ -118,7 +122,7 @@ func toLocalOrderType(orderType types.OrderType) (binance.OrderType, error) {
return binance.OrderTypeMarket, nil
}
return "", fmt.Errorf("order type %s not supported", orderType)
return "", fmt.Errorf("can not convert to local order, order type %s not supported", orderType)
}
func toGlobalOrders(binanceOrders []*binance.Order) (orders []types.Order, err error) {
@ -223,7 +227,7 @@ func toGlobalSideType(side binance.SideType) types.SideType {
return types.SideTypeSell
default:
log.Errorf("unknown side type: %v", side)
log.Errorf("can not convert binance side type, unknown side type: %q", side)
return ""
}
}

View File

@ -556,7 +556,7 @@ func (e *Exchange) submitMarginOrder(ctx context.Context, order types.SubmitOrde
// set price field for limit orders
switch order.Type {
case types.OrderTypeStopLimit, types.OrderTypeLimit:
case types.OrderTypeStopLimit, types.OrderTypeLimit, types.OrderTypeLimitMaker:
if len(order.PriceString) > 0 {
req.Price(order.PriceString)
} else if order.Market.Symbol != "" {
@ -669,7 +669,7 @@ func (e *Exchange) submitSpotOrder(ctx context.Context, order types.SubmitOrder)
// set price field for limit orders
switch order.Type {
case types.OrderTypeStopLimit, types.OrderTypeLimit:
case types.OrderTypeStopLimit, types.OrderTypeLimit, types.OrderTypeLimitMaker:
if len(order.PriceString) > 0 {
req.Price(order.PriceString)
} else if order.Market.Symbol != "" {
@ -696,6 +696,8 @@ func (e *Exchange) submitSpotOrder(ctx context.Context, order types.SubmitOrder)
}
}
req.NewOrderRespType(binance.NewOrderRespTypeRESULT)
response, err := req.Do(ctx)
if err != nil {
return nil, err