Skip to content

Commit

Permalink
[CLOB-184] - e2e short term order replacement tests (#491)
Browse files Browse the repository at this point in the history
* initial test

* add e2e tests for short term replacements

* remove misleading comment

* add IOC/FOK replacement tests

* format

* add test for replacing short term order with order on opposite side after partial fill

* fix IOC test that used FOK order
  • Loading branch information
jakob-dydx committed Oct 25, 2023
1 parent 9b416b3 commit 71529ce
Show file tree
Hide file tree
Showing 3 changed files with 448 additions and 2 deletions.
33 changes: 33 additions & 0 deletions protocol/x/clob/e2e/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,39 @@ var (
},
testapp.DefaultGenesis(),
))
// replacement of above order with smaller quantums
PlaceOrder_Alice_Num0_Id0_Clob0_Buy5_Price10_GTB21 = *clobtypes.NewMsgPlaceOrder(MustScaleOrder(
clobtypes.Order{
OrderId: clobtypes.OrderId{SubaccountId: constants.Alice_Num0, ClientId: 0, ClobPairId: 0},
Side: clobtypes.Order_SIDE_BUY,
Quantums: 5,
Subticks: 10,
GoodTilOneof: &clobtypes.Order_GoodTilBlock{GoodTilBlock: 21},
},
testapp.DefaultGenesis(),
))
// replacement of order with larger quantums
PlaceOrder_Alice_Num0_Id0_Clob0_Buy7_Price10_GTB21 = *clobtypes.NewMsgPlaceOrder(MustScaleOrder(
clobtypes.Order{
OrderId: clobtypes.OrderId{SubaccountId: constants.Alice_Num0, ClientId: 0, ClobPairId: 0},
Side: clobtypes.Order_SIDE_BUY,
Quantums: 7,
Subticks: 10,
GoodTilOneof: &clobtypes.Order_GoodTilBlock{GoodTilBlock: 21},
},
testapp.DefaultGenesis(),
))
// replacement of order on opposite side
PlaceOrder_Alice_Num0_Id0_Clob0_Sell6_Price10_GTB21 = *clobtypes.NewMsgPlaceOrder(MustScaleOrder(
clobtypes.Order{
OrderId: clobtypes.OrderId{SubaccountId: constants.Alice_Num0, ClientId: 0, ClobPairId: 0},
Side: clobtypes.Order_SIDE_SELL,
Quantums: 6,
Subticks: 10,
GoodTilOneof: &clobtypes.Order_GoodTilBlock{GoodTilBlock: 21},
},
testapp.DefaultGenesis(),
))
PlaceOrder_Alice_Num0_Id0_Clob1_Buy5_Price10_GTB20 = *clobtypes.NewMsgPlaceOrder(MustScaleOrder(
clobtypes.Order{
OrderId: clobtypes.OrderId{SubaccountId: constants.Alice_Num0, ClientId: 0, ClobPairId: 1},
Expand Down
Loading

0 comments on commit 71529ce

Please sign in to comment.