Code Monkey home page Code Monkey logo

lucit-systems-and-development / unicorn-binance-rest-api Goto Github PK

View Code? Open in Web Editor NEW
60.0 6.0 16.0 11.03 MB

A Python SDK by LUCIT to use the Binance REST API`s (com+testnet, com-margin+testnet, com-isolated_margin+testnet, com-futures+testnet, us, tr) in a simple, fast, flexible, robust and fully-featured way.

Home Page: https://unicorn-binance-rest-api.docs.lucit.tech

License: Other

Python 95.72% Makefile 0.17% Shell 3.89% Batchfile 0.22%
python binance binance-api binance-exchange rest rest-api binance-futures unicorn-binance-suite

unicorn-binance-rest-api's People

Contributors

flo-rian avatar hawkeye-bot avatar kylematoba avatar oliver-zehentleitner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

unicorn-binance-rest-api's Issues

client.futures_account_balance() problem

Solution to Issue cannot be found in the documentation or other Issues and also occurs in the latest version of this library.

  • I checked the documentation and other Issues. I am using the latest version of this library.

Issue

Hi,
The library is not adjusted for the change bellow and errors like this are appearing (APIError(code=-5000): GET /fapi/v1/positionRisk is retired, please use GET /fapi/v2/positionRisk)

2023-06-28

Notice:

REST

The following endpoints will no longer be supported from 2023-07-15:
GET /fapi/v1/account
GET /fapi/v1/balance
GET /fapi/v1/positionRisk
Please switch to corresponding v2 endpoints:
GET /fapi/v2/account
GET /fapi/v2/balance
GET /fapi/v2/positionRisk

Changing leverage using this library

Is your feature request related to a problem? Please describe.

Hello! I'm trying to find how to change leverage for some futures pair using this library. Is it possible? Googled a lot, searched in documentation and here, nothing found. Any ideas?

Describe the solution you'd like.

No response

Describe alternatives you've considered

No response

Additional context

No response

API randomly stops updating

Version of this library.

unicorn_fy: not found
unicorn_binance_local_depth_cache: not found
unicorn_binance_rest_api: 1.4.3
unicorn_binance_websocket_api: not found

Solution to Issue cannot be found in the documentation or other Issues and also occurs in the latest version of this library.

  • I checked the documentation and other Issues. I am using the latest version of this library.

Hardware?

Local server/workstation

Operating System?

Windows

Python version?

Python3.10

Installed packages

aiodns                    3.0.0
aiohttp                   3.8.1
aiosignal                 1.2.0
altgraph                  0.17.2
async-timeout             4.0.2
attrs                     21.4.0
ccxt                      1.79.89
certifi                   2021.10.8
cffi                      1.15.0
charset-normalizer        2.0.12
colorama                  0.4.4
cryptography              36.0.2
dateparser                1.1.1
frozenlist                1.3.0
future                    0.18.2
idna                      3.3
multidict                 6.0.2
pefile                    2021.9.3
pip                       21.3.1
pyasn1                    0.4.8
pyasn1-modules            0.2.8
pycares                   4.1.2
pycparser                 2.21
pyinstaller               5.0
pyinstaller-hooks-contrib 2022.4
pyOpenSSL                 22.0.0
PyQt5                     5.15.6
PyQt5-Qt5                 5.15.2
PyQt5-sip                 12.10.1
PyQt5-stubs               5.15.2.0
python-dateutil           2.8.2
pytz                      2022.1
pytz-deprecation-shim     0.1.0.post0
pywin32-ctypes            0.2.0
regex                     2022.3.2
requests                  2.27.1
service-identity          21.1.0
setuptools                62.1.0
six                       1.16.0
tzdata                    2022.1
tzlocal                   4.2
ujson                     5.2.0
unicorn-binance-rest-api  1.4.3
urllib3                   1.26.9
websocket-client          1.3.2
websockets                10.3
wheel                     0.37.1
yarl                      1.7.2

Logging output

2022-04-20 15:01:11,643 [DEBUG   ] 3280 852 connectionpool: https://fapi.binance.com:443 "GET /fapi/v1/positionRisk?symbol= &timestamp=   8&signature=  HTTP/1.1" 200 None
2022-04-20 15:01:11,889 [DEBUG   ] 3280 852 connectionpool: https://fapi.binance.com:443 "GET /fapi/v1/positionRisk?symbol=  &timestamp=  &signature=  HTTP/1.1" 200 None




2022-04-19 02:18:03,281 [DEBUG   ] 4620 3684 connectionpool: https://api.binance.com:443 "GET /api/v3/ping HTTP/1.1" 200 2
2022-04-19 02:18:03,521 [DEBUG   ] 4620 3684 connectionpool: https://api.binance.com:443 "GET /api/v3/time HTTP/1.1" 200 28
2022-04-19 02:18:03,770 [DEBUG   ] 4620 3684 connectionpool: https://api.github.com:443 "GET /repos/LUCIT-Systems-and-Development/unicorn-binance-rest-api/releases/latest HTTP/1.1" 200 1045

Used endpoint?

binance.com-futures

Issue

Hello!

Randomly, I won't be able to open or close any position when orders are sent.

The debug goes from printing only fapi.binance.com:443 to api.binance.com:443 followed by api.github.com:443 then it will just stop. No freeze or error message.

I added this line my codes:
t = datetime.now()
print(t)

I noticed that if after 30mn no time info has been printed, those three lines are in the debugging file and the script is no longer working.
At first I tought that it may be due to been idle for too long, but there has been time when it stopped 10 minutes after opening a position.

Unable to place orders

Discussed in https://github.com/LUCIT-Systems-and-Development/unicorn-binance-rest-api/discussions/32

Originally posted by rondha03 April 20, 2022
Hello!

Occasionally, I will no longer be able to place orders on Binance Futures for an undetermined amount of time.

After taking a look at the pyc file, I noticed that these lines alwas appear when orders no longer go thru:

2022-04-19 02:18:02,995 [DEBUG ] 4620 3684 connectionpool: Starting new HTTPS connection (1): api.binance.com:443
2022-04-19 02:18:03,281 [DEBUG ] 4620 3684 connectionpool: https://api.binance.com:443 "GET /api/v3/ping HTTP/1.1" 200 2
2022-04-19 02:18:03,521 [DEBUG ] 4620 3684 connectionpool: https://api.binance.com:443 "GET /api/v3/time HTTP/1.1" 200 28
2022-04-19 02:18:03,524 [DEBUG ] 4620 3684 connectionpool: Starting new HTTPS connection (1): api.github.com:443
2022-04-19 02:18:03,770 [DEBUG ] 4620 3684 connectionpool: https://api.github.com:443 "GET /repos/LUCIT-Systems-and-Development/unicorn-binance-rest-api/releases/latest HTTP/1.1" 200 1045

it goes from fapi.binance (all good) to api.binance then finally api.github (where it will stop sending orders to Binance)

Add staking endpoints

Describe the solution you'd like.

Please add the rest api endpoints for /sapi/v1/staking/*

Cannot send isolated margin orders

Version of this library.

unicorn_binance_rest_api==1.5.0

Solution to Issue cannot be found in the documentation or other Issues and also occurs in the latest version of this library.

  • I checked the documentation and other Issues. I am using the latest version of this library.

Hardware?

Local server/workstation

Operating System?

Windows

Python version?

Python3.9

Installed packages

No response

Logging output

Input In [14] in <cell line: 1>
    response = rest.order_limit_buy(symbol='KDAUSDT', price=1.8, quantity=10, isIsolated=True, newClientOrderId='test_10')

  File ~\anaconda3\lib\site-packages\unicorn_binance_rest_api\manager.py:1623 in order_limit_buy
    return self.order_limit(timeInForce=timeInForce, **params)

  File ~\anaconda3\lib\site-packages\unicorn_binance_rest_api\manager.py:1585 in order_limit
    return self.create_order(**params)

  File ~\anaconda3\lib\site-packages\unicorn_binance_rest_api\manager.py:1546 in create_order
    return self._post('order', True, data=params)

  File ~\anaconda3\lib\site-packages\unicorn_binance_rest_api\manager.py:505 in _post
    return self._request_api('post', path, signed, version, **kwargs)

  File ~\anaconda3\lib\site-packages\unicorn_binance_rest_api\manager.py:455 in _request_api
    return self._request(method, uri, signed, **kwargs)

  File ~\anaconda3\lib\site-packages\unicorn_binance_rest_api\manager.py:450 in _request
    return self._handle_response()

  File ~\anaconda3\lib\site-packages\unicorn_binance_rest_api\manager.py:495 in _handle_response
    raise BinanceAPIException(self.response)

BinanceAPIException: APIError(code=-1104): Not all sent parameters were read; read '9' parameter(s) but was sent '10'.

Used endpoint?

binance.com-isolated_margin

Issue

To send isolated margin orders, it needs to accept isIsolated arguments, but it seems like it does not.

Getting Connection Reset Error

I am trying to make continuous requests to Binance. I am not going out of limit requests(> 1200) per minute. But still getting this error. Even my IP is not banned. After the error I rerun the code, it is working fine for the next 5-6 hours every time. And I am running this on VM. So, it is not the case that my IP is banned and after changing the internet connection my IP is changed.

from unicorn_binance_rest_api.unicorn_binance_rest_api_manager import BinanceRestApiManager
from unicorn_binance_rest_api.unicorn_binance_rest_api_exceptions import BinanceAPIException
import time
import logging
from requests.exceptions import ConnectionError
from urllib3.exceptions import ProtocolError

api_key = "key"
api_secret = "secret"
ubra = BinanceRestApiManager(api_key, api_secret)

avail_count = 10
coins = [{'symbol': 'QTUMUSDT'},
         {'symbol': 'ADAUSDT'},
         {'symbol': 'XRPUSDT'},
         {'symbol': 'MIRUSDT'}]

def buy_coin():
    global avail_count
    for coin in coins:
            current_price = float(ubra.get_symbol_ticker(symbol=coin["symbol"])["price"])
            ## Doing something with price


while True:
    try:
        buy_coin()
        if avail_count == 0:
            time.sleep(3)
    except (ConnectionResetError, ConnectionError, ProtocolError) as e:
        print(e)
        ubra = BinanceRestApiManager(api_key, api_secret)

Here is the full error

Traceback (most recent call last):
  File "C:\Users\Administrator\Desktop\Binance\venv\lib\site-packages\urllib3\connectionpool.py", line 706, in urlopen
    chunked=chunked,
  File "C:\Users\Administrator\Desktop\Binance\venv\lib\site-packages\urllib3\connectionpool.py", line 445, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "C:\Users\Administrator\Desktop\Binance\venv\lib\site-packages\urllib3\connectionpool.py", line 440, in _make_request
    httplib_response = conn.getresponse()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 1336, in getresponse
    response.begin()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 306, in begin
    version, status, reason = self._read_status()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 267, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\socket.py", line 589, in readinto
    return self._sock.recv_into(b)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\ssl.py", line 1071, in recv_into
    return self.read(nbytes, buffer)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\ssl.py", line 929, in read
    return self._sslobj.read(len, buffer)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Administrator\Desktop\Binance\venv\lib\site-packages\requests\adapters.py", line 449, in send
    timeout=timeout
  File "C:\Users\Administrator\Desktop\Binance\venv\lib\site-packages\urllib3\connectionpool.py", line 756, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "C:\Users\Administrator\Desktop\Binance\venv\lib\site-packages\urllib3\util\retry.py", line 532, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "C:\Users\Administrator\Desktop\Binance\venv\lib\site-packages\urllib3\packages\six.py", line 734, in reraise
    raise value.with_traceback(tb)
  File "C:\Users\Administrator\Desktop\Binance\venv\lib\site-packages\urllib3\connectionpool.py", line 706, in urlopen
    chunked=chunked,
  File "C:\Users\Administrator\Desktop\Binance\venv\lib\site-packages\urllib3\connectionpool.py", line 445, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "C:\Users\Administrator\Desktop\Binance\venv\lib\site-packages\urllib3\connectionpool.py", line 440, in _make_request
    httplib_response = conn.getresponse()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 1336, in getresponse
    response.begin()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 306, in begin
    version, status, reason = self._read_status()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 267, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\socket.py", line 589, in readinto
    return self._sock.recv_into(b)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\ssl.py", line 1071, in recv_into
    return self.read(nbytes, buffer)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\ssl.py", line 929, in read
    return self._sslobj.read(len, buffer)
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "binance.py", line 243, in <module>
    ubra = BinanceRestApiManager(api_key, api_secret)
  File "C:\Users\Administrator\Desktop\Binance\venv\lib\site-packages\unicorn_binance_rest_api\unicorn_binance_rest_api_manager.py", line 179, in __init__
    res = self.get_server_time()
  File "C:\Users\Administrator\Desktop\Binance\venv\lib\site-packages\unicorn_binance_rest_api\unicorn_binance_rest_api_manager.py", line 577, in get_server_time
    return self._get('time', version=self.PRIVATE_API_VERSION)
  File "C:\Users\Administrator\Desktop\Binance\venv\lib\site-packages\unicorn_binance_rest_api\unicorn_binance_rest_api_manager.py", line 339, in _get
    return self._request_api('get', path, signed, version, **kwargs)
  File "C:\Users\Administrator\Desktop\Binance\venv\lib\site-packages\unicorn_binance_rest_api\unicorn_binance_rest_api_manager.py", line 287, in _request_api
    return self._request(method, uri, signed, **kwargs)
  File "C:\Users\Administrator\Desktop\Binance\venv\lib\site-packages\unicorn_binance_rest_api\unicorn_binance_rest_api_manager.py", line 281, in _request
    self.response = getattr(self.session, method)(uri, **kwargs)
  File "C:\Users\Administrator\Desktop\Binance\venv\lib\site-packages\requests\sessions.py", line 555, in get
    return self.request('GET', url, **kwargs)
  File "C:\Users\Administrator\Desktop\Binance\venv\lib\site-packages\requests\sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\Administrator\Desktop\Binance\venv\lib\site-packages\requests\sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\Administrator\Desktop\Binance\venv\lib\site-packages\requests\adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))

Parsing error when upgrade to regex==2022.3.15

Check this or we will delete your issue. (fill in the checkbox with an X like so: [x])

  • I have searched for other issues with the same problem or similar feature requests.

Select one:

  • Bug
  • Feature Request
  • Technical Help
  • Other

Which endpoint do you connect?

client = unicorn_binance_rest_api.BinanceRestApiManager(parameters.api_key, parameters.api_secret,
                                                        exchange="binance.com")

Python Version Requirement

  • I am using Python 3.7 or above

Exact Python Version?

3.8

Pip Version?

Include here the response of 'python3 -m pip --version' or 'pip3 --version'

Dependencies

aiohttp==3.7.4.post0
aniso8601==9.0.1
async-timeout==3.0.1
attrs==21.4.0
autobahn==22.2.2
Automat==20.2.0
backports.zoneinfo==0.2.1
certifi==2021.10.8
cffi==1.15.0
chardet==4.0.0
charset-normalizer==2.0.12
cheroot==8.6.0
click==8.0.4
colorama==0.4.4
constantly==15.1.0
cryptography==36.0.2
dateparser==1.1.0
discord==1.7.3
discord.py==1.7.3
exchange==0.3
Flask==2.0.3
Flask-RESTful==0.3.9
hyperlink==21.0.0
idna==3.3
incremental==21.3.0
itsdangerous==2.1.1
jaraco.functools==3.5.0
Jinja2==3.0.3
MarkupSafe==2.1.1
more-itertools==8.12.0
multidict==6.0.2
numpy==1.22.3
pandas==1.1.3
pathlib==1.0.1
psutil==5.9.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.21
pyOpenSSL==22.0.0
python-binance==0.7.9
python-dateutil==2.8.2
pytz==2021.3
pytz-deprecation-shim==0.1.0.post0
redis==3.5.3
regex==2022.3.15
requests==2.27.1
service-identity==21.1.0
six==1.16.0
stockstats==0.4.0
Twisted==22.2.0
txaio==22.2.1
typing_extensions==4.1.1
tzdata==2021.5
tzlocal==4.1
ujson==5.1.0
unicorn-binance-rest-api==1.4.1
unicorn-binance-websocket-api==1.40.5
unicorn-fy==0.11.0
urllib3==1.26.8
websocket-client==1.3.1
websockets==10.2
Werkzeug==2.0.3
yarl==1.7.2
zope.interface==5.4.0

Which Versions?

latest

Description Of Your Issue

ile "/home/bot/main.py", line 49, in <module>
tickers, tickers_info = tickers_tools.initialize(symbols1 + symbols2 + symbols3 + symbols4, tickers_info, client)
File "/home/bot/tickers_tools.py", line 18, in initialize
binance_klines = client.get_historical_klines(symbol, Client.KLINE_INTERVAL_5MINUTE, "2 hours ago UTC")
File "/home/venv/lib/python3.8/site-packages/binance/client.py", line 791, in get_historical_klines
start_ts = date_to_milliseconds(start_str)
File "/home/venv/lib/python3.8/site-packages/binance/helpers.py", line 22, in date_to_milliseconds
d = dateparser.parse(date_str)
File "/home/venv/lib/python3.8/site-packages/dateparser/conf.py", line 92, in wrapper
return f(*args, **kwargs)
File "/home/venv/lib/python3.8/site-packages/dateparser/__init__.py", line 61, in parse
data = parser.get_date_data(date_string, date_formats)
File "/home/venv/lib/python3.8/site-packages/dateparser/date.py", line 428, in get_date_data
parsed_date = _DateLocaleParser.parse(
    File "/home/venv/lib/python3.8/site-packages/dateparser/date.py", line 178, in parse
return instance._parse()
File "/home/venv/lib/python3.8/site-packages/dateparser/date.py", line 182, in _parse
date_data = self._parsers[parser_name]()
File "/home/venv/lib/python3.8/site-packages/dateparser/date.py", line 196, in _try_freshness_parser
return freshness_date_parser.get_date_data(self._get_translated_date(), self._settings)
File "/home/venv/lib/python3.8/site-packages/dateparser/date.py", line 234, in _get_translated_date
self._translated_date = self.locale.translate(
    File "/home/venv/lib/python3.8/site-packages/dateparser/languages/locale.py", line 131, in translate
relative_translations = self._get_relative_translations(settings=settings)
File "/home/venv/lib/python3.8/site-packages/dateparser/languages/locale.py", line 158, in _get_relative_translations
self._generate_relative_translations(normalize=True))
File "/home/venv/lib/python3.8/site-packages/dateparser/languages/locale.py", line 172, in _generate_relative_translations
pattern = DIGIT_GROUP_PATTERN.sub(r'?P<n>\d+', pattern)
File "/home/venv/lib/python3.8/site-packages/regex/regex.py", line 700, in _compile_replacement_helper
is_group, items = _compile_replacement(source, pattern, is_unicode)
File "/home/venv/lib/python3.8/site-packages/regex/_regex_core.py", line 1736, in _compile_replacement
raise error("bad escape \\%s" % ch, source.string, source.pos)
regex._regex_core.error: bad escape \d at position 7

Bonus:
The regex version was updated when I upgrade the unicorn-binance-websocket-api to 1.40.5
Fix this issue, downgrading the regex version to 2022.3.2

Support for hidden private endpoints

Is your feature request related to a problem? Please describe.

The problem with Binance's Futures API is that your take profit, once hit, does not cancel your stop loss, and vice versa. If you can implement the private endpoint, you would eliminate a lot of overhead like listening to the user stream to monitor if you need to cancel a take profit or stop loss.

Describe the solution you'd like.

Upon inspection of the URL Binance uses on their exchange, I found the following. You can use their URL and parameters to open a position through the private endpoint.

URL:
https://www.binance.com/bapi/futures/v1/private/future/strategy/place-order

Params:

{
    'strategyType': 'OTOCO',
    'subOrderList': [
        {
            "strategySubId": 1,
            "firstDrivenId": 0,
            "secondDrivenId": 0,
            "side": "BUY",
            "positionSide": "BOTH",
            "symbol": "BTCUSDT",
            "type": "MARKET",
            "quantity": 0.005,
            "securityType": "USDT_FUTURES",
            "reduceOnly": False
        },
        {
            "side": "SELL",
            "positionSide": "BOTH",
            "symbol": "BTCUSDT",
            "securityType": "USDT_FUTURES",
            "firstTrigger": "PLACE_ORDER",
            "firstDrivenOn": "PARTIALLY_FILLED_OR_FILLED",
            "timeInForce": "GTE_GTC",
            "reduceOnly": True,
            "quantity": 0.005,
            "strategySubId": 2,
            "firstDrivenId": 1,
            "secondDrivenId": 3,
            "secondDrivenOn": "PARTIALLY_FILLED_OR_FILLED",
            "secondTrigger": "CANCEL_ORDER",
            "stopPrice": "21248.4",
            "workingType": "MARK_PRICE",
            "type": "TAKE_PROFIT_MARKET",
            "priceProtect": True
        },
        {
            "side": "SELL",
            "positionSide": "BOTH",
            "symbol": "BTCUSDT",
            "securityType": "USDT_FUTURES",
            "firstTrigger": "PLACE_ORDER",
            "firstDrivenOn": "PARTIALLY_FILLED_OR_FILLED",
            "timeInForce": "GTE_GTC",
            "reduceOnly": True,
            "quantity": 0.005,
            "strategySubId": 3,
            "firstDrivenId": 1,
            "secondDrivenId": 2,
            "secondDrivenOn": "PARTIALLY_FILLED_OR_FILLED",
            "secondTrigger": "CANCEL_ORDER",
            "stopPrice": "20827.6",
            "workingType": "MARK_PRICE",
            "type": "STOP_MARKET",
            "priceProtect": True
        }
    ]
}

Describe alternatives you've considered

You can use LUCIT's Binance websocket repository to listen to the user stream, however, this is extremely inconvenient compared to just putting in this type of order on futures.

Additional context

Note that Binance Spot API already has this type of support in their API.

More on these types of orders:
https://www.binance.com/en-ZA/support/faq/what-are-limit-tp-sl-orders-strategy-order-and-frequently-asked-questions-e1ee1738141c49718550fa9061be4bf3

Vulnerability CVE-2023-32681 in sub module requesocks

Solution to Issue cannot be found in the documentation or other Issues and also occurs in the latest version of this library.

  • I checked the documentation and other Issues. I am using the latest version of this library.

Version of this library.

All current

Hardware?

Local server/workstation

Operating System?

Linux

Python version?

Python3.7

Installed wheel files

No response

Installed packages

No response

Logging output

No response

Used endpoint?

concerns all

Issue

JUST THE RECENT VERSION OF PYTHON-REQUESTS, it has already SOCKS support bundled:
https://devhub.checkmarx.com/cve-details/CVE-2023-32681/?utm_source=jetbrains&utm_medium=referral&utm_campaign=idea

Binance will delist all WAPI endpoints from the Binance API at 2021-08-01 2:00 AM (UTC)

To optimize API performance and provide better trading services for our API users, Binance will delist all WAPI endpoints from the Binance API at 2021-08-01 2:00 AM (UTC). Information on WAPI endpoints has been removed from Binance API Documentation.

Details on WAPI endpoints to be delisted:

Name Path
System Status GET /wapi/v3/systemStatus.html
Withdraw POST /wapi/v3/withdraw.html
Deposit History GET /wapi/v3/depositHistory.html
Withdraw History GET /wapi/v3/withdrawHistory.html
Deposit Address GET /wapi/v3/depositAddress.html
Account Status GET /wapi/v3/accountStatus.html
Account API Trading Status GET /wapi/v3/apiTradingStatus.html
DustLog GET /wapi/v3/userAssetDribbletLog.html
Asset Detail GET /wapi/v3/assetDetail.html
Trade Fee GET /wapi/v3/tradeFee.html
Query Sub-account List GET /wapi/v3/sub-account/list.html
Query Sub-account Spot Asset Transfer History GET /wapi/v3/sub-account/transfer/history.html
Sub-account Spot Asset Transfer POST /wapi/v3/sub-account/transfer.html
Query Sub-account Assets GET /wapi/v3/sub-account/assets.html

Details on the SAPI endpoints:

Name Path
System Status GET /sapi/v1/system/status
Withdraw POST /sapi/v1/capital/withdraw/apply
Deposit History GET /sapi/v1/capital/deposit/hisrec
Withdraw History GET /sapi/v1/capital/withdraw/history
Deposit Address GET /sapi/v1/capital/deposit/address
Account Status GET /sapi/v1/account/status
Account API Trading Status GET /sapi/v1/account/apiTradingStatus
DustLog GET /sapi/v1/asset/dribblet
Asset Detail GET /sapi/v1/asset/assetDetail
Trade Fee GET /sapi/v1/asset/tradeFee
Query Sub-account List GET /sapi/v1/sub-account/list
Query Sub-account Spot Asset Transfer History GET /sapi/v1/sub-account/sub/transfer/history
Sub-account Spot Asset Transfer POST /sapi/v1/sub-account/universalTransfer
Query Sub-account Assets GET /sapi/v3/sub-account/assets

For more information: SAPI Documentation

cancel all orders for a symbol

Is your feature request related to a problem? Please describe.
I am trying to minimize the number of calls that I make to the binance REST API. One of the actions that I frequently take is to cancel all orders for a symbol. I see that binance implements this endpoint: https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md#cancel-all-open-orders-on-a-symbol-trade. However, neither this library nor python-binance implement a method to access this endpoint.

Describe the solution you'd like
A method to close all the open orders for a symbol. Something like this:

    def cancel_orders(self, **params):
        return self._delete('openOrders', True, data=params)

Describe alternatives you've considered
Closing the orders one by one.. but I'd rather not.

Additional context
N/A

Futures Rest Api throws errors on placing STOP or TAKE_PROFIT or STOP_MARKET or LIMIT orders

Hi Oliver,
Thanks for your prompt response on UBWA,
I quickly looked up your rest-API which is similar to python-binance.
I was using the futures_create_order method to place STOP order or TAKE_PROFIT as order type to modify positions.

I have been through Binance futures documentation at https://binance-docs.github.io/apidocs/futures/en/#new-order-trade
provided all required mandatory parameters However which ever way I modify the code, it throws errors.

Have you had this kind of issue?

binance.exceptions.BinanceAPIException: APIError(code=-1102): A mandatory parameter was not sent, was empty/null, or malformed.

` traded_order=self.client.futures_create_order(symbol= self.symbol,
# newClientOrderId=clientorderId,
side= "BUY",
positionSide= "LONG",
# timeInForce= 'GTC',
quantity= qty,
type="TAKE_PROFIT",

					# price= price ,\  not mandatory
				
					stopPrice= price, \
					workingType= 'MARK_PRICE',  
				
					priceProtect='TRUE',\
					timeInForce='GTC',
					# callbackRate= 'float' ,\
					# activationPrice= 'float', \
						
					newOrderRespType= 'ACK',\
					timestamp=timestamp

					
	)`

"1000SHIB/USDT" and "BTCDOM/USDT" reported as "Invalid symbol"

Check this or we will delete your issue. (fill in the checkbox with an X like so: [x])

  • [ x] I have searched for other issues with the same problem or similar feature requests.

Select one:

  • [x ] Bug
  • Feature Request
  • Technical Help
  • Other

Environment

  • [x ] Are you using the module on a VPS or other Cloud hosting?
  • Are you using the module on a Raspberry Pi?

What kind of internet connection do you have?

high-speed
Include here a description of your internet access like cable, lte and up and download rate.
cable, 5GBites/sec

Average system load (CPU)

30% with 3GHz
Include here the ammount of cpu cores and the average system load.
6 cores, 30% avg system load

Hardware specification

cloud
Include here a description of the server hardware.
don't know

Operating System? (include version)

  • macOS
  • [x ] Windows
  • Linux (include flavour)

Options

  • [x ] stream_buffer
  • process_stream_data

Which endpoint do you connect?

Include here the endpint you are connecting to, like binance.com, binance.com-isolated_margin or binance.org-testnet
binance.com-futures

#### Python Version Requirement
- [ x] I am using Python 3.7 or above

#### Exact Python Version?
Python 3.8.10


#### Pip Version?
pip 21.1.3 


#### Dependencies
Run `pip list > pip_list.txt` and upload the file.

#### UNICORN Binance WebSocket API Version?
Successfully installed unicorn-binance-websocket-api-1.34.1 websockets-10.0


#### Description of your issue
the crypto currencies "1000SHIB/USDT" and "BTCDOM/USDT" are not providing data when used in REST API requests, and reported as "Invalid symbol"


CODE:
------------------------------
from unicorn_binance_rest_api.unicorn_binance_rest_api_manager import BinanceRestApiManager
import logging
import os
import pandas as pd
import numpy as np
# https://docs.python.org/3/library/logging.html#logging-levels
logging.basicConfig(level=logging.DEBUG,
                    #filename=os.path.basename(__file__) + '.log',
                    filename=os.getcwd()  + '.log',
                    format="{asctime} [{levelname:8}] {process} {thread} {module}: {message}",
                    style="{")
api_key = thomas_api_key
api_secret = thomas_api_secret
ubra = BinanceRestApiManager(api_key, api_secret, exchange="binance.com-futures")
print(ubra.get_symbol_ticker(symbol="1000SHIBUSDT"))


ERROR MESSAGE:
------------------------------
---------------------------------------------------------------------------
BinanceAPIException                       Traceback (most recent call last)
<ipython-input-23-7971c70e1a05> in <module>
----> 1 print(ubra.get_symbol_ticker(symbol="1000SHIBUSDT"))

~\Anaconda3\lib\site-packages\unicorn_binance_rest_api\unicorn_binance_rest_api_manager.py in get_symbol_ticker(self, **params)
   1385 
   1386         """
-> 1387         return self._get('ticker/price', data=params, version=self.PRIVATE_API_VERSION)
   1388 
   1389     def get_orderbook_ticker(self, **params):

~\Anaconda3\lib\site-packages\unicorn_binance_rest_api\unicorn_binance_rest_api_manager.py in _get(self, path, signed, version, **kwargs)
    507 
    508     def _get(self, path, signed=False, version=PUBLIC_API_VERSION, **kwargs):
--> 509         return self._request_api('get', path, signed, version, **kwargs)
    510 
    511     def _post(self, path, signed=False, version=PUBLIC_API_VERSION, **kwargs):

~\Anaconda3\lib\site-packages\unicorn_binance_rest_api\unicorn_binance_rest_api_manager.py in _request_api(self, method, path, signed, version, **kwargs)
    460         uri = self._create_api_uri(path, signed, version)
    461 
--> 462         return self._request(method, uri, signed, **kwargs)
    463 
    464     def _request_margin_api(self, method, path, signed=False, version=MARGIN_API_VERSION, **kwargs):

~\Anaconda3\lib\site-packages\unicorn_binance_rest_api\unicorn_binance_rest_api_manager.py in _request(self, method, uri, signed, force_params, **kwargs)
    455 
    456         self.response = getattr(self.session, method)(uri, **kwargs)
--> 457         return self._handle_response()
    458 
    459     def _request_api(self, method, path, signed=False, version=PUBLIC_API_VERSION, **kwargs):

~\Anaconda3\lib\site-packages\unicorn_binance_rest_api\unicorn_binance_rest_api_manager.py in _handle_response(self)
    500         """
    501         if not (200 <= self.response.status_code < 300):
--> 502             raise BinanceAPIException(self.response)
    503         try:
    504             return self.response.json()

BinanceAPIException: APIError(code=-1121): Invalid symbol.

get_account() -> APIError(code=-1022): Signature for this request is not valid.

I keep getting this signature exception trying to call get_account(). Am I missing something somewhere, maybe?

I tried in Postman with the same key and secret. It creates a signature and the GET is successful to {{url}}/api/v3/account?timestamp={{timestamp}}&signature={{signature}}.

Any pointers?

(binance.venv) jlixfeld@Jasons-MacBook-Pro binance % python
Python 3.8.2 (default, Jun  8 2021, 11:59:35) 
[Clang 12.0.5 (clang-1205.0.22.11)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from unicorn_binance_rest_api.unicorn_binance_rest_api_manager import BinanceRestApiManager
>>> import apikeys
>>> ubram = BinanceRestApiManager(api_key=apikeys.l_api_key, api_secret=apikeys.l_api_key)
>>> account = ubram.get_account()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/unicorn_binance_rest_api/unicorn_binance_rest_api_manager.py", line 1946, in get_account
    return self._get('account', True, data=params)
  File "/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/unicorn_binance_rest_api/unicorn_binance_rest_api_manager.py", line 339, in _get
    return self._request_api('get', path, signed, version, **kwargs)
  File "/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/unicorn_binance_rest_api/unicorn_binance_rest_api_manager.py", line 292, in _request_api
    return self._request(method, uri, signed, **kwargs)
  File "/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/unicorn_binance_rest_api/unicorn_binance_rest_api_manager.py", line 287, in _request
    return self._handle_response()
  File "/Users/jlixfeld/Documents/Development/crypto/binance/binance.venv/lib/python3.8/site-packages/unicorn_binance_rest_api/unicorn_binance_rest_api_manager.py", line 332, in _handle_response
    raise BinanceAPIException(self.response)
unicorn_binance_rest_api.unicorn_binance_rest_api_exceptions.BinanceAPIException: APIError(code=-1022): Signature for this request is not valid.
>>> 
(binance.venv) jlixfeld@Jasons-MacBook-Pro binance % pip freeze | grep -i unicorn
unicorn-binance-rest-api==1.2.0
unicorn-binance-suite==0.0.0
unicorn-binance-websocket-api==1.31.0
unicorn-fy==0.11.0
(binance.venv) jlixfeld@Jasons-MacBook-Pro binance % 

FUTURES_COIN_URL seems to be wrong.

Check this or we will delete your issue. (fill in the checkbox with an X like so: [x])

  • I have searched for other issues with the same problem or similar feature requests.

Select one:

  • Bug
  • Feature Request
  • Technical Help
  • Other

Environment

  • Are you using the module on a VPS or other Cloud hosting?
  • Are you using the module on a Raspberry Pi?

What kind of internet connection do you have?

fiber

Operating System? (include version)

  • macOS
  • Windows
  • Linux (include flavour)

Options

  • stream_buffer
  • process_stream_data

Which endpoint do you connect?

 binance.com

Python Version Requirement

  • I am using Python 3.6.1 or above

Exact Python Version?

Python 3.9.4

Pip Version?

pip 20.2.2

Dependencies

Run pip list > pip_list.txt and upload the file.

UNICORN Binance REST API Version?

Did you upgrade to the latest release version with `pip install unicorn-binance-rest-api --upgrade`?

Please control what version you are using with this script and post the output: https://github.com/oliver-zehentleitner/unicorn-binance-rest-api/blob/master/tools/get_used_module_version.py
-> the pages results in a 404 ...

Description of your issue

klines = ubra.futures_coin_klines(symbol='ETHUSDT', interval='1m', limit=500)
fails with the URI 

GET /fapi/v1/account is retired, please use GET /fapi/v2/account

Version of this library.

unicorn_fy: 0.12.2
unicorn_binance_local_depth_cache: 0.7.3
unicorn_binance_rest_api: 1.10.0
unicorn_binance_trailing_stop_loss: 0.8.0
unicorn_binance_websocket_api: 1.46.1

Solution to Issue cannot be found in the documentation or other Issues and also occurs in the latest version of this library.

  • I checked the documentation and other Issues. I am using the latest version of this library.

Hardware?

Local server/workstation

Operating System?

Windows

Python version?

Python3.10

Installed packages

No response

Logging output

No response

Used endpoint?

binance.com-futures

Issue

I am getting the following error:

unicorn_binance_rest_api.exceptions.BinanceAPIException: APIError(code=-5000): GET /fapi/v1/account is retired, please use GET /fapi/v2/account

Can you tell me how I can fix it?

Download Futures Order Book Historical Data

Is your feature request related to a problem? Please describe.

@oliver-zehentleitner

Can you add a new feature to download Futures Order Book Historical Data thru Rest API?

Binance is providing it thru a whitelisted account. There are two types of historical data we can download T-Depth and S-Depth.

Here's the explanation about it:
https://www.binance.com/en/support/faq/binance-futures-order-book-historical-data-e707685b4e0f408fa7c1b9ccd8ea7aa9
and
https://github.com/binance/binance-public-data/tree/master/Futures_Order_Book_Download

Describe the solution you'd like.

No response

Describe alternatives you've considered

No response

Additional context

No response

Async support?

First of all, thank you for the great work!

Is your feature request related to a problem? Please describe.
I need to run some tasks in parallel, the repo sammchardy/python-binance supports this and it works well.
I am considering to switch to this repo(unicorn-binance-rest-api) because I am impressed by the unicorn-binance-websocket-api repo, and I see this repo is more active than sammchardy/python-binance.

Describe the solution you'd like
Anything similar to what sammchardy/python-binance does, it is well documented: https://sammchardy.github.io/async-binance-basics/

Describe alternatives you've considered
Well, continue to use sammchardy/python-binance for the async rest api and use this repo for the stream api

Additional context
None

async Client API Requests

Discussed in #48

Originally posted by 45by90 September 17, 2022
Hello,

Is there a way to make async client API calls, i.e., make a trade call and wait for it while still getting in streaming data?

The websocket stream is blocked while trying to make a trade (maybe a couple of tries). By the time the trade goes through or fails, the stream rushes to catch up and everything gets screwed up. Or perhaps something I'm missing? I've tried things like:

with c.concurrent.futures.ThreadPoolExecutor() as executor:
    future = executor.submit(self._executor,'BUY',quant,trade_this_price,price_filter)
    trade_r = future.result()

But it still blocks the main process (for example, I have a window display updating, which freezes while the order executions are trying to get put through).

Thank you,

JJ

REST calls memory leak

Version of this library.

unicorn_fy: 0.12.2
unicorn_binance_local_depth_cache: 0.7.3
unicorn_binance_rest_api: 1.5.0
unicorn_binance_trailing_stop_loss: not found
unicorn_binance_websocket_api: 1.41.0

Solution to Issue cannot be found in the documentation or other Issues and also occurs in the latest version of this library.

  • I checked the documentation and other Issues. I am using the latest version of this library.

Hardware?

Local server/workstation

Operating System?

macOS

Python version?

Python3.10

Installed packages

Package                           Version
--------------------------------- -----------
aniso8601                         9.0.1
attrs                             22.2.0
bbd-table-parser                  0.0.1
certifi                           2022.12.7
cffi                              1.15.1
charset-normalizer                2.1.1
cheroot                           9.0.0
ciso8601                          2.3.0
click                             8.1.3
colorama                          0.4.6
contourpy                         1.0.6
cryptography                      39.0.0
cycler                            0.11.0
Cython                            0.29.28
dateparser                        1.1.5
engineering-notation              0.8.0
exceptiongroup                    1.1.0
fastenum                          1.0.4
filprofiler                       2023.1.0
flake8                            4.0.1
Flask                             2.1.2
Flask-Cors                        3.0.10
Flask-RESTful                     0.3.9
fonttools                         4.38.0
gitdb                             4.0.10
GitPython                         3.1.27
glob2                             0.7
graphviz                          0.20.1
greenlet                          2.0.1
hjson                             3.0.2
idna                              3.4
influxdb-client                   1.30.0
iniconfig                         2.0.0
itsdangerous                      2.1.2
jaraco.functools                  3.5.2
Jinja2                            3.1.2
joblib                            1.2.0
jsons                             1.6.1
kaleido                           0.2.1
kiwisolver                        1.4.4
kneed                             0.7.0
llvmlite                          0.39.1
Mako                              1.2.4
MarkupSafe                        2.1.1
matplotlib                        3.6.2
mccabe                            0.6.1
more-itertools                    9.0.0
mplfinance                        0.12.9b1
multidict                         6.0.4
numba                             0.56.4
numpy                             1.23.5
objgraph                          3.5.0
orderedattrdict                   1.6.0
packaging                         23.0
pandas                            1.5.1
panwid                            0.3.5
parse                             1.19.0
parse-type                        0.6.0
pid                               3.0.4
Pillow                            9.4.0
pip                               22.3.1
plotly                            5.10.0
pluggy                            1.0.0
polars                            0.15.15
prettytable                       3.4.1
psutil                            5.9.0
py                                1.11.0
pyarrow                           10.0.1
pyasn1                            0.4.8
pyasn1-modules                    0.2.8
pybit                             2.3.1
pycodestyle                       2.8.0
pycparser                         2.21
pyflakes                          2.4.0
Pympler                           1.0.1
pyOpenSSL                         23.0.0
pyparsing                         3.0.9
pytest                            7.2.0
pytest-bdd                        5.0.0
python-dateutil                   2.8.2
pytz                              2022.7
pytz-deprecation-shim             0.1.0.post0
PyYAML                            6.0
raccoon                           3.0.0
regex                             2022.3.2
rel                               0.4.7
requests                          2.28.1
Rx                                3.2.0
scikit-learn                      1.1.3
scipy                             1.9.3
service-identity                  21.1.0
setuptools                        65.6.3
six                               1.16.0
smmap                             5.0.0
sortedcontainers                  2.4.0
SQLAlchemy                        1.4.35
ta                                0.10.2
tabulate                          0.9.0
tenacity                          8.1.0
threadpoolctl                     3.1.0
tk-tools                          0.16.0
tomli                             2.0.1
typish                            1.9.3
tzdata                            2022.7
tzlocal                           4.2
ujson                             5.7.0
unicorn-binance-local-depth-cache 0.7.3
unicorn-binance-rest-api          1.5.0
unicorn-binance-websocket-api     1.41.0
unicorn-fy                        0.12.2
urllib3                           1.26.14
urwid                             2.1.2
urwid-readline                    0.13
urwid-utils                       0.1.2
wcwidth                           0.2.5
websocket-client                  1.3.3
websockets                        10.3
Werkzeug                          2.2.2
yarl                              1.8.1

Logging output

Memory = 32.9609375mb
Memory = 34.0625mb
Memory = 34.31640625mb
Memory = 35.140625mb
Memory = 35.53515625mb
Memory = 35.921875mb
Memory = 36.15625mb
Memory = 36.41796875mb
Memory = 36.9375mb
Memory = 36.953125mb
Memory = 36.953125mb
Memory = 36.953125mb
Memory = 36.953125mb
Memory = 36.953125mb
Memory = 36.953125mb
Memory = 37.046875mb
Memory = 37.27734375mb
Memory = 38.05859375mb
Memory = 38.05859375mb
Memory = 38.1015625mb
Memory = 38.29296875mb
Memory = 38.29296875mb
Memory = 38.29296875mb
Memory = 38.296875mb
Memory = 38.31640625mb
Memory = 38.31640625mb
Memory = 38.31640625mb
Memory = 38.31640625mb
Memory = 38.31640625mb
Memory = 38.31640625mb
Memory = 38.31640625mb
Memory = 38.3203125mb
Memory = 39.11328125mb
Memory = 39.11328125mb
Memory = 39.15625mb
Memory = 39.15625mb
Memory = 39.15625mb
Memory = 39.15625mb
Memory = 39.15625mb
Memory = 39.15625mb

Used endpoint?

concerns all

Issue

I've been having issues with the memory usage in my application, and I've been trying to hunt this down. After quite some searching I've been able to pin it to REST-calls taking place (not sure if it's actually a problem of the underlying requests library). I've constructed a very simple example that shows the memory building up. I can live with the fact that the garbage collector maybe does it's work lazy and it takes some time for the memory usage to stabilise, but adding 7MB in a minute or two with doing nothing but a dumb request and not even storing the result myself is a real problem I think.

Here is the simple piece of code that will show a (small, but continuous) buildup of memory over time:

`import logging
import os

import psutil
import time
from unicorn_binance_rest_api import BinanceRestApiManager

if name == 'main':
rest_manager = BinanceRestApiManager()

while True:
    rest_manager.futures_exchange_info()
    print(f'Memory = {psutil.Process(os.getpid()).memory_info().rss / 1024 ** 2}mb')
    time.sleep(1)

`

I have to admit I'm not a deeply experienced python developer, so perhaps I'm overlooking something very simple, but it's not the memory usage pattern I'd expect from this sample code.

Binance Future Testnet URLs are wrong

Hi Oliver!

Thank you for the wonderful module, I love it very much.

I want to report a bug for the Futures Testnet URLs.

It takes me some time to figure out the problem, even contacting Binance customer service. It turns out the URLs for Binance Futures Testnet in the manager.py are wrong.

Here's the code:

elif self.exchange == "binance.com-futures-testnet":

Todo: Needs a test

self.API_URL = "https://testnet.binance.vision/api"
self.MARGIN_API_URL = " https://api.binance.com/sapi"
self.WEBSITE_URL = "https://testnet.binance.vision/"
self.FUTURES_URL = "https://fapi.binance.com/fapi"
self.FUTURES_DATA_URL = "https://fapi.binance.com/futures/data"
self.FUTURES_COIN_URL = "https://fapi.binance.com/fapi"
self.FUTURES_COIN_DATA_URL = "https://dapi.binance.com/futures/data"

It uses Binance Spot Testnet URLs instead of Binance Futures Testnet URLs. For the Binance Futures Testnet URLs, it's supposed to be: "https://testnet.binancefuture.com/fapi"

testnet.binancefutures.com instead of testnet.binance.vision

As shown in the documentation: https://python-binance.readthedocs.io/en/latest/binance.html

image

error send create future order

Version of this library.

unicorn-binance-rest-api 1.5.0

Solution to Issue cannot be found in the documentation or other Issues and also occurs in the latest version of this library.

  • I checked the documentation and other Issues. I am using the latest version of this library.

Hardware?

VPS or other cloud hosting

Operating System?

Windows

Python version?

Python3.7

Installed packages

aiohttp                       3.8.1
aiosignal                     1.2.0
aniso8601                     9.0.1
async-timeout                 4.0.2
asynctest                     0.13.0
attrs                         22.1.0
backports.zoneinfo            0.2.1
certifi                       2022.6.15
cffi                          1.15.1
charset-normalizer            2.1.0
cheroot                       8.6.0
click                         8.1.3
colorama                      0.4.5
cryptography                  37.0.4
dateparser                    1.1.1
Flask                         2.2.2
Flask-RESTful                 0.3.9
frozenlist                    1.3.1
idna                          3.3
importlib-metadata            4.12.0
itsdangerous                  2.1.2
jaraco.functools              3.5.1
Jinja2                        3.1.2
MarkupSafe                    2.1.1
more-itertools                8.14.0
multidict                     6.0.2
numpy                         1.21.6
pandas                        1.3.5
pip                           22.2.2
psutil                        5.9.1
pyasn1                        0.4.8
pyasn1-modules                0.2.8
pycparser                     2.21
pyOpenSSL                     22.0.0
python-binance                1.0.16
python-dateutil               2.8.2
pytz                          2022.2.1
pytz-deprecation-shim         0.1.0.post0
regex                         2022.3.2
requests                      2.28.1
service-identity              21.1.0
setuptools                    47.1.0
six                           1.16.0
typing_extensions             4.3.0
tzdata                        2022.2
tzlocal                       4.2
ujson                         5.4.0
unicorn-binance-rest-api      1.5.0
unicorn-binance-websocket-api 1.41.0
unicorn-fy                    0.12.2
urllib3                       1.26.11
websocket-client              1.3.3
websockets                    10.3
Werkzeug                      2.2.2
yarl                          1.8.1

Logging output

2022-08-31 19:30:18,311 ERROR    PID:4528 TID:4976 [BINANCE_FUTURE_TEST_BOT_BNBBUSD.py:220] ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\urllib3\connectionpool.py", line 710, in urlopen
    chunked=chunked,
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\urllib3\connectionpool.py", line 449, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\urllib3\connectionpool.py", line 444, in _make_request
    httplib_response = conn.getresponse()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 1369, in getresponse
    response.begin()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 310, in begin
    version, status, reason = self._read_status()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 279, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\requests\adapters.py", line 499, in send
    timeout=timeout,
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\urllib3\connectionpool.py", line 788, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\urllib3\util\retry.py", line 550, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\urllib3\packages\six.py", line 769, in reraise
    raise value.with_traceback(tb)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\urllib3\connectionpool.py", line 710, in urlopen
    chunked=chunked,
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\urllib3\connectionpool.py", line 449, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\urllib3\connectionpool.py", line 444, in _make_request
    httplib_response = conn.getresponse()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 1369, in getresponse
    response.begin()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 310, in begin
    version, status, reason = self._read_status()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 279, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "C:\Users\Administrator\Desktop\BINANCE_FUTURES_TEST_BOT\BINANCE_FUTURE_TEST_BOT_BNBBUSD.py", line 204, in create_order
    price=price, quantity=qty, timeInForce='GTX')
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\unicorn_binance_rest_api\manager.py", line 5777, in futures_create_order
    return self._request_futures_api('post', 'order', True, data=params)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\unicorn_binance_rest_api\manager.py", line 470, in _request_futures_api
    return self._request(method, uri, signed, True, **kwargs)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\unicorn_binance_rest_api\manager.py", line 449, in _request
    self.response = getattr(self.session, method)(uri, **kwargs)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\requests\sessions.py", line 635, in post
    return self.request("POST", url, data=data, json=json, **kwargs)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\requests\sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\requests\sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\requests\adapters.py", line 547, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

Used endpoint?

binance.com-futures

Issue

I am testing a script that buys and sells cryptos on Binance Futures, every morning I check the bot's logs and I find the error described in the issue, I don't know what the reasons were or could be

Margin testnet still working?

Looking to test some margin functions like loan creation and repayment, so I set the exchange to 'binance.com-margin-testnet'

However when I make a request for something like get_margin_account, it raises an exception due to incorrect API key.

I used keys generated here : https://testnet.binance.vision/ which is the URL pointed to in the docs for the binance margin testnet.

Given this testnet was added to the library two years ago, I am now wondering if the margin testnet is even still available? How are you all testing margin functionality short of doing it live on testnet?

Thanks for the great library!

SOCKS5 Proxy Support

Is your feature request related to a problem? Please describe.

No response

Describe the solution you'd like.

No response

Describe alternatives you've considered

No response

Additional context

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.