diff --git a/pkg/exchange/ftx/convert.go b/pkg/exchange/ftx/convert.go index efb58073e..d3a5d1882 100644 --- a/pkg/exchange/ftx/convert.go +++ b/pkg/exchange/ftx/convert.go @@ -42,13 +42,19 @@ func toGlobalOrder(r order) (types.Order, error) { if r.Ioc { timeInForce = types.TimeInForceIOC } + + // order type definition: https://github.com/ftexchange/ftx/blob/master/rest/client.py#L122 + orderType := types.OrderType(TrimUpperString(r.Type)) + if orderType == types.OrderTypeLimit && r.PostOnly { + orderType = types.OrderTypeLimitMaker + } + o := types.Order{ SubmitOrder: types.SubmitOrder{ ClientOrderID: r.ClientId, Symbol: toGlobalSymbol(r.Market), Side: types.SideType(TrimUpperString(r.Side)), - // order type definition: https://github.com/ftexchange/ftx/blob/master/rest/client.py#L122 - Type: types.OrderType(TrimUpperString(r.Type)), + Type: orderType, Quantity: r.Size, Price: r.Price, TimeInForce: timeInForce, diff --git a/pkg/exchange/ftx/convert_test.go b/pkg/exchange/ftx/convert_test.go index fbf1bb27e..79e5a8e2b 100644 --- a/pkg/exchange/ftx/convert_test.go +++ b/pkg/exchange/ftx/convert_test.go @@ -102,27 +102,20 @@ func Test_toGlobalSymbol(t *testing.T) { } func Test_toLocalOrderTypeWithLimitMaker(t *testing.T) { - orderType, err := toLocalOrderType(types.OrderTypeLimitMaker) - assert.NoError(t, err) assert.Equal(t, orderType, OrderTypeLimit) - assert.Equal(t, postOnly, true) } func Test_toLocalOrderTypeWithLimit(t *testing.T) { - orderType, err := toLocalOrderType(types.OrderTypeLimit) - assert.NoError(t, err) assert.Equal(t, orderType, OrderTypeLimit) - assert.Equal(t, postOnly, false) } func Test_toLocalOrderTypeWithMarket(t *testing.T) { orderType, err := toLocalOrderType(types.OrderTypeMarket) assert.NoError(t, err) assert.Equal(t, orderType, OrderTypeMarket) - assert.Equal(t, postOnly, false) }