Skip to content

Commit

Permalink
pr comments + bump pyproj
Browse files Browse the repository at this point in the history
  • Loading branch information
jonfung-dydx authored and lucas-dydx committed Sep 29, 2023
1 parent 7dd67f8 commit 742698f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
13 changes: 10 additions & 3 deletions v4-client-py/examples/composite_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,16 @@ async def main() -> None:
time_in_force_string = orderParams.get("timeInForce", "GTT")
time_in_force = OrderTimeInForce[time_in_force_string]
price = orderParams.get("price", 1350)
time_in_force_seconds = 60 if time_in_force == OrderTimeInForce.GTT else 0
latest_block = client.validator_client.get.latest_block()
good_til_block = latest_block.block.header.height + 10

if time_in_force == OrderTimeInForce.GTT:
time_in_force_seconds = 60
good_til_block = 0
else:
latest_block = client.validator_client.get.latest_block()
next_valid_block = latest_block.block.header.height + 1
good_til_block = next_valid_block + 10
time_in_force_seconds = 0

post_only = orderParams.get("postOnly", False)
try:
tx = client.place_order(
Expand Down
2 changes: 1 addition & 1 deletion v4-client-py/examples/short_term_cancel_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ async def main() -> None:
'ETH-USD',
ORDER_FLAGS_SHORT_TERM,
good_til_time_in_seconds=0, # short term orders use GTB.
good_til_block=good_til_block+10,
good_til_block=good_til_block, # GTB should be the same or greater than order to cancel
)
print('**Cancel Short Term Order Tx**')
print(tx.tx_hash)
Expand Down
2 changes: 1 addition & 1 deletion v4-client-py/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package-dir = {"" = "v4_client_py"}

[tool.poetry]
name = "v4-client-py"
version = "0.6.7"
version = "0.6.8"
description = "dYdX v4 Client"
authors = ["John Huang <contact@dydx.exchange>"]
license = "BSL-1.1"
Expand Down

0 comments on commit 742698f

Please sign in to comment.