Update app.py
Browse files
app.py
CHANGED
@@ -19,11 +19,14 @@ def fetch_ohlcv_data(symbol, timeframe, limit):
|
|
19 |
start_time = None
|
20 |
while len(data) < limit:
|
21 |
ohlcv_data = exchange.fetch_ohlcv(symbol, timeframe, since=start_time, limit=limit)
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
24 |
return data
|
25 |
|
26 |
-
|
27 |
def data_to_dataframe(data):
|
28 |
df = pd.DataFrame(data, columns=['timestamp', 'open', 'high', 'low', 'close', 'volume'])
|
29 |
df['timestamp'] = pd.to_datetime(df['timestamp'], unit='ms')
|
|
|
19 |
start_time = None
|
20 |
while len(data) < limit:
|
21 |
ohlcv_data = exchange.fetch_ohlcv(symbol, timeframe, since=start_time, limit=limit)
|
22 |
+
if ohlcv_data:
|
23 |
+
data.extend(ohlcv_data)
|
24 |
+
start_time = ohlcv_data[-1][0] + 1
|
25 |
+
else:
|
26 |
+
print("Warning: No data returned from exchange API")
|
27 |
+
break
|
28 |
return data
|
29 |
|
|
|
30 |
def data_to_dataframe(data):
|
31 |
df = pd.DataFrame(data, columns=['timestamp', 'open', 'high', 'low', 'close', 'volume'])
|
32 |
df['timestamp'] = pd.to_datetime(df['timestamp'], unit='ms')
|