Skip to content

Commit

Permalink
[Exchanges] add EXCHANGE_ORDER_UNCANCELLABLE_ERRORS
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeDSM committed Jan 8, 2025
1 parent 072621a commit 8cabc9f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Trading/Exchange/binance/binance_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ class Binance(exchanges.RestExchange):
# binance {"code":-2021,"msg":"Order would immediately trigger."}
("order would immediately trigger", )
]
# text content of errors due to an order that can't be cancelled on exchange (because filled or already cancelled)
EXCHANGE_ORDER_UNCANCELLABLE_ERRORS: typing.List[typing.Iterable[str]] = [
('Unknown order sent', )
]

BUY_STR = "BUY"
SELL_STR = "SELL"
Expand Down
7 changes: 7 additions & 0 deletions Trading/Exchange/bingx/bingx_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,19 @@ class Bingx(exchanges.RestExchange):
# bingx {"code":100404,"msg":"the order you want to cancel is FILLED or CANCELLED already, or is not a valid
# order id ,please verify","debugMsg":""}
("the order you want to cancel is filled or cancelled already", ),
# bingx {"code":100404,"msg":"the order is FILLED or CANCELLED already before, or is not a valid
# order id ,please verify","debugMsg":""}
("the order is filled or cancelled already before", ),
]
# text content of errors due to unhandled authentication issues
EXCHANGE_AUTHENTICATION_ERRORS: typing.List[typing.Iterable[str]] = [
# 'bingx {'code': '100413', 'msg': 'Incorrect apiKey', 'timestamp': '1725195218082'}'
("incorrect apikey",),
]
# text content of errors due to an order that can't be cancelled on exchange (because filled or already cancelled)
EXCHANGE_ORDER_UNCANCELLABLE_ERRORS: typing.List[typing.Iterable[str]] = [
('the order is filled or cancelled', )
]

# Set True when get_open_order() can return outdated orders (cancelled or not yet created)
CAN_HAVE_DELAYED_CANCELLED_ORDERS = True
Expand Down
4 changes: 4 additions & 0 deletions Trading/Exchange/coinbase/coinbase_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ class Coinbase(exchanges.RestExchange):
EXCHANGE_MISSING_FUNDS_ERRORS: typing.List[typing.Iterable[str]] = [
("insufficient balance in source account", )
]
# text content of errors due to an order that can't be cancelled on exchange (because filled or already cancelled)
EXCHANGE_ORDER_UNCANCELLABLE_ERRORS: typing.List[typing.Iterable[str]] = [
('cancelorders() has failed, check your arguments and parameters', )
]

# should be overridden locally to match exchange support
SUPPORTED_ELEMENTS = {
Expand Down
5 changes: 5 additions & 0 deletions Trading/Exchange/kucoin/kucoin_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ class Kucoin(exchanges.RestExchange):
EXCHANGE_ORDER_IMMEDIATELY_TRIGGER_ERRORS: typing.List[typing.Iterable[str]] = [
# doesn't seem to happen on kucoin
]
# text content of errors due to an order that can't be cancelled on exchange (because filled or already cancelled)
EXCHANGE_ORDER_UNCANCELLABLE_ERRORS: typing.List[typing.Iterable[str]] = [
('order cannot be canceled', ),
('order_not_exist_or_not_allow_to_cancel', )
]

DEFAULT_BALANCE_CURRENCIES_TO_FETCH = ["USDT"]

Expand Down

0 comments on commit 8cabc9f

Please sign in to comment.