Ethereum binance API Python: How to achieve a special exit
As an automated trading robot developer, you may know the meaning of accurate and reliable data. In this article, we will study how to use Binance API Python to get a special exit from your robotic software.
Prerequisites
Before you dive into the code you must have:
- Binance API Account (Available FREE PLAN)
- The Library of the request installed (
requirements for PIP installation")
- The necessary accreditation data for your Binance API
Example Code: Getting a special order output
Here's an example of obtaining a specific output output from the API BINUCE using Python:
Python
Importing the request
Set your credentials of Binance API
API_KEY = 'YouR_api_key'
API_SECRET = 'Your_api_secret'
Set the end point to order details
EndPoint = f'https: //api.binance.com/api/v3/orderbook/ {symbol}/'
Define a certain way out you want to get (eg "Orderide" and 'ClielinDeridid')
Output_Key = ['Orderid', 'ConderdordDerdd']
Def Get_order_details (Symbol):
Set API Parameters of Requests
parates = {{{{{{{{{{{{{{
'Symbol': symbol,
'Limit': 1
Iche
Ask for API Request
Answer = Request.Get (Destination, Header = {'API-KEY': API_KEY, 'API-SERET': APICTE}, Params = Params)
Verify if the answer is successful
If the answer.status_code == 200:
Parse Json -O's answer
Data = reaction.json ()
Remove and restore special output values
About Key Output_key:
Score = Data.get (Key)
Print (f '{key}: {score}')
Other:
Print (f'arror: {answer.text} ')
Use an example
Symbol = 'BNBBBBTC'
Get_order_details (Symbol)
Explanation
In this example, we set the "Get_order_Details" feature that takes into account the order symbol you want to get as an argument. We use the "Request" library to send a Parameters of Binance API with parameters typical of the order you determine.
The API reaction is cleared like JSON and then repeated with every output value. In this example, we are interested in "Orderide" and 'Conlanderroderide, "so we print them after getting them from Json Data.
Tips and variations
- Adapt a parameter for more or less information to limit the number of orders obtained.
- You can also use other API -ja parameters, such asGet/API/V3/ORDER/{Orderide}
to obtain certain orders information.
- Make sure you replace locations (your_api_key
i
your_api_secret) your actual API -ja -Binance accreditation data.
additional resources
Visit [Binance API documentation] ( for more information about Binance API and certain orders.
By fulfilling this example and using the API Python Binance, you will be able to effectively get a certain output output from your automated trade robot software. Good luck coding!