File size: 836 Bytes
9d94dbd 6e7cb61 cd23c51 9d94dbd 6e7cb61 a474395 9d94dbd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import requests
import json
import streamlit as st
import pandas as pd
# Replace 'YOUR_ACCESS_ID' and 'YOUR_SECRET_ID' with your actual access and secret IDs from CoinEx
access_id = 'D94B4CB6F92B48B981187C1B573DD3C2'
secret_id = 'D94B4CB6F92B48B981187C1B573DD3C2'
url = 'https://api.coinex.com/v1/market/kline?market=btcusdt&type=1hour&limit=2000'
headers = {
'Content-Type': 'application/json',
'User-Agent': 'Your User Agent',
'AccessId': access_id,
'SecretId': secret_id
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
data = response.json()
# Process the data as per your requirements
#print(data)
#data = response.json()
df = pd.DataFrame(data['data'])
#return df
st.write(df)
else:
print('Error fetching data. Status code:', response.status_code) |