Get Real-time Crypto Price Using Python And Binance API
In this article, we are going to see how to get the real-time price of cryptocurrencies using Binance API in Python.
Binance API is a method that allows you to connect to the Binance servers using several programming languages. With it, you can automate your trading and make HTTP requests to send and receive data.
Here we access Binance API using Python with requests module. We will be sending requests to Binance API and extracting the real-time price of the required cryptocurrency in JSON format. We will use JSON module to convert extracted JSON data to a Python dictionary.
Example 1: Get Crypto Price Using Python And Binance API
Here requests.get() will send a request to a specified URL and save it in data and json() converted data to a Python dictionary.
BTCUSDT price is 41522.20000000
Example 2: Get Multiple Real-time Crypto prices
BTCUSDT price is 41522.20000000 DOGEUSDT price is 0.14710000 LTCUSDT price is 125.00000000