convert limit maker type to post only

This commit is contained in:
c9s 2021-03-21 11:10:55 +08:00
parent 837934e690
commit 1f744b0fa5

View File

@ -311,9 +311,15 @@ func (e *Exchange) SubmitOrders(ctx context.Context, orders ...types.SubmitOrder
req := e.client.OrderService.NewCreateOrderRequest().
Market(toLocalSymbol(order.Symbol)).
OrderType(string(orderType)).
Side(toLocalSideType(order.Side))
// convert limit maker to post_only
if order.Type == types.OrderTypeLimitMaker {
req.OrderType(string(maxapi.OrderTypePostOnly))
} else {
req.OrderType(string(orderType))
}
if len(order.ClientOrderID) > 0 {
req.ClientOrderID(order.ClientOrderID)
} else {
@ -331,7 +337,7 @@ func (e *Exchange) SubmitOrders(ctx context.Context, orders ...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 != "" {
@ -339,6 +345,7 @@ func (e *Exchange) SubmitOrders(ctx context.Context, orders ...types.SubmitOrder
}
}
// set stop price field for limit orders
switch order.Type {
case types.OrderTypeStopLimit, types.OrderTypeStopMarket: