binance

Asyncio with 2 websockets

Asyncio with 2 websockets Question: I trying to maintain 2 websockets connection open at the same time and have them send their response to a third async function, but I can’t seem to get it to work. async def checking(): while True: print(‘Im here.’) await asyncio.sleep(3) async def public_handler(response): if type(response) == list: print(response[1]) await …

Total answers: 2

How to use a percentage of your account balance per trade? Binance-python

How to use a percentage of your account balance per trade? Binance-python Question: As far as I am aware the only way to create a new futures order is with client.futures_create_order(). The issue is this requires you to give it the exact amount of contracts you would like to buy. I am using BUSD to …

Total answers: 1

How to turn multiple rows of dictionaries from a file into a dataframe

How to turn multiple rows of dictionaries from a file into a dataframe Question: I have a script that I use to fire orders from a csv file, to an exchange using a for loop. data = pd.read_csv(‘orderparameters.csv’) df = pd.DataFrame(data) for i in range(len(df)): order = Client.new_order(… …) file = open(‘orderData.txt’, ‘a’) original_stdout = …

Total answers: 2

Binance Websocket API stuck on OPEN MESSAGE

Binance Websocket API stuck on OPEN MESSAGE Question: I have this… import websocket SOCKET = "wss://stream.binance.com:9443/ws/ADABUSB@nav_kline_1m" def on_open(ws): print(‘opened connection’) def on_close(ws): print(‘close connection’) def on_message(ws, message): print(‘received message’) print(message) ws = websocket.WebSocketApp(SOCKET, on_open = on_open, on_close = on_close, on_message = on_message) ws.run_forever() When I run it it sticks on OPENED CONNECTION and then does …

Total answers: 3

Two websockets with BinanceSocketManager

Two websockets with BinanceSocketManager Question: I’m trying to open two web sockets – depth book and user socket. Here’s my code: async def sockets(client): bm = BinanceSocketManager(client) ds = bm.depth_socket("BTCUSDT", depth=BinanceSocketManager.WEBSOCKET_DEPTH_5) print("Started…") async with ds as depth_socket: while True: res = await depth_socket.recv() print(res) await client.close_connection() I need bm.user_socket() socket to be opened as well …

Total answers: 2

Retrieve all Trade History from Binance API

Retrieve all Trade History from Binance API Question: I am trying to retrieve all Trade History data from Binance using the API. I understand that Binance only allows you to get the data by specifying the ticker, which is unfortunate, but assuming I have all the tickers in a list, and want to download them …

Total answers: 2

Find tickSize Binance

Find tickSize Binance Question: I’m trying to find tickSize using this method but it returns an error. Data: {‘symbol’: ‘FIROUSDT’, ‘status’: ‘TRADING’, ‘baseAsset’: ‘FIRO’, ‘baseAssetPrecision’: 8, ‘quoteAsset’: ‘USDT’, ‘quotePrecision’: 8, ‘quoteAssetPrecision’: 8, ‘baseCommissionPrecision’: 8, ‘quoteCommissionPrecision’: 8, ‘orderTypes’: [‘LIMIT’, ‘LIMIT_MAKER’, ‘MARKET’, ‘STOP_LOSS_LIMIT’, ‘TAKE_PROFIT_LIMIT’], ‘icebergAllowed’: True, ‘ocoAllowed’: True, ‘quoteOrderQtyMarketAllowed’: True, ‘allowTrailingStop’: False, ‘isSpotTradingAllowed’: True, ‘isMarginTradingAllowed’: False, ‘filters’: …

Total answers: 2

Python Binance API Function Data Pull

Python Binance API Function Data Pull Question: I am trying to write a function that will pull ticker information from Binance and put into a nice chart. I am using pandas and keep getting this error: pandas.core.indexing.IndexingError: Too many indexers Below is a portion of the code: def getminutedata(symbol, interval, lookback): frame = pd.DataFrame(client.get_historical_klines(symbol,interval, lookback …

Total answers: 2

How to get the price of a crypto at a given time in the past?

How to get the price of a crypto at a given time in the past? Question: Is there any way I can use ccxt to extract the price of a crypto currency at a given time in the past? Example: get price of BTC on binance at time 2018-01-24 11:20:01 Asked By: Razvan || Source …

Total answers: 2

Binance Websocket client stops after a while

Binance Websocket client stops after a while Question: I am working on Binance Websocket to listen to account events MARKET events. I copy every order from masters to salve it works just fine when I run it and it copies from all master. However, when I run it in background using nohup Linux service it …

Total answers: 3