import matplotlib.pyplot as plt import pandas as pd def evolution_compte(df, id1, id = 'Registrar Account - ID'): def prepare_df(idt): df_id = df[df[id] == idt].copy() df_id['Centralisation Date'] = pd.to_datetime(df_id['Centralisation Date']) df_agg = ( df_id .groupby('Centralisation Date')['Quantity - AUM'] .sum() .reset_index() .sort_values('Centralisation Date') ) return df_agg df1 = prepare_df(id1) plt.figure(figsize=(12, 6)) # Courbe du compte plt.plot(df1['Centralisation Date'], df1['Quantity - AUM'], marker='.', linestyle='-', label=f'Account {id1}') plt.title(f"Évolution AUM pour le compte {id1}") plt.xlabel("Date") plt.ylabel("Quantity - AUM") plt.grid(True) plt.legend() plt.tight_layout() plt.show() def evolution_2_comptes(df, id1, id2): def prepare_df(id): df_id = df[df['Registrar Account - ID'] == id].copy() df_id['Centralisation Date'] = pd.to_datetime(df_id['Centralisation Date']) df_agg = ( df_id .groupby('Centralisation Date')['Quantity - AUM'] .sum() .reset_index() .sort_values('Centralisation Date') ) return df_agg df1 = prepare_df(id1) df2 = prepare_df(id2) plt.figure(figsize=(12, 6)) # Courbe du premier compte plt.plot(df1['Centralisation Date'], df1['Quantity - AUM'], marker='.', linestyle='-', label=f'Account {id1}') # Courbe du second compte plt.plot(df2['Centralisation Date'], df2['Quantity - AUM'], marker='.', linestyle='-', label=f'Account {id2}') plt.title("Évolution des AUM pour deux comptes") plt.xlabel("Date") plt.ylabel("Quantity - AUM") plt.grid(True) plt.legend() # <- important pour distinguer les comptes plt.tight_layout() plt.show() def evolution_3_comptes(df, id1, id2, id3): def prepare_df(id): df_id = df[df['Registrar Account - ID'] == id].copy() df_id['Centralisation Date'] = pd.to_datetime(df_id['Centralisation Date']) df_agg = ( df_id .groupby('Centralisation Date')['Quantity - AUM'] .sum() .reset_index() .sort_values('Centralisation Date') ) return df_agg df1 = prepare_df(id1) df2 = prepare_df(id2) df3 = prepare_df(id3) plt.figure(figsize=(12, 6)) plt.plot(df1['Centralisation Date'], df1['Quantity - AUM'], marker='.', linestyle='-', label=f'Account {id1}') plt.plot(df2['Centralisation Date'], df2['Quantity - AUM'], marker='.', linestyle='-', label=f'Account {id2}') plt.plot(df3['Centralisation Date'], df3['Quantity - AUM'], marker='.', linestyle='-', label=f'Account {id3}') plt.title("Evolution of AUM for three accounts") plt.xlabel("Date") plt.ylabel("Quantity - AUM") plt.grid(True) plt.legend() plt.tight_layout() plt.show()