Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import requests
|
2 |
+
import json
|
3 |
+
|
4 |
+
# Replace 'YOUR_ACCESS_ID' and 'YOUR_SECRET_ID' with your actual access and secret IDs from CoinEx
|
5 |
+
access_id = 'D94B4CB6F92B48B981187C1B573DD3C2'
|
6 |
+
secret_id = 'D94B4CB6F92B48B981187C1B573DD3C2'
|
7 |
+
|
8 |
+
url = 'https://api.coinex.com/v1/market/kline?market=btcusdt&type=1hour&limit=2000'
|
9 |
+
|
10 |
+
headers = {
|
11 |
+
'Content-Type': 'application/json',
|
12 |
+
'User-Agent': 'Your User Agent',
|
13 |
+
'AccessId': access_id,
|
14 |
+
'SecretId': secret_id
|
15 |
+
}
|
16 |
+
|
17 |
+
response = requests.get(url, headers=headers)
|
18 |
+
|
19 |
+
if response.status_code == 200:
|
20 |
+
data = response.json()
|
21 |
+
# Process the data as per your requirements
|
22 |
+
print(data)
|
23 |
+
else:
|
24 |
+
print('Error fetching data. Status code:', response.status_code)
|