Spaces:
Runtime error
Runtime error
cyberosa
commited on
Commit
Β·
652d8f6
1
Parent(s):
e9aa873
check if unknown data has rows
Browse files
app.py
CHANGED
|
@@ -142,10 +142,11 @@ weekly_metrics_by_market_creator = compute_weekly_metrics_by_market_creator(
|
|
| 142 |
weekly_non_olas_metrics_by_market_creator = compute_weekly_metrics_by_market_creator(
|
| 143 |
traders_data, trader_filter="non_Olas"
|
| 144 |
)
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
)
|
|
|
|
| 149 |
|
| 150 |
weekly_winning_metrics = compute_winning_metrics_by_trader(traders_data=traders_data)
|
| 151 |
weekly_non_olas_winning_metrics = compute_winning_metrics_by_trader(
|
|
@@ -252,35 +253,36 @@ with demo:
|
|
| 252 |
outputs=trader_no_markets_plot,
|
| 253 |
)
|
| 254 |
# Unknown traders graph
|
| 255 |
-
|
| 256 |
-
gr.
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
|
|
|
| 263 |
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 268 |
traders_df=weekly_unknown_trader_metrics_by_market_creator,
|
| 269 |
)
|
| 270 |
-
with gr.Column(scale=1):
|
| 271 |
-
trade_details_text = get_metrics_text()
|
| 272 |
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
)
|
| 278 |
-
|
| 279 |
-
trader_u_details_selector.change(
|
| 280 |
-
update_u_trader_details,
|
| 281 |
-
inputs=trader_u_details_selector,
|
| 282 |
-
outputs=trader_u_markets_plot,
|
| 283 |
-
)
|
| 284 |
with gr.TabItem("π
Daily metrics"):
|
| 285 |
current_week_trades = get_current_week_data(trades_df=traders_data)
|
| 286 |
live_trades_current_week = get_current_week_data(trades_df=daily_info)
|
|
|
|
| 142 |
weekly_non_olas_metrics_by_market_creator = compute_weekly_metrics_by_market_creator(
|
| 143 |
traders_data, trader_filter="non_Olas"
|
| 144 |
)
|
| 145 |
+
weekly_unknown_trader_metrics_by_market_creator = None
|
| 146 |
+
if len(unknown_traders) > 0:
|
| 147 |
+
weekly_unknown_trader_metrics_by_market_creator = (
|
| 148 |
+
compute_weekly_metrics_by_market_creator(unknown_traders)
|
| 149 |
+
)
|
| 150 |
|
| 151 |
weekly_winning_metrics = compute_winning_metrics_by_trader(traders_data=traders_data)
|
| 152 |
weekly_non_olas_winning_metrics = compute_winning_metrics_by_trader(
|
|
|
|
| 253 |
outputs=trader_no_markets_plot,
|
| 254 |
)
|
| 255 |
# Unknown traders graph
|
| 256 |
+
if weekly_unknown_trader_metrics_by_market_creator is not None:
|
| 257 |
+
with gr.Row():
|
| 258 |
+
gr.Markdown("# Weekly metrics of Unknown traders")
|
| 259 |
+
with gr.Row():
|
| 260 |
+
trader_u_details_selector = gr.Dropdown(
|
| 261 |
+
label="Select a weekly trader metric",
|
| 262 |
+
choices=trader_metric_choices,
|
| 263 |
+
value=default_trader_metric,
|
| 264 |
+
)
|
| 265 |
|
| 266 |
+
with gr.Row():
|
| 267 |
+
with gr.Column(scale=3):
|
| 268 |
+
trader_u_markets_plot = plot_trader_metrics_by_market_creator(
|
| 269 |
+
metric_name=default_trader_metric,
|
| 270 |
+
traders_df=weekly_unknown_trader_metrics_by_market_creator,
|
| 271 |
+
)
|
| 272 |
+
with gr.Column(scale=1):
|
| 273 |
+
trade_details_text = get_metrics_text()
|
| 274 |
+
|
| 275 |
+
def update_u_trader_details(trader_detail):
|
| 276 |
+
return plot_trader_metrics_by_market_creator(
|
| 277 |
+
metric_name=trader_detail,
|
| 278 |
traders_df=weekly_unknown_trader_metrics_by_market_creator,
|
| 279 |
)
|
|
|
|
|
|
|
| 280 |
|
| 281 |
+
trader_u_details_selector.change(
|
| 282 |
+
update_u_trader_details,
|
| 283 |
+
inputs=trader_u_details_selector,
|
| 284 |
+
outputs=trader_u_markets_plot,
|
| 285 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 286 |
with gr.TabItem("π
Daily metrics"):
|
| 287 |
current_week_trades = get_current_week_data(trades_df=traders_data)
|
| 288 |
live_trades_current_week = get_current_week_data(trades_df=daily_info)
|