Closed zweix123 closed 1 year ago
Please merge it. Actual API is broken with error: binance.exceptions.BinanceAPIException: APIError(code=-5000): GET /fapi/v1/account is retired, please use GET /fapi/v2/account
@sammchardy
Hello, I have an error on get_loop which doesn't exist in helpers.py and indeed it doesn't exist when I go to the file.
Connected to pydev debugger (build 231.9225.15) Traceback (most recent call last): File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/home/user/virtualenv/workspace/Env python/project/lib/python3.8/site-packages/binance/__init__.py", line 9, in <module> from binance.client import Client, AsyncClient # noqa File "/home/user/virtualenv/workspace/Env python/project/lib/python3.8/site-packages/binance/client.py", line 17, in <module> from .helpers import interval_to_milliseconds, convert_ts_str, get_loop ImportError: cannot import name 'get_loop' from 'binance.helpers' (/home/user/virtualenv/workspace/Env python/projetc/lib/python3.8/site-packages/binance/helpers.py) Process finished with exit code 1
Works if I apply the changes directly to 1.0.17 (master), as I don't have a get_loop import: Here are the declarations I have in client.py
from base64 import b64encode from pathlib import Path from typing import Dict, Optional, List, Tuple, Union import aiohttp import asyncio import hashlib import hmac import requests import time from Crypto.PublicKey import RSA from Crypto.Hash import SHA256 from Crypto.Signature import pkcs1_15 from operator import itemgetter from urllib.parse import urlencode from .helpers import interval_to_milliseconds, convert_ts_str from .exceptions import BinanceAPIException, BinanceRequestException, NotImplementedException from .enums import HistoricalKlinesType
The code for python-binance
is different on Github and Pypi now. get_loop
related code on Github, so my PR also includes it.
I guess you may have only copied the code from the client. py
file. If you want to use my modifications, you can replace the entire library.
Hi, there, I'm not familiar with this, thanks for the clarification. I need this package and pypi only offers version 1.0.17 with error for this binance api change. As a result, I'm going to turn to the github code and once installed and validated on my workstation, I won't hesitate to notify whether the code is valid or not. Thanks
Seems ok, but the same must be done for async functions.
Thank you for your reminder. I have made the modifications. Could you please conduct another code review?
Thanks @zweix123
I have two more questions now (please forgive my lack of engineering experience)
If you're experiencing issues and can't wait for the module to update on PyPi, you can use the following commands:
Uninstall the current version of python-binance
pip uninstall python-binance
Install the latest version from the master branch of the GitHub repository
pip install git+https://github.com/sammchardy/python-binance.git@master
as fix is merged in master.
I have encountered the following api error:
BinanceAPIException: APIError(code=-5000): GET /fapi/v1/account is retired, please use GET /fapi/v2/account
The endpoints for account, balance, and PositionRisk have been changed by Binance. So I change my attribute as follows and it fixed the problems:
acc_balance = client.futures_account_balance(version=2) for check_balance in acc_balance: if check_balance["asset"] == asset: asset_balance = float(check_balance["balance"]) acc_balance variable returns the usdt balance in my account. I hope this helps
solves #1341
add version default arg of
_create_futures_api_uti
add version default arg of_create_futures_api_uti
use the arg in
futures_account_balance
futures_account
futures_position_information