@@ -29,12 +29,14 @@ def is_delisted_symbols(exchange_time, ticker, threshold = 1 * constants.DAYS_TO
2929 ticker_time = ticker ['timestamp' ]
3030 return not (exchange_time - ticker_time <= threshold )
3131
32- def get_last_prices (exchange_time , tickers ):
32+ def get_last_prices (exchange_time , tickers , ignored_symbols ):
3333 return [
3434 ShortTicker (symbol = get_symbol_from_key (key ),
3535 last_price = tickers [key ]['close' ])
3636 for key , _ in tickers .items ()
37- if tickers [key ]['close' ] is not None and not is_delisted_symbols (exchange_time , tickers [key ])
37+ if tickers [key ]['close' ] is not None
38+ and not is_delisted_symbols (exchange_time , tickers [key ])
39+ and str (get_symbol_from_key (key )) not in ignored_symbols
3840 ]
3941
4042def get_best_opportunity (tickers : List [ShortTicker ]) -> Tuple [List [ShortTicker ], float ]:
@@ -101,12 +103,12 @@ async def get_exchange_data(exchange_name):
101103 await exchange .close ()
102104 return tickers , exchange_time
103105
104- async def get_exchange_last_prices (exchange_name ):
106+ async def get_exchange_last_prices (exchange_name , ignored_symbols ):
105107 tickers , exchange_time = await get_exchange_data (exchange_name )
106- last_prices = get_last_prices (exchange_time , tickers )
108+ last_prices = get_last_prices (exchange_time , tickers , ignored_symbols )
107109 return last_prices
108110
109- async def run_detection (exchange_name ):
110- last_prices = await get_exchange_last_prices (exchange_name )
111+ async def run_detection (exchange_name , ignored_symbols = None ):
112+ last_prices = await get_exchange_last_prices (exchange_name , ignored_symbols or [] )
111113 best_opportunity , best_profit = get_best_opportunity (last_prices )
112114 return best_opportunity , best_profit
0 commit comments