Update app.py
Browse files
app.py
CHANGED
@@ -20,8 +20,6 @@ def get_data():
|
|
20 |
response = requests.get('https://api.binance.com/api/v3/klines', params=params)
|
21 |
data = response.json()
|
22 |
|
23 |
-
print(f"API Response: {data}") # Print the API response
|
24 |
-
|
25 |
if data: # Check if data is present
|
26 |
try:
|
27 |
df = pd.DataFrame(data, columns=['open_time', 'open', 'high', 'low', 'close', 'volume', 'close_time', 'quote_asset_volume', 'number_of_trades', 'taker_buy_base_asset_volume', 'taker_buy_quote_asset_volume', 'ignore'])
|
@@ -37,7 +35,7 @@ def get_data():
|
|
37 |
st.error("Data not found in the API response.")
|
38 |
return None
|
39 |
|
40 |
-
df = pd.concat(df_list)
|
41 |
return df
|
42 |
|
43 |
if st.button("Fetch historical data"):
|
@@ -49,3 +47,4 @@ if st.button("Fetch historical data"):
|
|
49 |
# Save historical data to btcusdt_data.pkl
|
50 |
df.to_pickle('btcusdt_data.pkl')
|
51 |
st.write("Data fetched successfully and saved to btcusdt_data.pkl")
|
|
|
|
20 |
response = requests.get('https://api.binance.com/api/v3/klines', params=params)
|
21 |
data = response.json()
|
22 |
|
|
|
|
|
23 |
if data: # Check if data is present
|
24 |
try:
|
25 |
df = pd.DataFrame(data, columns=['open_time', 'open', 'high', 'low', 'close', 'volume', 'close_time', 'quote_asset_volume', 'number_of_trades', 'taker_buy_base_asset_volume', 'taker_buy_quote_asset_volume', 'ignore'])
|
|
|
35 |
st.error("Data not found in the API response.")
|
36 |
return None
|
37 |
|
38 |
+
df = pd.concat(df_list, ignore_index=True)
|
39 |
return df
|
40 |
|
41 |
if st.button("Fetch historical data"):
|
|
|
47 |
# Save historical data to btcusdt_data.pkl
|
48 |
df.to_pickle('btcusdt_data.pkl')
|
49 |
st.write("Data fetched successfully and saved to btcusdt_data.pkl")
|
50 |
+
|