Skip to content

Commit 114c559

Browse files
feat: add post-only orders (#90)
* feat: add post-only orders in the composer * chore: re-gen * chore: update examples with post-only orders * chore: update changelogs * fix: remove post-only flag from market order
1 parent 886ba0f commit 114c559

21 files changed

+587
-159
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ python pyinjective/fetch_metadata.py
8080
### Changelogs
8181
**0.5.6.5**
8282
* Add MsgRelayPriceFeedPrice in the composer
83+
* Add Post-only orders in the composer
8384

8485
**0.5.6.4**
8586
* Add K8S endpoint on testnet as default

examples/async/chain_client/11_MsgBatchCreateSpotLimitOrders.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,17 @@ async def main() -> None:
4848
fee_recipient=fee_recipient,
4949
price=7.523,
5050
quantity=0.01,
51-
is_buy=True
51+
is_buy=True,
52+
is_po=True
5253
),
5354
composer.SpotOrder(
5455
market_id=market_id,
5556
subaccount_id=subaccount_id,
5657
fee_recipient=fee_recipient,
5758
price=27.92,
5859
quantity=0.01,
59-
is_buy=False
60+
is_buy=False,
61+
is_po=False
6062
),
6163
]
6264

examples/async/chain_client/12_MsgBatchCreateDerivativeLimitOrders.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ async def main() -> None:
4848
fee_recipient=fee_recipient,
4949
price=41027,
5050
quantity=0.01,
51-
is_buy=True,
5251
leverage=0.7,
52+
is_buy=True,
53+
is_po=True
54+
5355
),
5456
composer.DerivativeOrder(
5557
market_id=market_id,

examples/async/chain_client/17_MsgBatchUpdateOrders.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ async def main() -> None:
8585
price=3,
8686
quantity=55,
8787
leverage=1,
88-
is_buy=True
88+
is_buy=True,
89+
is_po=True
8990
),
9091
composer.DerivativeOrder(
9192
market_id=derivative_market_id_create,
@@ -95,6 +96,7 @@ async def main() -> None:
9596
quantity=55,
9697
leverage=1,
9798
is_buy=False,
99+
is_po=False
98100
),
99101
]
100102

@@ -105,15 +107,17 @@ async def main() -> None:
105107
fee_recipient=fee_recipient,
106108
price=3,
107109
quantity=55,
108-
is_buy=True
110+
is_buy=True,
111+
is_po=True
109112
),
110113
composer.SpotOrder(
111114
market_id=spot_market_id_create,
112115
subaccount_id=subaccount_id,
113116
fee_recipient=fee_recipient,
114117
price=300,
115118
quantity=55,
116-
is_buy=False
119+
is_buy=False,
120+
is_po=False
117121
),
118122
]
119123

examples/async/chain_client/20_MsgExec.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ async def main() -> None:
3636
fee_recipient=grantee,
3737
price=7.523,
3838
quantity=0.01,
39-
is_buy=True
39+
is_buy=True,
40+
is_po=True
4041
)
4142

4243
msg = composer.MsgExec(

examples/async/chain_client/3_MsgCreateSpotLimitOrder.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ async def main() -> None:
3434
fee_recipient=fee_recipient,
3535
price=7.523,
3636
quantity=0.01,
37-
is_buy=True
37+
is_buy=True,
38+
is_po=True
3839
)
3940

4041
# build sim tx

examples/async/chain_client/6_MsgCreateDerivativeLimitOrder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ async def main() -> None:
5050
fee_recipient=fee_recipient,
5151
price=50000,
5252
quantity=0.1,
53-
is_buy=False,
5453
leverage=1,
54+
is_buy=False,
5555
is_reduce_only=False
5656
)
5757

examples/async/chain_client/MultipleMsgs.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,17 @@ async def main() -> None:
5050
fee_recipient=fee_recipient,
5151
price=3.524,
5252
quantity=0.01,
53-
is_buy=True
53+
is_buy=True,
54+
is_po=True
5455
),
5556
composer.SpotOrder(
5657
market_id=spot_market_id,
5758
subaccount_id=subaccount_id,
5859
fee_recipient=fee_recipient,
5960
price=27.92,
6061
quantity=0.01,
61-
is_buy=False
62+
is_buy=False,
63+
is_po=False
6264
),
6365
]
6466

@@ -71,6 +73,7 @@ async def main() -> None:
7173
quantity=0.01,
7274
leverage=0.7,
7375
is_buy=True,
76+
is_po=False
7477
),
7578
composer.DerivativeOrder(
7679
market_id=deriv_market_id,

examples/sync/chain_client/11_MsgBatchCreateSpotLimitOrders.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,17 @@ async def main() -> None:
4848
fee_recipient=fee_recipient,
4949
price=7.523,
5050
quantity=0.01,
51-
is_buy=True
51+
is_buy=True,
52+
is_po=False
5253
),
5354
composer.SpotOrder(
5455
market_id=market_id,
5556
subaccount_id=subaccount_id,
5657
fee_recipient=fee_recipient,
5758
price=27.92,
5859
quantity=0.01,
59-
is_buy=False
60+
is_buy=False,
61+
is_po=False
6062
),
6163
]
6264

examples/sync/chain_client/12_MsgBatchCreateDerivativeLimitOrders.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ async def main() -> None:
4848
fee_recipient=fee_recipient,
4949
price=41027,
5050
quantity=0.01,
51-
is_buy=True,
5251
leverage=0.7,
52+
is_buy=True,
53+
is_po=False
5354
),
5455
composer.DerivativeOrder(
5556
market_id=market_id,

0 commit comments

Comments
 (0)