Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

real time crypto prices python

# Import libraries
import json
import requests
  
# Defining Binance API URL
key = "https://api.binance.com/api/v3/ticker/price?symbol="
  
# Making list for multiple crypto's
currencies = ["BTCUSDT", "DOGEUSDT", "LTCUSDT"]
j = 0
  
# running loop to print all crypto prices
for i in currencies:
    
    # completing API for request
    url = key+currencies[j]  
    data = requests.get(url)
    data = data.json()
    j = j+1
    print(f"{data['symbol']} price is {data['price']}")
Comment

PREVIOUS NEXT
Code Example
Python :: ValueError: Shapes (None, 1) and (None, 11) are incompatible keras 
Python :: normalize data python 
Python :: Creating virtual environments 
Python :: python - removeempy space in a cell 
Python :: Network.py socket 
Python :: python number divisible by two other numbers 
Python :: pandas iterate columns 
Python :: random hex color python 
Python :: cv2 yellow color range 
Python :: how to copy one dictionary to another in python 
Python :: display Surface quit 
Python :: two loop type python 
Python :: all alphanumeric characters for python python 
Python :: one hot encoding numpy 
Python :: pop vs remove python 
Python :: Django - include app urls 
Python :: pandas remove item from dictionary 
Python :: set image size mapltotlib pyplot 
Python :: how to print hello world 
Python :: slack send message python 
Python :: colab add package 
Python :: Converting utc time string to datetime object python 
Python :: pandas series to numpy array 
Python :: taking string input from user in python with try except 
Python :: np.hstack 
Python :: matplotlib plot 2d point 
Python :: create models in django 
Python :: python list abstraction 
Python :: python remove form list 
Python :: how to delete a specific line in a file 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =