File size: 22,822 Bytes
d8cf478
 
 
1ab360a
d8cf478
 
 
 
efabdf9
6154c13
d8cf478
355fb10
 
 
 
 
d8cf478
1ab360a
d8cf478
 
52d1750
6154c13
dc11fb3
3498a52
f245408
d8cf478
65733ce
 
 
 
 
2206479
0e538d2
 
 
7f9e80f
0e538d2
 
efabdf9
577dd09
 
8704528
577dd09
355fb10
 
 
 
52d1750
d8cf478
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e376aff
 
 
 
 
 
 
8db40cd
09ddc82
 
7bb8323
2dc3f1e
1ab360a
e376aff
2628969
355fb10
1c9dfec
355fb10
1c9dfec
 
18ab870
d8cf478
1ab360a
 
652d8f6
 
 
1ed82ec
0b5bfca
 
 
 
1ed82ec
652d8f6
3035b84
e376aff
 
 
 
 
 
7839697
e376aff
 
 
296080f
 
 
e376aff
7839697
d8cf478
5b74576
 
d8cf478
 
1ab360a
d8cf478
1ab360a
d8cf478
 
efabdf9
d8cf478
 
 
 
 
 
1ab360a
d8cf478
1ab360a
d8cf478
 
cd2003a
d8cf478
 
1ab360a
d8cf478
1ab360a
d8cf478
 
 
 
 
 
 
5b74576
1ab360a
 
 
 
 
 
 
 
 
 
efabdf9
1ab360a
 
 
 
 
 
 
 
efabdf9
1ab360a
 
 
 
 
efabdf9
1ab360a
 
 
 
 
3035b84
1ab360a
 
 
 
 
 
 
 
 
652d8f6
1ab360a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3035b84
1ab360a
 
 
 
 
2206479
b65d0e3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57d4408
b65d0e3
 
 
 
 
 
 
 
 
 
 
 
57d4408
b65d0e3
57d4408
b65d0e3
 
 
 
57d4408
b65d0e3
 
 
 
 
 
 
 
 
57d4408
b65d0e3
 
 
 
 
 
 
 
 
57d4408
b65d0e3
 
 
57d4408
 
 
b65d0e3
57d4408
b65d0e3
 
 
 
57d4408
b65d0e3
 
 
 
 
 
 
 
57d4408
b65d0e3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57d4408
 
 
b65d0e3
57d4408
b65d0e3
 
 
 
 
2206479
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2dc3f1e
 
 
 
65733ce
 
 
 
 
2206479
 
65733ce
7bb8323
65733ce
2206479
7bb8323
355fb10
 
3058723
 
 
3d497f3
3058723
 
 
 
 
 
355fb10
dff5e35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63c3662
e376aff
1c9dfec
 
 
 
3d497f3
 
 
 
 
 
 
 
 
 
63c3662
 
e376aff
 
63c3662
 
 
 
 
 
 
e376aff
 
63c3662
 
 
 
 
 
 
1ab360a
e376aff
63c3662
e376aff
 
63c3662
e376aff
 
63c3662
e376aff
 
 
 
 
 
63c3662
e376aff
63c3662
 
 
 
 
e376aff
 
 
 
 
 
f245408
 
7bb8323
f245408
e376aff
f245408
 
 
 
e376aff
 
f245408
 
 
7bb8323
f245408
e376aff
 
f245408
7f9e80f
8704528
52d1750
 
dc11fb3
52d1750
 
 
12536a4
52d1750
 
12536a4
dc11fb3
330cbe3
 
 
 
dc11fb3
1ab360a
5f0d39e
00d49a3
1ab360a
5f0d39e
00d49a3
5b74576
00d49a3
3498a52
577dd09
 
00d49a3
577dd09
 
3035b84
5b74576
577dd09
3498a52
577dd09
 
00d49a3
577dd09
 
3035b84
5b74576
577dd09
3035b84
1ab360a
8704528
3498a52
1ab360a
8704528
5b74576
8704528
 
5b74576
8704528
3035b84
5b74576
8704528
 
6154c13
 
7839697
dc11fb3
 
6154c13
 
d8cf478
7839697
5b74576
7839697
 
 
e376aff
 
7839697
 
d8cf478
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
import gradio as gr
import pandas as pd
import logging
from scripts.utils import prepare_data


from scripts.metrics import (
    compute_weekly_metrics_by_market_creator,
    compute_daily_metrics_by_market_creator,
    compute_winning_metrics_by_trader,
)
from scripts.retention_metrics import (
    prepare_retention_dataset,
    calculate_wow_retention_by_type,
    calculate_cohort_retention,
)
from tabs.trader_plots import (
    plot_trader_metrics_by_agent_categories,
    default_trader_metric,
    trader_metric_choices,
    get_metrics_text,
    plot_winning_metric_per_trader,
    get_interpretation_text,
    plot_total_bet_amount,
    plot_active_traders,
)
from tabs.agent_graphs import (
    plot_rolling_average_dune,
    plot_rolling_average_roi,
    plot_weekly_average_roi,
)

from tabs.daily_graphs import (
    get_current_week_data,
    plot_daily_metrics,
    trader_daily_metric_choices,
    default_daily_metric,
)
from scripts.utils import get_traders_family
from tabs.market_plots import (
    plot_kl_div_per_market,
    plot_total_bet_amount_per_trader_per_market,
)
from tabs.retention_plots import (
    plot_wow_retention_by_type,
    plot_cohort_retention_heatmap,
)


def get_logger():
    logger = logging.getLogger(__name__)
    logger.setLevel(logging.DEBUG)
    # stream handler and formatter
    stream_handler = logging.StreamHandler()
    stream_handler.setLevel(logging.DEBUG)
    formatter = logging.Formatter(
        "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
    )
    stream_handler.setFormatter(formatter)
    logger.addHandler(stream_handler)
    return logger


logger = get_logger()

(
    traders_data,
    closed_markets,
    daily_info,
    unknown_traders,
    raw_retention_df,
    active_traders,
    all_mech_calls,
    daa_qs_df,
    daa_pearl_df,
    weekly_avg_roi_pearl_agents,
    two_weeks_avg_roi_pearl_agents,
    traders_weekly_metrics_df,
) = prepare_data()

retention_df = prepare_retention_dataset(
    retention_df=raw_retention_df, unknown_df=unknown_traders
)
print("max date of retention df")
print(max(retention_df.creation_timestamp))

demo = gr.Blocks()
# TODO classify traders in the weekly metrics dataframe by agent type (Pearl, QS, and all)

weekly_unknown_trader_metrics_by_market_creator = None
if len(unknown_traders) > 0:
    weekly_unknown_trader_metrics_by_market_creator = (
        compute_weekly_metrics_by_market_creator(
            traders_data=unknown_traders,
            all_mech_calls=None,
            trader_filter=None,
            unknown_trader=True,
        )
    )

# just for all traders
weekly_winning_metrics = compute_winning_metrics_by_trader(
    traders_data=traders_data, unknown_info=unknown_traders
)
weekly_winning_metrics_olas = compute_winning_metrics_by_trader(
    traders_data=traders_data, unknown_info=unknown_traders, trader_filter="Olas"
)
weekly_non_olas_winning_metrics = pd.DataFrame()
if len(traders_data.loc[traders_data["staking"] == "non_Olas"]) > 0:
    weekly_non_olas_winning_metrics = compute_winning_metrics_by_trader(
        traders_data=traders_data,
        unknown_info=unknown_traders,
        trader_filter="non_Olas",
    )

with demo:
    gr.HTML("<h1>Traders monitoring dashboard </h1>")
    gr.Markdown("This app shows the weekly performance of the traders in Olas Predict.")

    with gr.Tabs():
        with gr.TabItem("🔥 Weekly metrics (WIP)"):
            with gr.Row():
                gr.Markdown("# Weekly metrics for all traders")
            with gr.Row():
                trader_details_selector = gr.Dropdown(
                    label="Select a weekly trader metric",
                    choices=trader_metric_choices,
                    value=default_trader_metric,
                )

            with gr.Row():
                with gr.Column(scale=3):
                    trader_markets_plot = plot_trader_metrics_by_agent_categories(
                        metric_name=default_trader_metric,
                        traders_df=traders_weekly_metrics_df,
                    )
                with gr.Column(scale=1):
                    trade_details_text = get_metrics_text(trader_type=None)

            def update_trader_details(trader_detail):
                return plot_trader_metrics_by_agent_categories(
                    metric_name=trader_detail,
                    traders_df=traders_weekly_metrics_df,
                )

            trader_details_selector.change(
                update_trader_details,
                inputs=trader_details_selector,
                outputs=trader_markets_plot,
            )

            # if len(weekly_non_olas_metrics_by_market_creator) > 0:
            #     # Non-Olas traders graph
            #     with gr.Row():
            #         gr.Markdown("# Weekly metrics of Non-Olas traders")
            # with gr.Row():
            #     trader_no_details_selector = gr.Dropdown(
            #         label="Select a weekly trader metric",
            #         choices=trader_metric_choices,
            #         value=default_trader_metric,
            #     )

            # with gr.Row():
            #     with gr.Column(scale=3):
            #         trader_no_markets_plot = plot_trader_metrics_by_market_creator(
            #             metric_name=default_trader_metric,
            #             traders_df=weekly_non_olas_metrics_by_market_creator,
            #         )
            #     with gr.Column(scale=1):
            #         trade_details_text = get_metrics_text(trader_type="non_Olas")

            # def update_no_trader_details(trader_detail):
            #     return plot_trader_metrics_by_market_creator(
            #         metric_name=trader_detail,
            #         traders_df=weekly_non_olas_metrics_by_market_creator,
            #     )

            # trader_no_details_selector.change(
            #     update_no_trader_details,
            #     inputs=trader_no_details_selector,
            #     outputs=trader_no_markets_plot,
            # )
            # Unknown traders graph
            # if weekly_unknown_trader_metrics_by_market_creator is not None:
            #     with gr.Row():
            #         gr.Markdown("# Weekly metrics of Unclassified traders")
            #     with gr.Row():
            #         trader_u_details_selector = gr.Dropdown(
            #             label="Select a weekly trader metric",
            #             choices=trader_metric_choices,
            #             value=default_trader_metric,
            #         )

            #     with gr.Row():
            #         with gr.Column(scale=3):
            #             trader_u_markets_plot = plot_trader_metrics_by_agent_categories(
            #                 metric_name=default_trader_metric,
            #                 traders_df=weekly_unknown_trader_metrics_by_market_creator,
            #             )
            #         with gr.Column(scale=1):
            #             trade_details_text = get_metrics_text(
            #                 trader_type="unclassified"
            #             )

            #     def update_u_trader_details(trader_detail):
            #         return plot_trader_metrics_by_agent_categories(
            #             metric_name=trader_detail,
            #             traders_df=weekly_unknown_trader_metrics_by_market_creator,
            #         )

            #     trader_u_details_selector.change(
            #         update_u_trader_details,
            #         inputs=trader_u_details_selector,
            #         outputs=trader_u_markets_plot,
            #     )

        with gr.TabItem("📅 Daily metrics (WIP)"):
            live_trades_current_week = get_current_week_data(trades_df=daily_info)
            if len(live_trades_current_week) > 0:
                live_metrics_by_market_creator = (
                    compute_daily_metrics_by_market_creator(
                        live_trades_current_week, trader_filter=None, live_metrics=True
                    )
                )
            else:
                live_metrics_by_market_creator = pd.DataFrame()
            with gr.Row():
                gr.Markdown("# Daily live metrics for all trades")
            with gr.Row():
                trade_live_details_selector = gr.Dropdown(
                    label="Select a daily live metric",
                    choices=trader_daily_metric_choices,
                    value=default_daily_metric,
                )

            with gr.Row():
                with gr.Column(scale=3):
                    trade_live_details_plot = plot_daily_metrics(
                        metric_name=default_daily_metric,
                        trades_df=live_metrics_by_market_creator,
                    )
                with gr.Column(scale=1):
                    trade_details_text = get_metrics_text(daily=True)

            def update_trade_live_details(trade_detail, trade_live_details_plot):
                new_a_plot = plot_daily_metrics(
                    metric_name=trade_detail, trades_df=live_metrics_by_market_creator
                )
                return new_a_plot

            trade_live_details_selector.change(
                update_trade_live_details,
                inputs=[trade_live_details_selector, trade_live_details_plot],
                outputs=[trade_live_details_plot],
            )
            # Olas traders
            with gr.Row():
                gr.Markdown("# Daily live metrics for 🌊 Olas traders")
            with gr.Row():
                o_trader_live_details_selector = gr.Dropdown(
                    label="Select a daily live metric",
                    choices=trader_daily_metric_choices,
                    value=default_daily_metric,
                )

            with gr.Row():
                with gr.Column(scale=3):
                    o_trader_live_details_plot = plot_daily_metrics(
                        metric_name=default_daily_metric,
                        trades_df=live_metrics_by_market_creator,
                        trader_filter="Olas",
                    )
                with gr.Column(scale=1):
                    trade_details_text = get_metrics_text(daily=True)

            def update_a_trader_live_details(trade_detail, a_trader_live_details_plot):
                o_trader_plot = plot_daily_metrics(
                    metric_name=trade_detail,
                    trades_df=live_metrics_by_market_creator,
                    trader_filter="Olas",
                )
                return o_trader_plot

            o_trader_live_details_selector.change(
                update_a_trader_live_details,
                inputs=[o_trader_live_details_selector, o_trader_live_details_plot],
                outputs=[o_trader_live_details_plot],
            )
            with gr.Row():
                gr.Markdown("# Daily live metrics for Non-Olas traders")
            with gr.Row():
                no_trader_live_details_selector = gr.Dropdown(
                    label="Select a daily live metric",
                    choices=trader_daily_metric_choices,
                    value=default_daily_metric,
                )

            with gr.Row():
                with gr.Column(scale=3):
                    no_trader_live_details_plot = plot_daily_metrics(
                        metric_name=default_daily_metric,
                        trades_df=live_metrics_by_market_creator,
                        trader_filter="non_Olas",
                    )
                with gr.Column(scale=1):
                    trade_details_text = get_metrics_text(daily=True)

            def update_na_trader_live_details(
                trade_detail, no_trader_live_details_plot
            ):
                no_trader_plot = plot_daily_metrics(
                    metric_name=trade_detail,
                    trades_df=live_metrics_by_market_creator,
                    trader_filter="non_Olas",
                )
                return no_trader_plot

            no_trader_live_details_selector.change(
                update_na_trader_live_details,
                inputs=[no_trader_live_details_selector, no_trader_live_details_plot],
                outputs=[no_trader_live_details_plot],
            )
        with gr.TabItem(" Agent metrics"):
            with gr.Row():
                gr.Markdown(" # Daily active Pearl agents")
            with gr.Row():
                rolling_avg_plot = plot_rolling_average_dune(
                    daa_pearl_df,
                )
            with gr.Row():
                gr.Markdown(" # Daily active Quickstart agents")
            with gr.Row():
                rolling_avg_plot = plot_rolling_average_dune(
                    daa_qs_df,
                )
            with gr.Row():
                gr.Markdown("# 2-weeks rolling average ROI for Pearl agents")
            with gr.Row():
                pearl_rolling_avg_plot = plot_rolling_average_roi(
                    two_weeks_avg_roi_pearl_agents
                )

            with gr.Row():
                gr.Markdown("# Average weekly ROI for Pearl agents")
            with gr.Row():
                gr.Markdown(
                    "This graph shows the average weekly ROI for Pearl agents. The data is based on the latest DAA results."
                )
            with gr.Row():
                weekly_avg_roi_plot = plot_weekly_average_roi(
                    weekly_avg_roi_df=weekly_avg_roi_pearl_agents,
                )

        with gr.TabItem("🪝 Retention metrics"):
            with gr.Row():
                gr.Markdown("# Wow retention by trader type")
            with gr.Row():
                gr.Markdown(
                    """
                    Activity based on mech interactions for Olas and non_Olas traders and based on trading acitivity for the unclassified ones.
                    - Olas trader: agent using Mech, with a service ID and the corresponding safe in the registry
                    - Non-Olas trader: agent using Mech, with no service ID
                    - Unclassified trader: agent (safe/EOAs) not using Mechs
                    """
                )

            with gr.Row():
                with gr.Column(scale=1):
                    gr.Markdown("## Wow retention in Pearl markets")
                    wow_retention = calculate_wow_retention_by_type(
                        retention_df, market_creator="pearl"
                    )
                    wow_retention_plot = plot_wow_retention_by_type(
                        wow_retention=wow_retention
                    )
                with gr.Column(scale=1):
                    gr.Markdown("## Wow retention in Quickstart markets")
                    wow_retention = calculate_wow_retention_by_type(
                        retention_df, market_creator="quickstart"
                    )
                    wow_retention_plot = plot_wow_retention_by_type(
                        wow_retention=wow_retention
                    )

            with gr.Row():
                gr.Markdown("# Cohort retention graphs")
            with gr.Row():
                gr.Markdown(
                    "The Cohort groups are organized by cohort weeks. A trader is part of a cohort group/week where it was detected the FIRST activity ever of that trader."
                )
            with gr.Row():
                gr.Markdown(
                    """
                    Week 0 for a cohort group is the same cohort week of the FIRST detected activity ever of that trader. 
                    Only two values are possible for this Week 0:

                    1. 100% if the cohort size is > 0, meaning all traders active that first cohort week
                    2. 0% if the cohort size = 0, meaning no totally new traders started activity that cohort week.
                    """
                )
            with gr.Row():
                with gr.Column(scale=1):
                    gr.Markdown("## Cohort retention of pearl traders")
                    gr.Markdown("### Cohort retention of 🌊 Olas traders")
                    cohort_retention_olas_pearl = calculate_cohort_retention(
                        df=retention_df, market_creator="pearl", trader_type="Olas"
                    )
                    cohort_retention_plot1 = plot_cohort_retention_heatmap(
                        retention_matrix=cohort_retention_olas_pearl, cmap="Purples"
                    )
                with gr.Column(scale=1):
                    gr.Markdown("## Cohort retention of quickstart traders")
                    gr.Markdown("### Cohort retention of 🌊 Olas traders")
                    cohort_retention_olas_qs = calculate_cohort_retention(
                        df=retention_df, market_creator="quickstart", trader_type="Olas"
                    )
                    cohort_retention_plot4 = plot_cohort_retention_heatmap(
                        retention_matrix=cohort_retention_olas_qs,
                        cmap="Purples",
                    )

            with gr.Row():
                with gr.Column(scale=1):
                    gr.Markdown("## Cohort retention of pearl traders")
                    cohort_retention_unclassified_pearl = calculate_cohort_retention(
                        df=retention_df,
                        market_creator="pearl",
                        trader_type="unclassified",
                    )
                    if len(cohort_retention_unclassified_pearl) > 0:
                        gr.Markdown("### Cohort retention of unclassified traders")
                        cohort_retention_plot3 = plot_cohort_retention_heatmap(
                            retention_matrix=cohort_retention_unclassified_pearl,
                            cmap="Greens",
                        )
                with gr.Column(scale=1):
                    gr.Markdown("## Cohort retention in quickstart traders")
                    cohort_retention_unclassified_qs = calculate_cohort_retention(
                        df=retention_df,
                        market_creator="quickstart",
                        trader_type="unclassified",
                    )
                    if len(cohort_retention_unclassified_qs) > 0:
                        gr.Markdown("### Cohort retention of unclassified traders")
                        cohort_retention_plot6 = plot_cohort_retention_heatmap(
                            retention_matrix=cohort_retention_unclassified_qs,
                            cmap="Greens",
                        )
        with gr.TabItem("⚙️ Active traders"):
            with gr.Row():
                gr.Markdown("# Active Pearl traders by trader categories")
            with gr.Row():
                active_traders_plot = plot_active_traders(active_traders)

            with gr.Row():
                gr.Markdown("# Active traders for Pearl markets by trader categories")
            with gr.Row():
                active_traders_plot_pearl = plot_active_traders(
                    active_traders, market_creator="pearl"
                )

            with gr.Row():
                gr.Markdown("# Active Quickstart traders by trader categories")
            with gr.Row():
                active_traders_plot_qs = plot_active_traders(
                    active_traders, market_creator="quickstart"
                )

        with gr.TabItem("📉 Markets Kullback–Leibler divergence"):
            with gr.Row():
                gr.Markdown(
                    "# Weekly Market Prediction Accuracy for Closed Markets (Kullback-Leibler Divergence)"
                )
            with gr.Row():
                gr.Markdown(
                    "Aka, how much off is the market prediction’s accuracy from the real outcome of the event. Values capped at 20 for market outcomes completely opposite to the real outcome."
                )
            with gr.Row():
                trade_details_text = get_metrics_text()
            with gr.Row():
                with gr.Column(scale=3):
                    kl_div_plot = plot_kl_div_per_market(closed_markets=closed_markets)
                with gr.Column(scale=1):
                    interpretation = get_interpretation_text()

        with gr.TabItem("💰 Money invested per market category"):
            with gr.Row():
                gr.Markdown("# Weekly total bet amount per trader type for all markets")
                gr.Markdown("## Computed only for traders using the mech service")
            with gr.Row():
                total_bet_amount = plot_total_bet_amount(
                    traders_data, market_filter="all"
                )

            with gr.Row():
                gr.Markdown(
                    "# Weekly total bet amount per trader type for Pearl markets"
                )
            with gr.Row():
                o_trader_total_bet_amount = plot_total_bet_amount(
                    traders_data, market_filter="pearl"
                )

            with gr.Row():
                gr.Markdown(
                    "# Weekly total bet amount per trader type for Quickstart markets"
                )
            with gr.Row():
                no_trader_total_bet_amount = plot_total_bet_amount(
                    traders_data, market_filter="quickstart"
                )

        with gr.TabItem("💰 Money invested per single market"):
            with gr.Row():
                gr.Markdown("# Weekly bet amounts per market for all traders")
                gr.Markdown("## Computed only for traders using the mech service")
            with gr.Row():
                bet_amounts = plot_total_bet_amount_per_trader_per_market(traders_data)

            with gr.Row():
                gr.Markdown("# Weekly bet amounts per market for 🌊 Olas traders")
            with gr.Row():
                o_trader_bet_amounts = plot_total_bet_amount_per_trader_per_market(
                    traders_data, trader_filter="Olas"
                )

        with gr.TabItem("🎖️Weekly winning trades % per trader"):
            with gr.Row():
                gr.Markdown("# Weekly winning trades percentage from all traders")
            with gr.Row():
                metrics_text = get_metrics_text()
            with gr.Row():
                winning_metric = plot_winning_metric_per_trader(weekly_winning_metrics)

            with gr.Row():
                gr.Markdown("# Weekly winning trades percentage from 🌊 Olas traders")
            with gr.Row():
                metrics_text = get_metrics_text()
            with gr.Row():
                winning_metric_olas = plot_winning_metric_per_trader(
                    weekly_winning_metrics_olas
                )

demo.queue(default_concurrency_limit=40).launch()