max: remove ioc limit type

This commit is contained in:
c9s 2022-02-18 13:57:47 +08:00
parent 0c09e6b32a
commit fb9f8b484c
4 changed files with 7 additions and 15 deletions

View File

@ -131,12 +131,3 @@ func Test_toLocalOrderTypeWithMarket(t *testing.T) {
assert.Equal(t, IOC, false) assert.Equal(t, IOC, false)
} }
func Test_toLocalOrderTypeWithIOCLimit(t *testing.T) {
orderType, postOnly, IOC, err := toLocalOrderType(types.OrderTypeIOCLimit)
assert.NoError(t, err)
assert.Equal(t, orderType, OrderTypeLimit)
assert.Equal(t, postOnly, false)
assert.Equal(t, IOC, true)
}

View File

@ -121,7 +121,7 @@ func toGlobalOrderType(orderType max.OrderType) types.OrderType {
return types.OrderTypeStopMarket return types.OrderTypeStopMarket
case max.OrderTypeIOCLimit: case max.OrderTypeIOCLimit:
return types.OrderTypeIOCLimit return types.OrderTypeLimit
case max.OrderTypePostOnly: case max.OrderTypePostOnly:
return types.OrderTypeLimitMaker return types.OrderTypeLimitMaker
@ -149,9 +149,6 @@ func toLocalOrderType(orderType types.OrderType) (max.OrderType, error) {
case types.OrderTypeMarket: case types.OrderTypeMarket:
return max.OrderTypeMarket, nil return max.OrderTypeMarket, nil
case types.OrderTypeIOCLimit:
return max.OrderTypeIOCLimit, nil
} }
return "", fmt.Errorf("order type %s not supported", orderType) return "", fmt.Errorf("order type %s not supported", orderType)

View File

@ -418,6 +418,11 @@ func toMaxSubmitOrder(o types.SubmitOrder) (*maxapi.Order, error) {
return nil, err return nil, err
} }
// case IOC type
if orderType == maxapi.OrderTypeLimit && o.TimeInForce == types.TimeInForceIOC {
orderType = maxapi.OrderTypeIOCLimit
}
var quantityString string var quantityString string
if o.Market.Symbol != "" { if o.Market.Symbol != "" {
quantityString = o.Market.FormatQuantity(o.Quantity) quantityString = o.Market.FormatQuantity(o.Quantity)
@ -443,7 +448,7 @@ func toMaxSubmitOrder(o types.SubmitOrder) (*maxapi.Order, error) {
} }
switch o.Type { switch o.Type {
case types.OrderTypeStopLimit, types.OrderTypeLimit, types.OrderTypeLimitMaker, types.OrderTypeIOCLimit: case types.OrderTypeStopLimit, types.OrderTypeLimit, types.OrderTypeLimitMaker:
var priceInString string var priceInString string
if o.Market.Symbol != "" { if o.Market.Symbol != "" {
priceInString = o.Market.FormatPrice(o.Price) priceInString = o.Market.FormatPrice(o.Price)

View File

@ -75,7 +75,6 @@ const (
OrderTypeMarket OrderType = "MARKET" OrderTypeMarket OrderType = "MARKET"
OrderTypeStopLimit OrderType = "STOP_LIMIT" OrderTypeStopLimit OrderType = "STOP_LIMIT"
OrderTypeStopMarket OrderType = "STOP_MARKET" OrderTypeStopMarket OrderType = "STOP_MARKET"
OrderTypeIOCLimit OrderType = "IOC_LIMIT"
) )
/* /*