Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PY] v0.6.2: Update python client code to place Short-Term orders #32

Merged
merged 3 commits into from
Sep 19, 2023

Conversation

lucas-dydx
Copy link
Contributor

No description provided.

@lucas-dydx lucas-dydx changed the title Add Short-Term order example Update example python client code to place Short-Term orders Sep 19, 2023
@lucas-dydx lucas-dydx marked this pull request as ready for review September 19, 2023 14:20
@@ -20,15 +20,17 @@ class OrderTimeInForce(Flag):
FOK = auto() # Fill or Kill

class OrderExecution(Flag):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should just be removed since it's confusing people, detailed reasons in this ticket here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented in your ticket

def calculate_good_til_block_time(self, good_til_time_in_seconds: int) -> int:
now = datetime.now()
interval = timedelta(seconds=good_til_time_in_seconds)
future = now + interval
return int(future.timestamp())

def validate_good_til_block(self, good_til_block: int) -> None:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally this code is updated such that it doesn't need to fetch the current block on each order placement. I just hacked this together to get it working for now.

@lucas-dydx lucas-dydx changed the title Update example python client code to place Short-Term orders v0.6.2: Update python client code to place Short-Term orders Sep 19, 2023
@lucas-dydx lucas-dydx changed the title v0.6.2: Update python client code to place Short-Term orders [PY] v0.6.2: Update python client code to place Short-Term orders Sep 19, 2023
Copy link
Contributor

@johnqh johnqh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update TS to mirror Python code? Also we will need to update the documentations (which always show both TS and Python) after this is released.

try:
tx = client.place_order(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have a different function to test place_short_term_order? place_order still need to be tested.

Copy link
Contributor Author

@lucas-dydx lucas-dydx Sep 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jonfung-dydx will add this testing in a future PR. I don't think this is important for place_order since it shouldn't be used by anyone (since frontend uses typescript client), but we will keep this in mind for the Typescript client.

v4-client-py/examples/composite_example.py Show resolved Hide resolved
@@ -20,15 +20,17 @@ class OrderTimeInForce(Flag):
FOK = auto() # Fill or Kill

class OrderExecution(Flag):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented in your ticket

v4-client-py/v4_client_py/clients/helpers/chain_helpers.py Outdated Show resolved Hide resolved
@lucas-dydx
Copy link
Contributor Author

Can you update TS to mirror Python code? Also we will need to update the documentations (which always show both TS and Python) after this is released.

Synced in person, to accelerate timelines we are going to do this in a separate PR.

@johnqh johnqh self-requested a review September 19, 2023 20:06
@lucas-dydx lucas-dydx merged commit 555564d into main Sep 19, 2023
1 check passed
@lucas-dydx lucas-dydx deleted the lucas-dydx/add-short-term-order-method branch September 19, 2023 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants