Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -146,7 +146,7 @@ def update_performance_chart(trades):
|
|
146 |
'x_title': 'Month',
|
147 |
'y_title': 'Profit/Loss ($)'
|
148 |
}
|
149 |
-
return gr.LinePlot(value=chart_data
|
150 |
|
151 |
def update_allocation_chart(allocation):
|
152 |
chart_data = {
|
@@ -169,7 +169,7 @@ def update_allocation_chart(allocation):
|
|
169 |
</div>
|
170 |
</div>
|
171 |
""" for i, (label, data) in enumerate(zip(allocation['labels'], allocation['data'])))
|
172 |
-
return gr.PiePlot(value=chart_data
|
173 |
|
174 |
# Main Data Fetch and Update Function
|
175 |
def update_dashboard(api_key, api_secret):
|
@@ -198,7 +198,8 @@ def update_dashboard(api_key, api_secret):
|
|
198 |
except Exception as e:
|
199 |
return (
|
200 |
"$Loading...", 0, "0 Long β’ 0 Short", "$0.00", "Low", "0%", gr.HTML("<tr><td colspan='8' class='py-4 text-center'>Error: Failed to sync with BingX API - Check credentials</td></tr>"),
|
201 |
-
gr.HTML("<div>Error loading stats</div>"), gr.LinePlot(
|
|
|
202 |
)
|
203 |
|
204 |
# Save Credentials Function
|
|
|
146 |
'x_title': 'Month',
|
147 |
'y_title': 'Profit/Loss ($)'
|
148 |
}
|
149 |
+
return gr.LinePlot(value=chart_data)
|
150 |
|
151 |
def update_allocation_chart(allocation):
|
152 |
chart_data = {
|
|
|
169 |
</div>
|
170 |
</div>
|
171 |
""" for i, (label, data) in enumerate(zip(allocation['labels'], allocation['data'])))
|
172 |
+
return gr.PiePlot(value=chart_data), gr.HTML(legend_html)
|
173 |
|
174 |
# Main Data Fetch and Update Function
|
175 |
def update_dashboard(api_key, api_secret):
|
|
|
198 |
except Exception as e:
|
199 |
return (
|
200 |
"$Loading...", 0, "0 Long β’ 0 Short", "$0.00", "Low", "0%", gr.HTML("<tr><td colspan='8' class='py-4 text-center'>Error: Failed to sync with BingX API - Check credentials</td></tr>"),
|
201 |
+
gr.HTML("<div>Error loading stats</div>"), gr.LinePlot(value={'x': [], 'y': [], 'color': [], 'title': 'Monthly Performance'}),
|
202 |
+
(gr.PiePlot(value={'names': [], 'values': [], 'colors': [], 'title': 'Portfolio Allocation'}), gr.HTML("")), "Just now", "Just now"
|
203 |
)
|
204 |
|
205 |
# Save Credentials Function
|