Questions tagged [python-binance]

29 questions
2
votes
0 answers

Binance API. How to switch between spot and futures for multiplex socket using python-binance

I want to use multiplex socket for Binance future klines using python-binance. import asyncio from binance import AsyncClient, BinanceSocketManager api_key_real = '____________your api key________' secret_key_real = '____________your secret…
2
votes
0 answers

How do i fix this: Invalid JSON error message from Binance

I have been running a python script on an Amazon EC2 instance. It runs fine for a while and then I get this error: Invalid JSON error message from Binance:
1
vote
2 answers

Websocket does not receive response when opened from a thread

When I open the websocket connection from a thread without even retrieving the latest_price_info from the websocket the websocket does not receive any messages, it only receives a first message and does not receive anything else. The following is…
202286ege
  • 21
  • 5
1
vote
1 answer

Python binance - get futures position information

I would like to retrieve future position histroy from the Binance API, just like it is on the dashboard. I need this data to then later display on a spreadsheet. Thank you. I've tried to play with the…
Jože Strožer
  • 663
  • 1
  • 6
  • 14
0
votes
0 answers

getting candles from binance testnet using python-binance

I have problem with python-binance library. I want to get candles from testnet but the recieved candles are same with original binance. this is my code : from binance.client import Client def get_candles(api_key, api_secret, symbol, time_frame,…
0
votes
0 answers

Need help in python code for Binance future order

I want to create a function in python that can place the future order with target and stop loss. Once the target or stop loss hit, It should close the order. I have tried to create a function but it did not work def…
0
votes
1 answer

So I wanted to install something using pip install … but I get this error message, how can I fix it?

Building wheels for collected packages: ujson Building wheel for ujson (pyproject.toml) ... error error: subprocess-exited-with-error × Building wheel for ujson (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [128 lines of…
0
votes
1 answer

Binance Futures Python API - Placing limit order with TP/SL

How can I place TP/SL at the time of placing a limit order. The code below only places the limit order and not TP/SL. from binance.client import Client # Replace these with your Binance API Key and Secret Key api_key = BINANCE_API_KEY api_secret =…
0
votes
0 answers

multiple simultaneous websockets connections to one binance data stream

I have read the documentation, but did find an answer, in Websocket and binance api. Is it possible to set up several distinct connections to one concrete data stream of ticker? I have read about rel, but I am not quite confident it is the thing I…
0
votes
1 answer

binance.exception.BinanceAPIException: APIError(code=-2015): Invalid API-key, IP, or permission for action

I am trying to connect to my Binance account using Python and a Raspberry Pi. I keep having this issue My code is realy simple from binance import Client apiKey = '' apiSecret = '' client = Client.(apiKey, apiSecret) client.get_account() The…
0
votes
0 answers

Coroutine within a Thread gives RunTime Error for Websocket Connection

I have the following code snippet: import threading import asyncio from binance import AsyncClient, BinanceSocketManager class TestThread(threading.Thread): def __init__(self): threading.Thread.__init__(self) def run(self): …
0
votes
1 answer

get_exchange_info() from Binance API

I am new to Python (I mean really new > 7 weeks in on my free time) , bear with me... I am trying to get exchange info from Binance for a project. I am using the python-binance package.I get the exchange info with: exch_info =…
Mat
  • 65
  • 6
0
votes
1 answer

Python binance websocket stream code for getting user data and coin price

I am trying to get binance futures data from a websocket stream. I've gone through all the binance documentation tried several different python approaches, but don't seem to be successfull. I am running my code on python-anywhere servers. I would…
0
votes
0 answers

Binance-python API: client.get_symbol_info('BTCUSDT') returns None (not found)

I have developed an algorithm that needs to check wheter a specific coin exists or not for doing several calculations. The algorithm has been working correctly for weeks, but for the first time it checks several times if the coin "BTCUSDT" exists or…
0
votes
0 answers

inside the loop i want to input (order is placed) check float(btc_price["price"])>short_ma to be true before continue the loop How to do this

elif float(btc_price["price"]) >= buy1 * percentsell and buy1 !=0: print("sell1") order = client.order_market_sell(symbol="BTCUSDT", side='SELL', type='MARKET', quoteOrderQty=ordergroote) "I would like to check if…
Donald
  • 1
  • 1
1
2