@@ -171,6 +171,12 @@ async def inner_test_untradable_symbols(self):
171
171
return
172
172
async with self .local_exchange_manager ():
173
173
all_symbols = self .exchange_manager .exchange .get_all_available_symbols ()
174
+ all_symbols_including_disabled = self .exchange_manager .exchange .get_all_available_symbols (active_only = False )
175
+ disabled = [
176
+ symbol
177
+ for symbol in all_symbols_including_disabled
178
+ if symbol not in all_symbols
179
+ ]
174
180
tradable_symbols = await self .exchange_manager .exchange .get_all_tradable_symbols ()
175
181
assert len (all_symbols ) > len (tradable_symbols )
176
182
untradable_symbols = [
@@ -197,48 +203,52 @@ async def inner_test_untradable_symbols(self):
197
203
]
198
204
# has untradable symbols of this trading type
199
205
assert len (untradable_symbols ) > 0
200
- first_untradable_symbol = untradable_symbols [0 ]
201
- # Public data
202
- # market status is available
203
- assert ccxt_constants .CCXT_INFO in self .exchange_manager .exchange .get_market_status (first_untradable_symbol )
204
- # fetching ohlcv is ok
205
- assert len (
206
- await self .exchange_manager .exchange .get_symbol_prices (
207
- first_untradable_symbol , commons_enums .TimeFrames (self .TIME_FRAME )
206
+ untradable = [untradable_symbols [0 ]]
207
+ if disabled :
208
+ print (f"Including { disabled [0 ]} disabled coin (from { len (disabled )} coins)" )
209
+ untradable .append (disabled [0 ])
210
+ for untradable_symbol in untradable :
211
+ # Public data
212
+ # market status is available
213
+ assert ccxt_constants .CCXT_INFO in self .exchange_manager .exchange .get_market_status (untradable_symbol )
214
+ # fetching ohlcv is ok
215
+ assert len (
216
+ await self .exchange_manager .exchange .get_symbol_prices (
217
+ untradable_symbol , commons_enums .TimeFrames (self .TIME_FRAME )
218
+ )
219
+ ) > 5
220
+ # fetching kline is ok
221
+ kline = await self .exchange_manager .exchange .get_kline_price (
222
+ untradable_symbol , commons_enums .TimeFrames (self .TIME_FRAME )
208
223
)
209
- ) > 5
210
- # fetching kline is ok
211
- kline = await self .exchange_manager .exchange .get_kline_price (
212
- first_untradable_symbol , commons_enums .TimeFrames (self .TIME_FRAME )
213
- )
214
- assert len (kline ) == 1
215
- assert len (kline [0 ]) == 6
216
- # fetching ticker is ok
217
- ticker = await self .exchange_manager .exchange .get_price_ticker (first_untradable_symbol )
218
- assert ticker
219
- price = ticker [trading_enums .ExchangeConstantsTickersColumns .CLOSE .value ]
220
- assert price > 0
221
- # fetching recent trades is ok
222
- recent_trades = await self .exchange_manager .exchange .get_recent_trades (first_untradable_symbol )
223
- assert len (recent_trades ) > 1
224
- # fetching order book is ok
225
- order_book = await self .exchange_manager .exchange .get_order_book (first_untradable_symbol )
226
- assert len (order_book [trading_enums .ExchangeConstantsOrderBookInfoColumns .ASKS .value ]) > 0
227
- # is in all tickers
228
- all_tickers = await self .exchange_manager .exchange .get_all_currencies_price_ticker ()
229
- assert all_tickers [first_untradable_symbol ][trading_enums .ExchangeConstantsTickersColumns .CLOSE .value ] > 0
230
- # Orders
231
- # try creating & cancelling orders on 5 random tradable and untradable symbols
232
- symbols_to_test = 5
233
- tradable_stepper = random .randint (1 , len (tradable_symbols ) - 2 )
234
- tradable_indexes = [tradable_stepper * i for i in range (0 , symbols_to_test )]
235
- untradable_stepper = random .randint (1 , len (untradable_symbols ) - 2 )
236
- untradable_indexes = [untradable_stepper * i for i in range (0 , symbols_to_test )]
237
- to_test_symbols = [
238
- tradable_symbols [i % (len (tradable_symbols ) - 1 )] for i in tradable_indexes
239
- ] + [
240
- untradable_symbols [i % (len (untradable_symbols ) - 1 )] for i in untradable_indexes
241
- ]
224
+ assert len (kline ) == 1
225
+ assert len (kline [0 ]) == 6
226
+ # fetching ticker is ok
227
+ ticker = await self .exchange_manager .exchange .get_price_ticker (untradable_symbol )
228
+ assert ticker
229
+ price = ticker [trading_enums .ExchangeConstantsTickersColumns .CLOSE .value ]
230
+ assert price > 0
231
+ # fetching recent trades is ok
232
+ recent_trades = await self .exchange_manager .exchange .get_recent_trades (untradable_symbol )
233
+ assert len (recent_trades ) > 1
234
+ # fetching order book is ok
235
+ order_book = await self .exchange_manager .exchange .get_order_book (untradable_symbol )
236
+ assert len (order_book [trading_enums .ExchangeConstantsOrderBookInfoColumns .ASKS .value ]) > 0
237
+ # is in all tickers
238
+ all_tickers = await self .exchange_manager .exchange .get_all_currencies_price_ticker ()
239
+ assert all_tickers [untradable_symbol ][trading_enums .ExchangeConstantsTickersColumns .CLOSE .value ] > 0
240
+ # Orders
241
+ # try creating & cancelling orders on 5 random tradable and untradable symbols
242
+ symbols_to_test = 5
243
+ tradable_stepper = random .randint (1 , len (tradable_symbols ) - 2 )
244
+ tradable_indexes = [tradable_stepper * i for i in range (0 , symbols_to_test )]
245
+ untradable_stepper = random .randint (1 , len (untradable_symbols ) - 2 )
246
+ untradable_indexes = [untradable_stepper * i for i in range (0 , symbols_to_test )]
247
+ to_test_symbols = [
248
+ tradable_symbols [i % (len (tradable_symbols ) - 1 )] for i in tradable_indexes
249
+ ] + [
250
+ untradable_symbols [i % (len (untradable_symbols ) - 1 )] for i in untradable_indexes
251
+ ]
242
252
for i , symbol in enumerate (to_test_symbols ):
243
253
ticker = await self .exchange_manager .exchange .get_price_ticker (symbol )
244
254
price = ticker [trading_enums .ExchangeConstantsTickersColumns .CLOSE .value ]
@@ -1496,7 +1506,7 @@ async def order_in_cancelled_orders(self, previous_cancelled_orders, order, symb
1496
1506
async def cancel_order (self , order ):
1497
1507
cancelled_order = order
1498
1508
if not await self .exchange_manager .trader .cancel_order (order , wait_for_cancelling = False ):
1499
- raise AssertionError ("cancel_order returned False" )
1509
+ raise AssertionError (f "cancel_order returned False ( { order . symbol } ) " )
1500
1510
if order .status is trading_enums .OrderStatus .PENDING_CANCEL :
1501
1511
cancelled_order = await self .wait_for_cancel (order )
1502
1512
assert cancelled_order .status is trading_enums .OrderStatus .CANCELED
0 commit comments