diff --git a/additional_tests/exchanges_tests/abstract_authenticated_exchange_tester.py b/additional_tests/exchanges_tests/abstract_authenticated_exchange_tester.py index b25d696ac..8c8576edf 100644 --- a/additional_tests/exchanges_tests/abstract_authenticated_exchange_tester.py +++ b/additional_tests/exchanges_tests/abstract_authenticated_exchange_tester.py @@ -63,6 +63,8 @@ class AbstractAuthenticatedExchangeTester: bool, # trigger above (on higher price than order price) ) ] = {} # stop loss / take profit and other special order types to be successfully parsed + # details of an order that exists but can"t be cancelled + UNCANCELLABLE_ORDER_ID_SYMBOL_TYPE: tuple[str, str, trading_enums.TraderOrderType] = None ORDER_SIZE = 10 # % of portfolio to include in test orders PORTFOLIO_TYPE_FOR_SIZE = trading_constants.CONFIG_PORTFOLIO_FREE CONVERTS_ORDER_SIZE_BEFORE_PUSHING_TO_EXCHANGES = False @@ -384,6 +386,7 @@ async def inner_test_get_special_orders(self): async def test_create_and_cancel_limit_orders(self): async with self.local_exchange_manager(): + await self.inner_test_cancel_uncancellable_order() await self.inner_test_create_and_cancel_limit_orders() async def inner_test_create_and_cancel_limit_orders(self, symbol=None, settlement_currency=None, margin_type=None): @@ -451,6 +454,12 @@ async def inner_test_create_and_cancel_limit_orders(self, symbol=None, settlemen assert await self.order_not_in_open_orders(open_orders, buy_limit, symbol=symbol) assert await self.order_in_cancelled_orders(cancelled_orders, buy_limit, symbol=symbol) + async def inner_test_cancel_uncancellable_order(self): + if self.UNCANCELLABLE_ORDER_ID_SYMBOL_TYPE: + order_id, symbol, order_type = self.UNCANCELLABLE_ORDER_ID_SYMBOL_TYPE + with pytest.raises(trading_errors.ExchangeOrderCancelError): + await self.exchange_manager.exchange.cancel_order(order_id, symbol, order_type) + async def test_create_and_fill_market_orders(self): async with self.local_exchange_manager(): await self.inner_test_create_and_fill_market_orders() diff --git a/additional_tests/exchanges_tests/test_binance.py b/additional_tests/exchanges_tests/test_binance.py index 401aa36fb..afef1004d 100644 --- a/additional_tests/exchanges_tests/test_binance.py +++ b/additional_tests/exchanges_tests/test_binance.py @@ -69,6 +69,10 @@ class TestBinanceAuthenticatedExchange( octobot_trading.enums.TradeOrderType.STOP_LOSS.value, octobot_trading.enums.TradeOrderSide.SELL.value, False ), } # stop loss / take profit and other special order types to be successfully parsed + # details of an order that exists but can"t be cancelled + UNCANCELLABLE_ORDER_ID_SYMBOL_TYPE: tuple[str, str, octobot_trading.enums.TraderOrderType] = ( + "6799798838", "BNB/USDT", octobot_trading.enums.TraderOrderType.BUY_LIMIT.value + ) async def test_get_portfolio(self): diff --git a/additional_tests/exchanges_tests/test_binance_futures.py b/additional_tests/exchanges_tests/test_binance_futures.py index a0a0acfac..c7a2580c6 100644 --- a/additional_tests/exchanges_tests/test_binance_futures.py +++ b/additional_tests/exchanges_tests/test_binance_futures.py @@ -66,6 +66,10 @@ class TestBinanceFuturesAuthenticatedExchange( octobot_trading.enums.TradeOrderType.STOP_LOSS.value, octobot_trading.enums.TradeOrderSide.SELL.value, False ), } # stop loss / take profit and other special order types to be successfully parsed + # details of an order that exists but can"t be cancelled + UNCANCELLABLE_ORDER_ID_SYMBOL_TYPE: tuple[str, str, octobot_trading.enums.TraderOrderType] = ( + "4076521927", "BTC/USDT:USDT", octobot_trading.enums.TraderOrderType.BUY_LIMIT.value + ) async def _set_account_types(self, account_types): # todo remove this and use both types when exchange-side multi portfolio is enabled diff --git a/additional_tests/exchanges_tests/test_bingx.py b/additional_tests/exchanges_tests/test_bingx.py index 83e7265d4..e40a9b160 100644 --- a/additional_tests/exchanges_tests/test_bingx.py +++ b/additional_tests/exchanges_tests/test_bingx.py @@ -66,6 +66,10 @@ class TestBingxAuthenticatedExchange( octobot_trading.enums.TradeOrderType.UNSUPPORTED.value, octobot_trading.enums.TradeOrderSide.SELL.value, None ), } # stop loss / take profit and other special order types to be successfully parsed + # details of an order that exists but can"t be cancelled + UNCANCELLABLE_ORDER_ID_SYMBOL_TYPE: tuple[str, str, octobot_trading.enums.TraderOrderType] = ( + "1877004292053696512", "TAO/USDT", octobot_trading.enums.TraderOrderType.SELL_LIMIT.value + ) async def test_get_portfolio(self): await super().test_get_portfolio() diff --git a/additional_tests/exchanges_tests/test_coinbase.py b/additional_tests/exchanges_tests/test_coinbase.py index 8f220f69b..6176f14f8 100644 --- a/additional_tests/exchanges_tests/test_coinbase.py +++ b/additional_tests/exchanges_tests/test_coinbase.py @@ -61,6 +61,10 @@ class TestCoinbaseAuthenticatedExchange( octobot_trading.enums.TradeOrderType.LIMIT.value, octobot_trading.enums.TradeOrderSide.BUY.value, False ), } # stop loss / take profit and other special order types to be successfully parsed + # details of an order that exists but can"t be cancelled + UNCANCELLABLE_ORDER_ID_SYMBOL_TYPE: tuple[str, str, octobot_trading.enums.TraderOrderType] = ( + "f4016e50-1f0b-4caa-abe5-1ec00af18be9", "ETH/BTC", octobot_trading.enums.TraderOrderType.BUY_LIMIT.value + ) async def test_get_portfolio(self): await super().test_get_portfolio() diff --git a/additional_tests/exchanges_tests/test_kucoin.py b/additional_tests/exchanges_tests/test_kucoin.py index 1851bfb7a..a42eb3f55 100644 --- a/additional_tests/exchanges_tests/test_kucoin.py +++ b/additional_tests/exchanges_tests/test_kucoin.py @@ -64,6 +64,10 @@ class TestKucoinAuthenticatedExchange( octobot_trading.enums.TradeOrderType.STOP_LOSS.value, octobot_trading.enums.TradeOrderSide.BUY.value, True ), } # stop loss / take profit and other special order types to be successfully parsed + # details of an order that exists but can"t be cancelled + UNCANCELLABLE_ORDER_ID_SYMBOL_TYPE: tuple[str, str, octobot_trading.enums.TraderOrderType] = ( + "vs93gpruc69s00cs003tat0g", "BTC/USDT", octobot_trading.enums.TraderOrderType.BUY_LIMIT.value + ) async def test_get_portfolio(self): await super().test_get_portfolio() diff --git a/additional_tests/exchanges_tests/test_kucoin_futures.py b/additional_tests/exchanges_tests/test_kucoin_futures.py index c1b7a2758..d6a9f5a65 100644 --- a/additional_tests/exchanges_tests/test_kucoin_futures.py +++ b/additional_tests/exchanges_tests/test_kucoin_futures.py @@ -68,6 +68,10 @@ class TestKucoinFuturesAuthenticatedExchange( octobot_trading.enums.TradeOrderType.STOP_LOSS.value, octobot_trading.enums.TradeOrderSide.SELL.value, False ), } # stop loss / take profit and other special order types to be successfully parsed + # details of an order that exists but can"t be cancelled + UNCANCELLABLE_ORDER_ID_SYMBOL_TYPE: tuple[str, str, octobot_trading.enums.TraderOrderType] = ( + "266424798085668865", "ETH/USDT:USDT", octobot_trading.enums.TraderOrderType.BUY_LIMIT.value + ) async def test_get_portfolio(self): await super().test_get_portfolio()