From 1f744b0fa51f66d2611e3aaa8c4a317b43c80c8a Mon Sep 17 00:00:00 2001 From: c9s Date: Sun, 21 Mar 2021 11:10:55 +0800 Subject: [PATCH] convert limit maker type to post only --- pkg/exchange/max/exchange.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkg/exchange/max/exchange.go b/pkg/exchange/max/exchange.go index d6139d794..3610dc140 100644 --- a/pkg/exchange/max/exchange.go +++ b/pkg/exchange/max/exchange.go @@ -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: