rosacastillo commited on
Commit
be3f31a
·
1 Parent(s): f7c2ff7

Added check for unknown traders size

Browse files
Files changed (1) hide show
  1. app.py +29 -28
app.py CHANGED
@@ -303,40 +303,41 @@ with demo:
303
  outputs=[trade_no_details_plot],
304
  )
305
  # Unknown traders graph
306
- with gr.Row():
307
- gr.Markdown(
308
- "# Weekly trading metrics for trades coming from unknown traders"
309
- )
310
- with gr.Row():
311
- trade_u_details_selector = gr.Dropdown(
312
- label="Select a trade metric",
313
- choices=trade_metric_choices,
314
- value=default_trade_metric,
315
- )
 
316
 
317
- with gr.Row():
318
- with gr.Column(scale=3):
319
- trade_u_details_plot = plot_trade_metrics(
320
- metric_name=default_trade_metric,
 
 
 
 
 
 
 
 
 
321
  trades_df=unknown_trades,
322
  trader_filter="all",
323
  )
324
- with gr.Column(scale=1):
325
- trade_details_text = get_trade_metrics_text()
326
 
327
- def update_na_trade_details(trade_detail, trade_u_details_plot):
328
- new_u_plot = plot_trade_metrics(
329
- metric_name=trade_detail,
330
- trades_df=unknown_trades,
331
- trader_filter="all",
332
  )
333
- return new_u_plot
334
-
335
- trade_u_details_selector.change(
336
- update_na_trade_details,
337
- inputs=[trade_u_details_selector, trade_u_details_plot],
338
- outputs=[trade_u_details_plot],
339
- )
340
 
341
  with gr.TabItem("🔒 Staking traders"):
342
  with gr.Row():
 
303
  outputs=[trade_no_details_plot],
304
  )
305
  # Unknown traders graph
306
+ if len(unknown_trades) > 0:
307
+ with gr.Row():
308
+ gr.Markdown(
309
+ "# Weekly trading metrics for trades coming from unknown traders"
310
+ )
311
+ with gr.Row():
312
+ trade_u_details_selector = gr.Dropdown(
313
+ label="Select a trade metric",
314
+ choices=trade_metric_choices,
315
+ value=default_trade_metric,
316
+ )
317
 
318
+ with gr.Row():
319
+ with gr.Column(scale=3):
320
+ trade_u_details_plot = plot_trade_metrics(
321
+ metric_name=default_trade_metric,
322
+ trades_df=unknown_trades,
323
+ trader_filter="all",
324
+ )
325
+ with gr.Column(scale=1):
326
+ trade_details_text = get_trade_metrics_text()
327
+
328
+ def update_na_trade_details(trade_detail, trade_u_details_plot):
329
+ new_u_plot = plot_trade_metrics(
330
+ metric_name=trade_detail,
331
  trades_df=unknown_trades,
332
  trader_filter="all",
333
  )
334
+ return new_u_plot
 
335
 
336
+ trade_u_details_selector.change(
337
+ update_na_trade_details,
338
+ inputs=[trade_u_details_selector, trade_u_details_plot],
339
+ outputs=[trade_u_details_plot],
 
340
  )
 
 
 
 
 
 
 
341
 
342
  with gr.TabItem("🔒 Staking traders"):
343
  with gr.Row():