Package: unicorn-binance-rest-api
UNICORN Binance REST APIDescription|Installation|How To|Documentation|Examples|Change Log|Wiki|Social|Notifications|Bugs|Contributing|Disclaimer|Commercial SupportAn unofficial Python API to use the Binance REST API`s (com+testnet, com-margin+testnet, com-isolated_margin+testnet,
com-futures+testnet, us, tr) in a easy, fast, flexible, robust and fully-featured way.Part of'UNICORN Binance Suite'.Get a UNICORN Binance Suite LicenseTo run modules of theUNICORN Binance Suiteyou need avalid license!Receive Data from Binance REST API EndpointsInitiateBinanceRestApiManager()from unicorn_binance_rest_api.manager import BinanceRestApiManager

ubra = BinanceRestApiManager(api_key="YOUR_BINANCE_API_KEY", 
                             api_secret="YOUR_BINANCE_API_SECRET", 
                             exchange="binance.com")Print a snapshot of an order bookprint(f"BNBBTC order book: {ubra.get_order_book(symbol='BNBBTC')}")Get all symbol pricesprint(f"All tickers:\r\n{ubra.get_all_tickers()}")Get the used weightPlease Note:https://github.com/binance-us/binance-official-api-docs/blob/master/rest-api.md#limitsprint(f"Used weight: {ubra.get_used_weight()}")Send data to Binance REST API EndpointsInitiateBinanceRestApiManager()ubra = BinanceRestApiManager(api_key="YOUR_BINANCE_API_KEY", 
                             api_secret="YOUR_BINANCE_API_SECRET", 
                             exchange="binance.com-isolated_margin")Buy BTC with a market order using 100 USDTbuy_order = ubra.create_margin_order(symbol="BTCUSDT",
                                     isIsolated="TRUE",
                                     side="BUY",
                                     type="MARKET",
                                     quoteOrderQty=100)
print(f"Buy Order Result: {buy_order}")Stopubraafter usage to avoid memory leaksubra.stop_manager()DescriptionThis is a fork of Sam McHardy`spython-binance 0.7.10- package.
Extended, cleaned up and reduced to pure REST tasks, with PRs added and improved. No asyncio support!!The Python moduleUNICORN Binance REST APIprovides an API to the Binance REST API`s ofBinance(+Testnet),Binance Margin(+Testnet),Binance Isolated Margin(+Testnet),Binance Futures(+Testnet),Binance COIN-M Futures,Binance USandBinance TRand needs to be used with a validapi_key and api_secretfrom the Binance Exchangewww.binance.com,testnet.binance.visionorwww.binance.us.Be aware that the Binance REST API is request based. if you want to send and receive high frequency and high volume
data, you can use theUNICORN Binance Websocket APIin
combination.What are the benefits of the UNICORN Binance REST API?Supported exchanges:ExchangeExchange stringBinancebinance.comBinance Testnetbinance.com-testnetBinance Marginbinance.com-marginBinance Margin Testnetbinance.com-margin-testnetBinance Isolated Marginbinance.com-isolated_marginBinance Isolated Margin Testnetbinance.com-isolated_margin-testnetBinance USD-M Futuresbinance.com-futuresBinance USD-M Futures Testnetbinance.com-futures-testnetBinance Coin-M Futuresbinance.com-coin_futuresBinance USbinance.usBinance TRtrbinance.comHelpful management features likeget_used_weight(),Integration oftest casesandexamples.Customizable base URL and request timeout.Socks5 Proxysupport:ubra = BinanceRestApiManager(exchange="binance.com", socks5_proxy_server="127.0.0.1:9050")Read thedocsor thishow tofor more information or tryexample_socks5_proxy.py.Excessively tested on Linux, Mac and WindowsIf you like the project, pleaseit onGitHub!Installation and UpgradeThe module requires Python 3.7 or above, as it depends on Pythons latest asyncio features for asynchronous/concurrent
processing.For the PyPy interpreter we offer packages only from Python version 3.9 and higher.The current dependencies are listedhere.If you run into errors during the installation take a lookhere.A Cython binary, PyPy or source code based CPython wheel of the latest version withpipfromPyPIOurCythonandPyPyWheels are available onPyPI,
these wheels offer significant advantages for Python developers:Performance Boost with Cython Wheels:Cython is a programming language that supplements Python with static typing and C-level performance. By compiling
Python code into C, Cython Wheels can significantly enhance the execution speed of Python code, especially in
computationally intensive tasks. This means faster runtimes and more efficient processing for users of our package.PyPy Wheels for Enhanced Efficiency:PyPy is an alternative Python interpreter known for its speed and efficiency. It uses Just-In-Time (JIT) compilation,
which can dramatically improve the performance of Python code. Our PyPy Wheels are tailored for compatibility with
PyPy, allowing users to leverage this speed advantage seamlessly.Both Cython and PyPy Wheels on PyPI make the installation process simpler and more straightforward. They ensure that
you get the optimized version of our package with minimal setup, allowing you to focus on development rather than
configuration.Installationpip install unicorn-binance-rest-apiUpdatepip install unicorn-binance-rest-api --upgradeA Conda Package of the latest version withcondafromAnacondaTheunicorn-binance-rest-apipackage is also available as a Cython version for thelinux-64,osx-64andwin-64architectures withCondathrough thelucitchannel.For optimal compatibility and performance, it is recommended to source the necessary dependencies from theconda-forgechannel.Installationconda config --add channels conda-forge
conda config --add channels lucit
conda install -c lucit unicorn-binance-rest-apiUpdateconda update -c lucit unicorn-binance-rest-apiFrom source of the latest release with PIP fromGithubLinux, macOS, ...Run in bash:pip install https://github.com/LUCIT-Systems-and-Development/unicorn-binance-rest-api/archive/$(curl -s https://api.github.com/repos/lucit-systems-and-development/unicorn-binance-rest-api/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")').tar.gz --upgradeWindowsUse the below command with the version (such as 2.2.0) you determinedhere:pip install https://github.com/LUCIT-Systems-and-Development/unicorn-binance-rest-api/archive/2.2.0.tar.gz --upgradeFrom the latest source (dev-stage) with PIP fromGithubThis is not a release version and can not be considered to be stable!pip install https://github.com/LUCIT-Systems-and-Development/unicorn-binance-rest-api/tarball/master --upgradeConda environment,Virtualenvor plainPythonDownload thelatest releaseor thecurrent master branchand use:./environment.yml./meta.yaml./pyproject.toml./requirements.txt./setup.pyChange Loghttps://unicorn-binance-rest-api.docs.lucit.tech/changelog.htmlDocumentationGeneralModulesExamplesexample_buy_and_sell_oco_order_isolated_margin.pyexample_doing_something.pyexample_easy_migration_from_python-binance.pyexample_historical_data.pyexample_logging.pyexample_orders.pyexample_socks5_proxy.pyexample_version_of_this_package.pyHowtoHow to Obtain and Use a Unicorn Binance Suite License Key and Run the UBS Module According to Best PracticeRestful Binance Requests in Python with UNICORN Binance REST APIHow to Download Klines from Binance using Python?How to Connect to binance.com REST API using Python via a SOCKS5 ProxyBuy an Asset and instantly create a Take Profit and Stop Loss OCO Sell Order using Python in Binance Isolated MarginProject Homepagehttps://github.com/LUCIT-Systems-and-Development/unicorn-binance-rest-apiWikihttps://github.com/LUCIT-Systems-and-Development/unicorn-binance-rest-api/wikiSocialDiscussionshttps://t.me/unicorndevshttps://dev.binance.visionhttps://community.binance.orgReceive NotificationsTo receive notifications on available updates you canthe repository onGitHub, write yourown scriptwith usingis_update_availabe().Follow us onGitHub,Medium,YouTube,LinkedIn,XorFacebook!To receive news (like inspection windows/maintenance) about the Binance API`s subscribe to their telegram groups:https://t.me/binance_api_announcementshttps://t.me/binance_api_englishhttps://t.me/Binance_USAhttps://t.me/TRBinanceTRhttps://t.me/BinanceDEXchangehttps://t.me/BinanceExchangeHow to report Bugs or suggest Improvements?List of planned features-
clickif you need one of them or suggest a new feature!Before you report a bug,try the latest release. If the issue still exists, provide the error trace, OS
and Python version and explain how to reproduce the error. A demo script is appreciated.If you dont find an issue related to your topic, please open a newissue!Report a security bug!ContributingUNICORN Binance REST APIis an open
source project which welcomes contributions which can be anything from simple documentation fixes and reporting dead links to new features. To
contribute followthis guide.ContributorsWeopen source!DisclaimerThis project is for informational purposes only. You should not construe this information or any other material as
legal, tax, investment, financial or other advice. Nothing contained herein constitutes a solicitation, recommendation,
endorsement or offer by us or any third party provider to buy or sell any securities or other financial instruments in
this or any other jurisdiction in which such solicitation or offer would be unlawful under the securities laws of such
jurisdiction.If you intend to use real money, use it at your own risk!Under no circumstances will we be responsible or liable for any claims, damages, losses, expenses, costs or liabilities
of any kind, including but not limited to direct or indirect damages for loss of profits.SOCKS5 Proxy / GeoblockingWe would like to explicitly point out that in our opinion US citizens are exclusively authorized to trade on Binance.US
and that this restriction must not be circumvented!The purpose of supporting a SOCKS5 proxy in the UNICORN Binance Suite and its modules is to allow non-US citizens to use
US services. For example, Github actions with UBS will not work without a SOCKS5 proxy, as they will inevitably run on
servers in the US and be blocked by Binance.com. Moreover, it also seems justified that traders, data scientists and
companies from the US analyze binance.com market data - as long as they do not trade there.Commercial SupportDo you need a developer, operator or consultant?Contact usfor a non-binding initial consultation!