cyberosa
commited on
Commit
Β·
b65d0e3
1
Parent(s):
57d4408
restoring daily tab
Browse files
app.py
CHANGED
@@ -214,108 +214,112 @@ with demo:
|
|
214 |
# outputs=trader_u_markets_plot,
|
215 |
# )
|
216 |
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
|
|
|
|
233 |
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
)
|
240 |
-
|
241 |
-
trade_details_text = get_metrics_text(daily=True)
|
242 |
|
243 |
-
|
244 |
-
|
245 |
-
|
|
|
246 |
)
|
247 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
248 |
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
o_trader_live_details_selector = gr.Dropdown(
|
259 |
-
label="Select a daily live metric",
|
260 |
-
choices=trader_daily_metric_choices,
|
261 |
-
value=default_daily_metric,
|
262 |
-
)
|
263 |
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
metric_name=default_daily_metric,
|
268 |
trades_df=live_metrics_by_market_creator,
|
269 |
trader_filter="Olas",
|
270 |
)
|
271 |
-
|
272 |
-
trade_details_text = get_metrics_text(daily=True)
|
273 |
-
|
274 |
-
def update_a_trader_live_details(trade_detail, a_trader_live_details_plot):
|
275 |
-
o_trader_plot = plot_daily_metrics(
|
276 |
-
metric_name=trade_detail,
|
277 |
-
trades_df=live_metrics_by_market_creator,
|
278 |
-
trader_filter="Olas",
|
279 |
-
)
|
280 |
-
return o_trader_plot
|
281 |
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
)
|
287 |
-
with gr.Row():
|
288 |
-
gr.Markdown("# Daily live metrics for Non-Olas traders")
|
289 |
-
with gr.Row():
|
290 |
-
no_trader_live_details_selector = gr.Dropdown(
|
291 |
-
label="Select a daily live metric",
|
292 |
-
choices=trader_daily_metric_choices,
|
293 |
-
value=default_daily_metric,
|
294 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
295 |
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
300 |
trades_df=live_metrics_by_market_creator,
|
301 |
trader_filter="non_Olas",
|
302 |
)
|
303 |
-
|
304 |
-
trade_details_text = get_metrics_text(daily=True)
|
305 |
-
|
306 |
-
def update_na_trader_live_details(trade_detail, no_trader_live_details_plot):
|
307 |
-
no_trader_plot = plot_daily_metrics(
|
308 |
-
metric_name=trade_detail,
|
309 |
-
trades_df=live_metrics_by_market_creator,
|
310 |
-
trader_filter="non_Olas",
|
311 |
-
)
|
312 |
-
return no_trader_plot
|
313 |
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
with gr.TabItem(" Agent metrics"):
|
320 |
with gr.Row():
|
321 |
gr.Markdown(" # Daily active Pearl agents")
|
|
|
214 |
# outputs=trader_u_markets_plot,
|
215 |
# )
|
216 |
|
217 |
+
with gr.TabItem("π
Daily metrics (WIP)"):
|
218 |
+
live_trades_current_week = get_current_week_data(trades_df=daily_info)
|
219 |
+
if len(live_trades_current_week) > 0:
|
220 |
+
live_metrics_by_market_creator = (
|
221 |
+
compute_daily_metrics_by_market_creator(
|
222 |
+
live_trades_current_week, trader_filter=None, live_metrics=True
|
223 |
+
)
|
224 |
+
)
|
225 |
+
else:
|
226 |
+
live_metrics_by_market_creator = pd.DataFrame()
|
227 |
+
with gr.Row():
|
228 |
+
gr.Markdown("# Daily live metrics for all trades")
|
229 |
+
with gr.Row():
|
230 |
+
trade_live_details_selector = gr.Dropdown(
|
231 |
+
label="Select a daily live metric",
|
232 |
+
choices=trader_daily_metric_choices,
|
233 |
+
value=default_daily_metric,
|
234 |
+
)
|
235 |
|
236 |
+
with gr.Row():
|
237 |
+
with gr.Column(scale=3):
|
238 |
+
trade_live_details_plot = plot_daily_metrics(
|
239 |
+
metric_name=default_daily_metric,
|
240 |
+
trades_df=live_metrics_by_market_creator,
|
241 |
+
)
|
242 |
+
with gr.Column(scale=1):
|
243 |
+
trade_details_text = get_metrics_text(daily=True)
|
244 |
+
|
245 |
+
def update_trade_live_details(trade_detail, trade_live_details_plot):
|
246 |
+
new_a_plot = plot_daily_metrics(
|
247 |
+
metric_name=trade_detail, trades_df=live_metrics_by_market_creator
|
248 |
)
|
249 |
+
return new_a_plot
|
|
|
250 |
|
251 |
+
trade_live_details_selector.change(
|
252 |
+
update_trade_live_details,
|
253 |
+
inputs=[trade_live_details_selector, trade_live_details_plot],
|
254 |
+
outputs=[trade_live_details_plot],
|
255 |
)
|
256 |
+
# Olas traders
|
257 |
+
with gr.Row():
|
258 |
+
gr.Markdown("# Daily live metrics for π Olas traders")
|
259 |
+
with gr.Row():
|
260 |
+
o_trader_live_details_selector = gr.Dropdown(
|
261 |
+
label="Select a daily live metric",
|
262 |
+
choices=trader_daily_metric_choices,
|
263 |
+
value=default_daily_metric,
|
264 |
+
)
|
265 |
|
266 |
+
with gr.Row():
|
267 |
+
with gr.Column(scale=3):
|
268 |
+
o_trader_live_details_plot = plot_daily_metrics(
|
269 |
+
metric_name=default_daily_metric,
|
270 |
+
trades_df=live_metrics_by_market_creator,
|
271 |
+
trader_filter="Olas",
|
272 |
+
)
|
273 |
+
with gr.Column(scale=1):
|
274 |
+
trade_details_text = get_metrics_text(daily=True)
|
|
|
|
|
|
|
|
|
|
|
275 |
|
276 |
+
def update_a_trader_live_details(trade_detail, a_trader_live_details_plot):
|
277 |
+
o_trader_plot = plot_daily_metrics(
|
278 |
+
metric_name=trade_detail,
|
|
|
279 |
trades_df=live_metrics_by_market_creator,
|
280 |
trader_filter="Olas",
|
281 |
)
|
282 |
+
return o_trader_plot
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
283 |
|
284 |
+
o_trader_live_details_selector.change(
|
285 |
+
update_a_trader_live_details,
|
286 |
+
inputs=[o_trader_live_details_selector, o_trader_live_details_plot],
|
287 |
+
outputs=[o_trader_live_details_plot],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
288 |
)
|
289 |
+
with gr.Row():
|
290 |
+
gr.Markdown("# Daily live metrics for Non-Olas traders")
|
291 |
+
with gr.Row():
|
292 |
+
no_trader_live_details_selector = gr.Dropdown(
|
293 |
+
label="Select a daily live metric",
|
294 |
+
choices=trader_daily_metric_choices,
|
295 |
+
value=default_daily_metric,
|
296 |
+
)
|
297 |
|
298 |
+
with gr.Row():
|
299 |
+
with gr.Column(scale=3):
|
300 |
+
no_trader_live_details_plot = plot_daily_metrics(
|
301 |
+
metric_name=default_daily_metric,
|
302 |
+
trades_df=live_metrics_by_market_creator,
|
303 |
+
trader_filter="non_Olas",
|
304 |
+
)
|
305 |
+
with gr.Column(scale=1):
|
306 |
+
trade_details_text = get_metrics_text(daily=True)
|
307 |
+
|
308 |
+
def update_na_trader_live_details(
|
309 |
+
trade_detail, no_trader_live_details_plot
|
310 |
+
):
|
311 |
+
no_trader_plot = plot_daily_metrics(
|
312 |
+
metric_name=trade_detail,
|
313 |
trades_df=live_metrics_by_market_creator,
|
314 |
trader_filter="non_Olas",
|
315 |
)
|
316 |
+
return no_trader_plot
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
317 |
|
318 |
+
no_trader_live_details_selector.change(
|
319 |
+
update_na_trader_live_details,
|
320 |
+
inputs=[no_trader_live_details_selector, no_trader_live_details_plot],
|
321 |
+
outputs=[no_trader_live_details_plot],
|
322 |
+
)
|
323 |
with gr.TabItem(" Agent metrics"):
|
324 |
with gr.Row():
|
325 |
gr.Markdown(" # Daily active Pearl agents")
|