def mem_cache_init_pusher(): exchange_info = BINANCE.get_exchange_info() if exchange_info is not None: DATABASE.set(EXCHANGE_INFO, json.dumps(exchange_info)) print('exchange_info', len(exchange_info), exchange_info) tickers = BINANCE.get_ticker() if tickers is not None: DATABASE.set(TICKERS, json.dumps(tickers)) print('tickers', len(tickers), tickers) time.sleep(1)
def push_volume(): try: global t_volume if time.time() - t_volume > VOLUME_UPDATE: tickers = BINANCE.get_ticker() if tickers is not None: DATABASE.set(TICKERS, json.dumps(tickers)) # print('tickers', len(tickers), tickers) t_volume = time.time() time.sleep(0.5) except requests.exceptions.ConnectionError as e: print(type(e)) print(traceback.format_exc())