async def settings_prefs_bases(self, param): rtn = Redisdb.get("settings_prefs_bases") if rtn is None: settings = [] else: settings = json.loads(rtn.decode('utf8')) # most used tokens list stats = market_data.Stats() tlist = stats.stats_by_token[['asset_name']]['asset_name'][:20] tlist = tlist.tolist() if 'orderbyops' in param: settings = tlist else: for t in tlist: if t not in settings: settings.append(t) Redisdb.rpush( "datafeed", json.dumps({ 'module': Active_module, 'settings_prefs_bases': settings })) Redisdb.rpush( 'operations', json.dumps({ 'call': 'data_store_save', 'module': 'general' }))
async def get_tradestats_account(self, data): stats = market_data.Stats() Redisdb.rpush( "datafeed", json.dumps({ 'module': data['module'], 'stats_account': stats.stats_by_account[['account_id', 'pair']][:100].to_json(orient='values') }))
async def get_tradestats_token(self, data): stats = market_data.Stats() Redisdb.rpush( "datafeed", json.dumps({ 'module': data['module'], 'stats_token': stats.stats_by_token[[ 'asset_name', 'ops', 'volume', 'ops_day', 'volume_day' ]][:100].to_json(orient='values') }))
async def get_tradestats_pair(self, data): stats = market_data.Stats() Redisdb.rpush( "datafeed", json.dumps({ 'module': data['module'], 'stats_pair': stats.stats_by_pair[[ 'pair_text', 'pair', 'pays_amount', 'receives_amount', 'price' ]][:300].to_json(orient='values') }))