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

[CCXT] fix pending cancel error #1134

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion octobot_trading/exchanges/connectors/ccxt/ccxt_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,10 @@ async def cancel_order(
)
if cancelled_order is None or personal_data.parse_is_cancelled(cancelled_order):
return enums.OrderStatus.CANCELED
elif personal_data.parse_is_open(cancelled_order):
elif (
personal_data.parse_is_open(cancelled_order)
or personal_data.parse_is_pending_cancel(cancelled_order)
):
return enums.OrderStatus.PENDING_CANCEL
# cancel command worked but order is still existing and is not open or canceled. unhandled case
# log error and consider it canceling. order states will manage the
Expand Down
2 changes: 2 additions & 0 deletions octobot_trading/personal_data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
parse_raw_fees,
parse_order_status,
parse_is_cancelled,
parse_is_pending_cancel,
parse_is_open,
get_pnl_transaction_source_from_order,
is_stop_order,
Expand Down Expand Up @@ -253,6 +254,7 @@
"parse_raw_fees",
"parse_order_status",
"parse_is_cancelled",
"parse_is_pending_cancel",
"parse_is_open",
"get_pnl_transaction_source_from_order",
"is_stop_order",
Expand Down
2 changes: 2 additions & 0 deletions octobot_trading/personal_data/orders/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
parse_raw_fees,
parse_order_status,
parse_is_cancelled,
parse_is_pending_cancel,
parse_is_open,
get_up_to_date_price,
get_pre_order_data,
Expand Down Expand Up @@ -160,6 +161,7 @@
"parse_raw_fees",
"parse_order_status",
"parse_is_cancelled",
"parse_is_pending_cancel",
"parse_is_open",
"get_up_to_date_price",
"get_pre_order_data",
Expand Down
4 changes: 4 additions & 0 deletions octobot_trading/personal_data/orders/order_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,10 @@ def parse_is_cancelled(raw_order):
return parse_order_status(raw_order) in {enums.OrderStatus.CANCELED, enums.OrderStatus.CLOSED}


def parse_is_pending_cancel(raw_order):
return parse_order_status(raw_order) is enums.OrderStatus.PENDING_CANCEL


def parse_is_open(raw_order):
return parse_order_status(raw_order) is enums.OrderStatus.OPEN

Expand Down