Download app.py from Pezh/Sos: direct link, hf CLI and curl.
- Browser
- Download file 836 Bytes
-
https://huggingface.co/spaces/Pezh/Sos/resolve/main/app.py
- Command line
-
hf download hf://spaces/Pezh/Sos/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Pezh/Sos/resolve/main/app.py
836 Bytes
| 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) |