File size: 1,677 Bytes
2206479
 
 
 
 
 
 
 
 
65733ce
2206479
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2dc3f1e
 
65733ce
45dbef5
2dc3f1e
fc9603c
9b493b1
2dc3f1e
fc9603c
2dc3f1e
9804ae2
2206479
45dbef5
2206479
2dc3f1e
2206479
 
 
45dbef5
2206479
 
 
7bb8323
65733ce
45dbef5
 
65733ce
c235ab0
5e64ef2
65733ce
 
7bb8323
 
65733ce
 
 
 
 
 
 
 
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
import pandas as pd
import gradio as gr
import gc
import plotly.express as px


def plot_rolling_average_dune(
    daa_df: pd.DataFrame,
) -> gr.Plot:
    """Function to plot the rolling average of daily active agents"""

    fig = px.bar(
        daa_df,
        x="tx_date",
        y="seven_day_trailing_avg",
    )
    fig.update_layout(
        xaxis_title="Date",
        yaxis_title="7-day rolling average of DAA",
    )

    return gr.Plot(
        value=fig,
    )


def plot_rolling_average_roi(two_weeks_avg_roi_pearl_agents: pd.DataFrame) -> gr.Plot:
    """Function to plot the 2-weeks rolling average ROI for pearl agents"""

    print("Rolling average ROI DataFrame:")
    print(two_weeks_avg_roi_pearl_agents.head())

    fig2 = px.line(
        two_weeks_avg_roi_pearl_agents,
        x="creation_date",
        y="two_weeks_avg_roi",
        color_discrete_sequence=["#9C27B0"],
    )
    fig2.update_layout(
        xaxis_title="Week",
        yaxis_title="2-week rolling average ROI of pearl agents",
    )

    return gr.Plot(
        value=fig2,
    )


def plot_weekly_average_roi(weekly_avg_roi_df: pd.DataFrame) -> gr.Plot:
    """Function to plot the weekly average of ROI for pearl agents"""

    print("Weekly average ROI DataFrame:")
    print(weekly_avg_roi_df.head())

    # Update the plot to use the correct column name 'weekly_avg_roi'
    fig = px.line(
        weekly_avg_roi_df,
        x="week_start",
        y="avg_weekly_roi",  # Changed from 'roi' to 'weekly_avg_roi'
    )
    fig.update_layout(
        xaxis_title="Week",
        yaxis_title="Weekly average ROI for pearl agents",
    )
    return gr.Plot(
        value=fig,
    )