Spaces:
Runtime error
Runtime error
cyberosa
commited on
Commit
Β·
e5aa6da
1
Parent(s):
7557b47
Separate graphs for Pearl and QS markets
Browse files- app.py +9 -1
- tabs/trader_plots.py +6 -5
app.py
CHANGED
|
@@ -631,10 +631,18 @@ with demo:
|
|
| 631 |
active_traders, market_creator="quickstart"
|
| 632 |
)
|
| 633 |
with gr.Row():
|
| 634 |
-
gr.Markdown(" # Daily active agents")
|
| 635 |
with gr.Row():
|
| 636 |
rolling_avg_plot = plot_rolling_average(
|
| 637 |
active_traders,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 638 |
)
|
| 639 |
|
| 640 |
with gr.TabItem("π Markets KullbackβLeibler divergence"):
|
|
|
|
| 631 |
active_traders, market_creator="quickstart"
|
| 632 |
)
|
| 633 |
with gr.Row():
|
| 634 |
+
gr.Markdown(" # Daily active agents in Pearl markets")
|
| 635 |
with gr.Row():
|
| 636 |
rolling_avg_plot = plot_rolling_average(
|
| 637 |
active_traders,
|
| 638 |
+
market_creator="pearl",
|
| 639 |
+
)
|
| 640 |
+
with gr.Row():
|
| 641 |
+
gr.Markdown(" # Daily active agents in QS markets")
|
| 642 |
+
with gr.Row():
|
| 643 |
+
rolling_avg_plot = plot_rolling_average(
|
| 644 |
+
active_traders,
|
| 645 |
+
market_creator="quickstart",
|
| 646 |
)
|
| 647 |
|
| 648 |
with gr.TabItem("π Markets KullbackβLeibler divergence"):
|
tabs/trader_plots.py
CHANGED
|
@@ -380,13 +380,14 @@ def plot_rolling_average(
|
|
| 380 |
market_creator: str = None,
|
| 381 |
) -> gr.Plot:
|
| 382 |
"""Function to plot the rolling average of active traders for the different categories and markets"""
|
| 383 |
-
|
| 384 |
-
rolling_avg_df = get_sevenday_rolling_average(active_traders_df)
|
| 385 |
-
print(rolling_avg_df.head())
|
| 386 |
if market_creator is not None:
|
| 387 |
-
|
| 388 |
-
|
| 389 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 390 |
|
| 391 |
# Ensure 'creation_date' is a column, not an index
|
| 392 |
if "creation_date" not in rolling_avg_df.columns:
|
|
|
|
| 380 |
market_creator: str = None,
|
| 381 |
) -> gr.Plot:
|
| 382 |
"""Function to plot the rolling average of active traders for the different categories and markets"""
|
|
|
|
|
|
|
|
|
|
| 383 |
if market_creator is not None:
|
| 384 |
+
filtered_traders_df = active_traders_df.loc[
|
| 385 |
+
active_traders_df["market_creator"] == market_creator
|
| 386 |
]
|
| 387 |
+
rolling_avg_df = get_sevenday_rolling_average(filtered_traders_df)
|
| 388 |
+
else:
|
| 389 |
+
rolling_avg_df = get_sevenday_rolling_average(active_traders_df)
|
| 390 |
+
print(rolling_avg_df.head())
|
| 391 |
|
| 392 |
# Ensure 'creation_date' is a column, not an index
|
| 393 |
if "creation_date" not in rolling_avg_df.columns:
|