diff --git a/v4-client-py/examples/cancel_example.py b/v4-client-py/examples/long_term_order_cancel_example.py similarity index 75% rename from v4-client-py/examples/cancel_example.py rename to v4-client-py/examples/long_term_order_cancel_example.py index 3f42dbb1..c2438341 100644 --- a/v4-client-py/examples/cancel_example.py +++ b/v4-client-py/examples/long_term_order_cancel_example.py @@ -28,7 +28,17 @@ async def main() -> None: ) subaccount = Subaccount(wallet, 0) - # place a long term order. + """ + Note this example places a stateful order. + Programmatic traders should generally not use stateful orders for following reasons: + - Stateful orders received out of order by validators will fail sequence number validation + and be dropped. + - Stateful orders have worse time priority since they are only matched after they are included + on the block. + - Stateful order rate limits are more restrictive than Short-Term orders, specifically max 2 per + block / 20 per 100 blocks. + - Stateful orders can only be canceled after they’ve been included in a block. + """ long_term_order_client_id = randrange(0, MAX_CLIENT_ID) try: tx = client.place_order( @@ -70,4 +80,4 @@ async def main() -> None: if __name__ == '__main__': logging.basicConfig(level=logging.INFO) - asyncio.get_event_loop().run_until_complete(main()) \ No newline at end of file + asyncio.get_event_loop().run_until_complete(main()) diff --git a/v4-client-py/examples/short_term_cancel_example.py b/v4-client-py/examples/short_term_order_cancel_example.py similarity index 100% rename from v4-client-py/examples/short_term_cancel_example.py rename to v4-client-py/examples/short_term_order_cancel_example.py diff --git a/v4-client-py/examples/short_term_composite_example.py b/v4-client-py/examples/short_term_order_composite_example.py similarity index 96% rename from v4-client-py/examples/short_term_composite_example.py rename to v4-client-py/examples/short_term_order_composite_example.py index cd3f284c..c375e308 100644 --- a/v4-client-py/examples/short_term_composite_example.py +++ b/v4-client-py/examples/short_term_order_composite_example.py @@ -10,11 +10,7 @@ from v4_client_py.clients.constants import BECH32_PREFIX, Network from v4_client_py.clients.helpers.chain_helpers import ( - Order_TimeInForce, - OrderType, OrderSide, - OrderTimeInForce, - OrderExecution, ) from examples.utils import loadJson, orderExecutionToTimeInForce diff --git a/v4-client-py/v4_client_py/clients/dydx_composite_client.py b/v4-client-py/v4_client_py/clients/dydx_composite_client.py index 2bf2b958..11d71f87 100644 --- a/v4-client-py/v4_client_py/clients/dydx_composite_client.py +++ b/v4-client-py/v4_client_py/clients/dydx_composite_client.py @@ -457,7 +457,7 @@ def cancel_short_term_order( :param clob_pair_id: required :type clob_pair_id: int - :param good_til_block: optional + :param good_til_block: required :type good_til_block: int :returns: Tx information diff --git a/v4-client-py/v4_client_py/clients/modules/post.py b/v4-client-py/v4_client_py/clients/modules/post.py index fff67069..68b93ffc 100644 --- a/v4-client-py/v4_client_py/clients/modules/post.py +++ b/v4-client-py/v4_client_py/clients/modules/post.py @@ -288,4 +288,4 @@ def default_broadcast_mode(self, msg: _message.Message) -> BroadcastMode: return BroadcastMode.BroadcastTxCommit else: return BroadcastMode.BroadcastTxCommit - return BroadcastMode.BroadcastTxSync \ No newline at end of file + return BroadcastMode.BroadcastTxSync