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

Function that cancels all open orders #99

Open
rhettre opened this issue Nov 9, 2024 · 1 comment
Open

Function that cancels all open orders #99

rhettre opened this issue Nov 9, 2024 · 1 comment

Comments

@rhettre
Copy link
Owner

rhettre commented Nov 9, 2024

No description provided.

@agentz83
Copy link

agentz83 commented Nov 10, 2024

`

Clear all old orders

    orders = coinbase_client.list_orders()
    order_ids = [(x['order_id']) for x in orders['orders'] if x['status'] == "OPEN" and x['product_id'] == product_id]
    action = coinbase_client.cancel_orders(order_ids)

`
I placed this right before the Execute strategy code in the lambda_function in AWS. Confirmed it works.
There is a created time so it could be timed to cancel only old orders after a set number of days.
Another helpful filter would be limiting BUY or SELL side orders, default to both.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants