Skip to content

Commit

Permalink
[PY] Fix minor python client bugs in v0.6.4 (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-dydx authored Sep 20, 2023
1 parent 74cb1af commit caddbc9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
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.3"
version = "0.6.4"
description = "dYdX v4 Client"
authors = ["John Huang <contact@dydx.exchange>"]
license = "BSL-1.1"
Expand Down
14 changes: 8 additions & 6 deletions v4-client-py/v4_client_py/clients/dydx_composite_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ def __init__(
self.indexer_client = IndexerClient(network.indexer_config, api_timeout, send_options)
self.validator_client = ValidatorClient(network.validator_config, credentials)

def get_current_block(self) -> int:
response = self.validator_client.get.latest_block()
return response.block.header.height

def calculate_good_til_block(self) -> int:
response = self.validator_client.get.latest_block()
return response.block.header.height + 3
Expand Down Expand Up @@ -147,9 +151,8 @@ def place_short_term_order(
size: float,
client_id: int,
good_til_block: int,
execution: OrderExecution,
time_in_force: OrderExecution,
reduce_only: bool,
trigger_price: float = None,
) -> SubmittedTx:
'''
Place Short-Term order
Expand All @@ -175,8 +178,8 @@ def place_short_term_order(
:param good_til_block: required
:type good_til_block: int
:param execution: required
:type execution: OrderExecution
:param time_in_force: required
:type time_in_force: OrderExecution
:param reduce_only: required
:type reduce_only: bool
Expand All @@ -192,9 +195,8 @@ def place_short_term_order(
size=size,
client_id=client_id,
good_til_block=good_til_block,
execution=execution,
time_in_force=time_in_force,
reduce_only=reduce_only,
trigger_price=trigger_price,
)
return self.validator_client.post.send_message(subaccount=subaccount, msg=msg, zeroFee=True)

Expand Down

0 comments on commit caddbc9

Please sign in to comment.