mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
binance: fix binance order type for limit maker
This commit is contained in:
parent
759b6a812b
commit
e3431ef970
|
@ -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 ""
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user