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

[TS] [CLOB-895] v0.38.2: Cancel order examples #44

Merged
merged 8 commits into from
Sep 29, 2023

Conversation

jonfung-dydx
Copy link
Contributor

No description provided.

@jonfung-dydx jonfung-dydx requested a review from johnqh September 24, 2023 12:36
Copy link
Contributor

@lucas-dydx lucas-dydx left a comment

Choose a reason for hiding this comment

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

Suggestion: add typescript client version in PR so it's easy for people to find changes made in this version

v4-client-js/examples/cancel_example.ts Outdated Show resolved Hide resolved
@@ -37,7 +37,7 @@ async function test(): Promise<void> {
side,
price,
0.01,
randomInt(100_000_000),
randomInt(MAX_CLIENT_ID),
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: can we abstract this into a function? Maybe call it getRandomClientId?

Copy link
Contributor

Choose a reason for hiding this comment

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

Gonna ignore this for now.

v4-client-js/examples/short_term_cancel_example.ts Outdated Show resolved Hide resolved
console.log(error.message);
}

await sleep(5000); // wait for placeOrder to complete
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this sleep necessary for Short-Term orders?

console.log(error.message);
}

await sleep(5000); // wait for placeOrder to complete
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you note that for stateful orders, it can only be canceled after it's added to a block (which i'm assuming is why there's a sleep here)

Maybe also add a log statement "waiting for long-term order placement to included in a block"?

Comment on lines 55 to 58
subaccount,
shortTermOrderClientId,
OrderFlags.SHORT_TERM,
'ETH-USD',
Copy link
Contributor

Choose a reason for hiding this comment

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

Metapoint not addressable in this PR: I think the V4 client should expose the concept of an order ID to programmatic traders

It's confusing that if any of these params change the order ID is diff and that's all under the hood

v4-client-js/package.json Outdated Show resolved Hide resolved
v4-client-js/src/clients/composite-client.ts Show resolved Hide resolved
v4-client-js/src/clients/composite-client.ts Outdated Show resolved Hide resolved
v4-client-js/src/lib/validation.ts Show resolved Hide resolved
@lucas-dydx lucas-dydx force-pushed the jonfung/ts_cancel_long_term branch from 8d85635 to a8e785c Compare September 28, 2023 15:26
@lucas-dydx lucas-dydx changed the title [TS] [CLOB-895] Cancel order examples [TS] [CLOB-895] v0.38.2: Cancel order examples Sep 28, 2023
@lucas-dydx lucas-dydx merged commit 6aca7bd into main Sep 29, 2023
1 check passed
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