41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
#Checks price of flux
|
|
import requests
|
|
|
|
def fluxPrice():
|
|
#URL to send the request to
|
|
url = 'https://api.kucoin.com/api/v1/market/orderbook/level1?symbol=FLUX-USDT'
|
|
headers = ''
|
|
#Looks only for the price data
|
|
params = {'price': ''}
|
|
|
|
#result calculcation
|
|
result = requests.get(url=url, params=params)
|
|
jsonResult = result.json()
|
|
#fluxPrice =
|
|
#Finds the json data with the "data" category, then looks for "price"
|
|
price = jsonResult["data"]["price"]
|
|
#Maps to a dict that will be returned to the API
|
|
#price = {'Flux': price}
|
|
#print(price)
|
|
|
|
return price
|
|
|
|
def prePrice():
|
|
#URL to send the request to
|
|
url = 'https://api.kucoin.com/api/v1/market/orderbook/level1?symbol=PRE-USDT'
|
|
headers = ''
|
|
#Looks only for the price data
|
|
params = {'price': ''}
|
|
|
|
#result calculcation
|
|
result = requests.get(url=url, params=params)
|
|
jsonResult = result.json()
|
|
#fluxPrice =
|
|
#Finds the json data with the "data" category, then looks for "price"
|
|
price = jsonResult["data"]["price"]
|
|
#Maps to a dict that will be returned to the API
|
|
#price = {'Flux': price}
|
|
#print(price)
|
|
|
|
return price
|