def binance_create_order(chat_id, **params): full_api = getbinanceapi(chat_id)['binance_api'] api_key = full_api.split(':')[0].strip() api_secret = full_api.split(':')[1].strip() client = Client(api_key, api_secret) binance_timesync(client) try: js_info = client.create_order(**params) return js_info except Exception as e: print(e) return str(e)
def binance_getbalance(chat_id, asset): full_api = getbinanceapi(chat_id)['binance_api'] api_key = full_api.split(':')[0].strip() api_secret = full_api.split(':')[1].strip() client = Client(api_key, api_secret) binance_timesync(client) try: js_info = client.get_asset_balance(asset=asset) print(js_info) return js_info except Exception as e: print(e)
def binance_get_symbol_ticker(chat_id, symbol): full_api = getbinanceapi(chat_id)['binance_api'] api_key = full_api.split(':')[0].strip() api_secret = full_api.split(':')[1].strip() client = Client(api_key, api_secret) binance_timesync(client) try: js_info = client.get_symbol_ticker() for t in js_info: if t['symbol'] == symbol: return t['price'] except Exception as e: print(e) return None
def binance_get_all_tickers(chat_id): full_api = getbinanceapi(chat_id)['binance_api'] api_key = full_api.split(':')[0].strip() api_secret = full_api.split(':')[1].strip() client = Client(api_key, api_secret) binance_timesync(client) js_info = [] try: js_info = client.get_all_tickers() #print(js_info) return js_info except Exception as e: print(e) return js_info
def getbinancehistory(chat_id): full_api = getbinanceapi(chat_id)['binance_api'] api_key = full_api.split(':')[0].strip() api_secret = full_api.split(':')[1].strip() client = Client(api_key, api_secret) binance_timesync(client)