Update app.py
Browse files
app.py
CHANGED
@@ -19,13 +19,13 @@ def get_data():
|
|
19 |
response = requests.get('https://api.coinex.com/v1/market/kline/BTCUSDT', params=params)
|
20 |
data = response.json()
|
21 |
|
|
|
|
|
22 |
if 'data' in data:
|
23 |
try:
|
24 |
-
keys = data['data'][0].keys()
|
25 |
-
st.write(keys) # Print out the keys in the data
|
26 |
df = pd.DataFrame(data['data'])
|
27 |
-
#
|
28 |
-
timestamp_key = 'time'
|
29 |
df[timestamp_key] = pd.to_datetime(df[timestamp_key], unit='ms')
|
30 |
df.set_index(timestamp_key, inplace=True)
|
31 |
df.drop(['vol', 'amount'], axis=1, inplace=True)
|
|
|
19 |
response = requests.get('https://api.coinex.com/v1/market/kline/BTCUSDT', params=params)
|
20 |
data = response.json()
|
21 |
|
22 |
+
st.write(data) # Print out the entire data dictionary
|
23 |
+
|
24 |
if 'data' in data:
|
25 |
try:
|
|
|
|
|
26 |
df = pd.DataFrame(data['data'])
|
27 |
+
# Access the data keys based on the actual structure of the data dictionary
|
28 |
+
timestamp_key = 'time' # Adjust this based on the structure
|
29 |
df[timestamp_key] = pd.to_datetime(df[timestamp_key], unit='ms')
|
30 |
df.set_index(timestamp_key, inplace=True)
|
31 |
df.drop(['vol', 'amount'], axis=1, inplace=True)
|