diff --git a/protocol/x/vault/keeper/orders.go b/protocol/x/vault/keeper/orders.go index 5b0f6dd99d..d017a6c963 100644 --- a/protocol/x/vault/keeper/orders.go +++ b/protocol/x/vault/keeper/orders.go @@ -314,20 +314,12 @@ func (k Keeper) GetVaultClobOrders( maxSubticks, ) - // If the side would increase the vault's inventory, make the order post-only. - timeInForceType := clobtypes.Order_TIME_IN_FORCE_UNSPECIFIED - if (side == clobtypes.Order_SIDE_SELL && inventory.Sign() <= 0) || - (side == clobtypes.Order_SIDE_BUY && inventory.Sign() >= 0) { - timeInForceType = clobtypes.Order_TIME_IN_FORCE_POST_ONLY - } - return &clobtypes.Order{ OrderId: *orderId, Side: side, Quantums: orderSize.Uint64(), // Validated to be a uint64 above. Subticks: subticksRounded, GoodTilOneof: goodTilBlockTime, - TimeInForce: timeInForceType, } } diff --git a/protocol/x/vault/keeper/orders_test.go b/protocol/x/vault/keeper/orders_test.go index 50aad4799b..3d86f78dc0 100644 --- a/protocol/x/vault/keeper/orders_test.go +++ b/protocol/x/vault/keeper/orders_test.go @@ -493,7 +493,6 @@ func TestGetVaultClobOrders(t *testing.T) { /* --- Expectations --- */ expectedOrderSubticks []uint64 expectedOrderQuantums []uint64 - expectedTimeInForce []clobtypes.Order_TimeInForce expectedErr error }{ "Success - Vault Clob 0, 2 layers, leverage 0, doesn't cross oracle price": { @@ -569,14 +568,6 @@ func TestGetVaultClobOrders(t *testing.T) { 20_000_000_000, 20_000_000_000, }, - // post-only if increases inventory - // vault is flat, all orders should be post-only - expectedTimeInForce: []clobtypes.Order_TimeInForce{ - clobtypes.Order_TIME_IN_FORCE_POST_ONLY, - clobtypes.Order_TIME_IN_FORCE_POST_ONLY, - clobtypes.Order_TIME_IN_FORCE_POST_ONLY, - clobtypes.Order_TIME_IN_FORCE_POST_ONLY, - }, }, "Success - Vault Clob 1, 3 layers, leverage -0.6, doesn't cross oracle price": { vaultQuotingParams: vaulttypes.QuotingParams{ @@ -657,16 +648,6 @@ func TestGetVaultClobOrders(t *testing.T) { 41_666_000, 41_666_000, }, - // post-only if increases inventory - // vault is short, sell orders should be post-only - expectedTimeInForce: []clobtypes.Order_TimeInForce{ - clobtypes.Order_TIME_IN_FORCE_POST_ONLY, - clobtypes.Order_TIME_IN_FORCE_UNSPECIFIED, - clobtypes.Order_TIME_IN_FORCE_POST_ONLY, - clobtypes.Order_TIME_IN_FORCE_UNSPECIFIED, - clobtypes.Order_TIME_IN_FORCE_POST_ONLY, - clobtypes.Order_TIME_IN_FORCE_UNSPECIFIED, - }, }, "Success - Vault Clob 1, 3 layers, leverage -3, crosses oracle price": { vaultQuotingParams: vaulttypes.QuotingParams{ @@ -747,16 +728,6 @@ func TestGetVaultClobOrders(t *testing.T) { 33_333_000, 33_333_000, }, - // post-only if increases inventory - // vault is short, sell orders should be post-only - expectedTimeInForce: []clobtypes.Order_TimeInForce{ - clobtypes.Order_TIME_IN_FORCE_POST_ONLY, - clobtypes.Order_TIME_IN_FORCE_UNSPECIFIED, - clobtypes.Order_TIME_IN_FORCE_POST_ONLY, - clobtypes.Order_TIME_IN_FORCE_UNSPECIFIED, - clobtypes.Order_TIME_IN_FORCE_POST_ONLY, - clobtypes.Order_TIME_IN_FORCE_UNSPECIFIED, - }, }, "Success - Vault Clob 1, 2 layers, leverage 3, crosses oracle price": { vaultQuotingParams: vaulttypes.QuotingParams{ @@ -825,14 +796,6 @@ func TestGetVaultClobOrders(t *testing.T) { 333_333_000, 333_333_000, }, - // post-only if increases inventory - // vault is long, buy orders should be post-only - expectedTimeInForce: []clobtypes.Order_TimeInForce{ - clobtypes.Order_TIME_IN_FORCE_UNSPECIFIED, - clobtypes.Order_TIME_IN_FORCE_POST_ONLY, - clobtypes.Order_TIME_IN_FORCE_UNSPECIFIED, - clobtypes.Order_TIME_IN_FORCE_POST_ONLY, - }, }, "Success - Get orders from Vault for Clob Pair 1, No Orders due to Zero Order Size": { vaultQuotingParams: vaulttypes.QuotingParams{ @@ -857,7 +820,6 @@ func TestGetVaultClobOrders(t *testing.T) { // round down to nearest multiple of step_base_quantums=1_000. // order size is 0. expectedOrderQuantums: []uint64{}, - expectedTimeInForce: []clobtypes.Order_TimeInForce{}, }, "Success - Clob Pair doesn't exist, Empty orders": { vaultQuotingParams: vaulttypes.DefaultQuotingParams(), @@ -868,7 +830,6 @@ func TestGetVaultClobOrders(t *testing.T) { perpetual: constants.EthUsd_NoMarginRequirement, expectedOrderSubticks: []uint64{}, expectedOrderQuantums: []uint64{}, - expectedTimeInForce: []clobtypes.Order_TimeInForce{}, }, "Success - Clob Pair in status final settlement, Empty orders": { vaultQuotingParams: vaulttypes.DefaultQuotingParams(), @@ -890,7 +851,6 @@ func TestGetVaultClobOrders(t *testing.T) { perpetual: constants.EthUsd_NoMarginRequirement, expectedOrderSubticks: []uint64{}, expectedOrderQuantums: []uint64{}, - expectedTimeInForce: []clobtypes.Order_TimeInForce{}, }, "Error - Vault equity is zero": { vaultQuotingParams: vaulttypes.DefaultQuotingParams(), @@ -1019,7 +979,6 @@ func TestGetVaultClobOrders(t *testing.T) { side clobtypes.Order_Side, quantums uint64, subticks uint64, - timeInForce clobtypes.Order_TimeInForce, ) *clobtypes.Order { return &clobtypes.Order{ OrderId: clobtypes.OrderId{ @@ -1034,7 +993,6 @@ func TestGetVaultClobOrders(t *testing.T) { GoodTilOneof: &clobtypes.Order_GoodTilBlockTime{ GoodTilBlockTime: uint32(ctx.BlockTime().Unix()) + tc.vaultQuotingParams.OrderExpirationSeconds, }, - TimeInForce: timeInForce, } } expectedOrders := make([]*clobtypes.Order, 0) @@ -1047,7 +1005,6 @@ func TestGetVaultClobOrders(t *testing.T) { clobtypes.Order_SIDE_SELL, tc.expectedOrderQuantums[i], tc.expectedOrderSubticks[i], - tc.expectedTimeInForce[i], ), // bid. buildVaultClobOrder( @@ -1055,7 +1012,6 @@ func TestGetVaultClobOrders(t *testing.T) { clobtypes.Order_SIDE_BUY, tc.expectedOrderQuantums[i+1], tc.expectedOrderSubticks[i+1], - tc.expectedTimeInForce[i+1], ), ) }