infinite scroll fix
This commit is contained in:
@@ -423,13 +423,15 @@ class AnnotationDashboard:
|
||||
|
||||
@self.server.route('/api/chart-data', methods=['POST'])
|
||||
def get_chart_data():
|
||||
"""Get chart data for specified symbol and timeframes"""
|
||||
"""Get chart data for specified symbol and timeframes with infinite scroll support"""
|
||||
try:
|
||||
data = request.get_json()
|
||||
symbol = data.get('symbol', 'ETH/USDT')
|
||||
timeframes = data.get('timeframes', ['1s', '1m', '1h', '1d'])
|
||||
start_time_str = data.get('start_time')
|
||||
end_time_str = data.get('end_time')
|
||||
limit = data.get('limit', 500) # Allow client to request more data
|
||||
direction = data.get('direction', 'latest') # 'latest', 'before', or 'after'
|
||||
|
||||
if not self.data_loader:
|
||||
return jsonify({
|
||||
@@ -445,6 +447,10 @@ class AnnotationDashboard:
|
||||
end_time = datetime.fromisoformat(end_time_str.replace('Z', '+00:00')) if end_time_str else None
|
||||
|
||||
# Fetch data for each timeframe using data loader
|
||||
# This will automatically:
|
||||
# 1. Check DuckDB first
|
||||
# 2. Fetch from API if not in cache
|
||||
# 3. Store in DuckDB for future use
|
||||
chart_data = {}
|
||||
for timeframe in timeframes:
|
||||
df = self.data_loader.get_data(
|
||||
@@ -452,7 +458,8 @@ class AnnotationDashboard:
|
||||
timeframe=timeframe,
|
||||
start_time=start_time,
|
||||
end_time=end_time,
|
||||
limit=500
|
||||
limit=limit,
|
||||
direction=direction
|
||||
)
|
||||
|
||||
if df is not None and not df.empty:
|
||||
|
||||
Reference in New Issue
Block a user