paco-dev #2
|
|
@ -1,629 +0,0 @@
|
|||
"""
|
||||
=============================================================================
|
||||
CARMIGNAC × ENSAE — Pipeline : Performance → Flux nets
|
||||
=============================================================================
|
||||
|
||||
Pipeline complet :
|
||||
1. Chargement & exploration
|
||||
2. Table de correspondance shareClass → ISIN (clé de jointure)
|
||||
3. Jointure AUM (stocks) × Performance (weekly_perf)
|
||||
4. Feature engineering : features de performance décalées + percentile
|
||||
5. Construction de la variable cible : flux nets (ΔAum proxy)
|
||||
6. Modèle prédictif : Random Forest avec walk-forward validation
|
||||
7. Analyse d'importance des variables (SHAP-like permutation importance)
|
||||
|
||||
NOTE : Ce script utilise les fichiers *_head.csv pour la démonstration.
|
||||
Remplacer les chemins par les fichiers complets pour l'analyse finale.
|
||||
|
||||
Dépendances : pandas, numpy, scikit-learn, matplotlib, seaborn
|
||||
=============================================================================
|
||||
"""
|
||||
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
import matplotlib.gridspec as gridspec
|
||||
import seaborn as sns
|
||||
from sklearn.ensemble import RandomForestRegressor, GradientBoostingRegressor
|
||||
from sklearn.linear_model import Ridge
|
||||
from sklearn.preprocessing import StandardScaler
|
||||
from sklearn.metrics import mean_absolute_error, r2_score
|
||||
from sklearn.inspection import permutation_importance
|
||||
import warnings
|
||||
warnings.filterwarnings('ignore')
|
||||
|
||||
# ── Style global ──────────────────────────────────────────────────────────────
|
||||
plt.rcParams.update({
|
||||
'figure.facecolor': 'white',
|
||||
'axes.facecolor': '#f8f9fa',
|
||||
'axes.grid': True,
|
||||
'grid.alpha': 0.4,
|
||||
'font.family': 'DejaVu Sans',
|
||||
})
|
||||
COLORS = ['#1f4e79', '#2e75b6', '#70ad47', '#ed7d31', '#a50026', '#ffc000']
|
||||
|
||||
# =============================================================================
|
||||
# 1. CHARGEMENT DES DONNÉES
|
||||
# =============================================================================
|
||||
|
||||
print("=" * 60)
|
||||
print("1. CHARGEMENT DES DONNÉES")
|
||||
print("=" * 60)
|
||||
|
||||
# ── Remplacer par les chemins vers les fichiers complets ──────────────────────
|
||||
PATH_STOCKS = "equity_stocks_head.csv" # → fichier AUM mensuel par compte
|
||||
PATH_PERF = "weekly_perf_head.csv" # → performances hebdomadaires
|
||||
|
||||
stocks = pd.read_csv(PATH_STOCKS, index_col=0)
|
||||
perf = pd.read_csv(PATH_PERF, index_col=0)
|
||||
|
||||
# Parsing des dates
|
||||
stocks['Centralisation Date'] = pd.to_datetime(stocks['Centralisation Date'])
|
||||
perf['Date'] = pd.to_datetime(perf['Date'])
|
||||
|
||||
print(f"stocks : {stocks.shape[0]:,} lignes × {stocks.shape[1]} colonnes")
|
||||
print(f"perf : {perf.shape[0]:,} lignes × {perf.shape[1]} colonnes")
|
||||
print(f"\nstocks — plage dates : {stocks['Centralisation Date'].min().date()} → {stocks['Centralisation Date'].max().date()}")
|
||||
print(f"perf — plage dates : {perf['Date'].min().date()} → {perf['Date'].max().date()}")
|
||||
print(f"perf — périodes disponibles : {sorted(perf['perfPeriod'].unique())}")
|
||||
|
||||
# =============================================================================
|
||||
# 2. TABLE DE CORRESPONDANCE shareClass_name → ISIN
|
||||
# =============================================================================
|
||||
#
|
||||
# Problème : weekly_perf n'a pas d'ISIN, stocks n'a pas le nom complet
|
||||
# de shareclass. La jointure se fait en deux temps :
|
||||
# a) Extraction d'un nom court depuis chaque source
|
||||
# b) Matching fuzzy sur ce nom court + Type shareclass + Devise
|
||||
#
|
||||
# En production : remplacer par la table de référence ISIN complète
|
||||
# fournie par Morningstar (fichier Peers.csv) qui contient Name + ISIN.
|
||||
# =============================================================================
|
||||
|
||||
print("\n" + "=" * 60)
|
||||
print("2. TABLE DE CORRESPONDANCE shareClass → ISIN")
|
||||
print("=" * 60)
|
||||
|
||||
# ── Extraction du nom de stratégie (nom court) depuis perf ───────────────────
|
||||
# Exemples :
|
||||
# "Carmignac Pf Asia Discovery A EUR Acc" → "Asia Discovery", type=A, ccy=EUR
|
||||
# "Carmignac Investissement F EUR Acc" → "Investissement", type=F, ccy=EUR
|
||||
def parse_shareclass_name(name):
|
||||
"""
|
||||
Extrait (strategy_name, shareclass_type, currency) depuis le nom complet.
|
||||
Logique : on retire le préfixe Carmignac / Carmignac Pf, puis on parse
|
||||
le suffixe " X YYY Acc" en fin de chaîne.
|
||||
"""
|
||||
s = name.strip()
|
||||
for prefix in ['Carmignac Portfolio ', 'Carmignac Pf ', 'Carmignac ']:
|
||||
if s.startswith(prefix):
|
||||
s = s[len(prefix):]
|
||||
break
|
||||
# Suffix pattern : " A EUR Acc" ou " F USD Acc" etc.
|
||||
import re
|
||||
m = re.search(r'\s+([A-Z])\s+([A-Z]{3})\s+Acc\s*$', s)
|
||||
if m:
|
||||
strategy = s[:m.start()].strip()
|
||||
sc_type = m.group(1)
|
||||
currency = m.group(2)
|
||||
else:
|
||||
strategy = s
|
||||
sc_type = None
|
||||
currency = None
|
||||
return strategy, sc_type, currency
|
||||
|
||||
perf_parsed = perf['shareClass_name'].drop_duplicates().apply(
|
||||
lambda x: pd.Series(parse_shareclass_name(x),
|
||||
index=['strategy_name', 'sc_type', 'currency'])
|
||||
)
|
||||
perf_parsed['shareClass_name'] = perf['shareClass_name'].drop_duplicates().values
|
||||
print("Shareclass parsées depuis perf :")
|
||||
print(perf_parsed.to_string(index=False))
|
||||
|
||||
# ── Extraction du nom court depuis stocks ─────────────────────────────────────
|
||||
stocks['strategy_name'] = (stocks['Product - Fund']
|
||||
.str.replace('Carmignac Portfolio ', '', regex=False)
|
||||
.str.replace('Carmignac ', '', regex=False)
|
||||
.str.strip())
|
||||
|
||||
# ── Correspondance ISIN depuis stocks : fund + type + currency ────────────────
|
||||
isin_ref = (stocks[['strategy_name',
|
||||
'Product - Shareclass Type',
|
||||
'Product - Shareclass Currency',
|
||||
'Product - Isin']]
|
||||
.drop_duplicates()
|
||||
.rename(columns={
|
||||
'Product - Shareclass Type': 'sc_type',
|
||||
'Product - Shareclass Currency': 'currency',
|
||||
'Product - Isin': 'isin'
|
||||
}))
|
||||
|
||||
# ── Jointure sur (strategy_name, sc_type, currency) ──────────────────────────
|
||||
mapping = perf_parsed.merge(isin_ref, on=['strategy_name', 'sc_type', 'currency'], how='left')
|
||||
print("\nTable de correspondance shareClass_name → ISIN :")
|
||||
print(mapping[['shareClass_name', 'strategy_name', 'sc_type', 'currency', 'isin']].to_string(index=False))
|
||||
|
||||
matched = mapping['isin'].notna().sum()
|
||||
print(f"\nMatch : {matched}/{len(mapping)} shareclass liées à un ISIN")
|
||||
if matched < len(mapping):
|
||||
unmatched = mapping[mapping['isin'].isna()]['shareClass_name'].tolist()
|
||||
print(f"⚠ Non matchées (à compléter manuellement ou via Peers.csv) :")
|
||||
for u in unmatched:
|
||||
print(f" - {u}")
|
||||
|
||||
# Enrichissement de perf avec l'ISIN
|
||||
perf = perf.merge(mapping[['shareClass_name', 'isin', 'strategy_name']],
|
||||
on='shareClass_name', how='left')
|
||||
|
||||
# =============================================================================
|
||||
# 3. CONSTRUCTION DU PANEL MENSUEL
|
||||
# =============================================================================
|
||||
#
|
||||
# Objectif : une ligne = (compte client, fonds, mois)
|
||||
# Colonnes : AUM_t, puis features de performance sur les mois précédents
|
||||
#
|
||||
# Alignement temporel :
|
||||
# - stocks : snapshot mensuel (fin de mois)
|
||||
# - perf : données hebdomadaires → on prend la valeur la plus récente
|
||||
# avant ou à la date de snapshot mensuel
|
||||
# =============================================================================
|
||||
|
||||
print("\n" + "=" * 60)
|
||||
print("3. CONSTRUCTION DU PANEL MENSUEL")
|
||||
print("=" * 60)
|
||||
|
||||
# ── Pivot perf : une ligne par (isin, date_hebdo, perfPeriod) ────────────────
|
||||
perf_pivot = (perf
|
||||
.dropna(subset=['isin'])
|
||||
.pivot_table(index=['isin', 'Date'],
|
||||
columns='perfPeriod',
|
||||
values=['return', 'percentile'],
|
||||
aggfunc='mean')
|
||||
)
|
||||
# Aplatir les colonnes multi-index
|
||||
perf_pivot.columns = ['_'.join(col).strip() for col in perf_pivot.columns]
|
||||
perf_pivot = perf_pivot.reset_index()
|
||||
perf_pivot['Date'] = pd.to_datetime(perf_pivot['Date'])
|
||||
|
||||
print(f"perf_pivot shape : {perf_pivot.shape}")
|
||||
print(f"Colonnes de performance : {[c for c in perf_pivot.columns if c not in ['isin','Date']]}")
|
||||
|
||||
# ── Merge as-of : pour chaque snapshot stocks, trouver la perf hebdo ────────
|
||||
# la plus récente avant ou égale à la date de snapshot
|
||||
stocks_sorted = stocks.sort_values('Centralisation Date')
|
||||
perf_sorted = perf_pivot.sort_values('Date')
|
||||
|
||||
# Merge as-of par ISIN
|
||||
merged_parts = []
|
||||
for isin_val in stocks_sorted['Product - Isin'].unique():
|
||||
s_isin = stocks_sorted[stocks_sorted['Product - Isin'] == isin_val].copy()
|
||||
p_isin = perf_sorted[perf_sorted['isin'] == isin_val].copy()
|
||||
if p_isin.empty:
|
||||
merged_parts.append(s_isin)
|
||||
continue
|
||||
merged = pd.merge_asof(
|
||||
s_isin.sort_values('Centralisation Date'),
|
||||
p_isin.sort_values('Date'),
|
||||
left_on='Centralisation Date',
|
||||
right_on='Date',
|
||||
direction='backward',
|
||||
tolerance=pd.Timedelta('35 days') # max 5 semaines d'écart
|
||||
)
|
||||
merged_parts.append(merged)
|
||||
|
||||
panel = pd.concat(merged_parts, ignore_index=True)
|
||||
perf_cols = [c for c in panel.columns if c not in stocks.columns and c != 'isin' and c != 'Date']
|
||||
print(f"\nPanel après merge : {panel.shape}")
|
||||
print(f"Colonnes de perf jointes : {perf_cols}")
|
||||
n_matched = panel[perf_cols[0]].notna().sum() if perf_cols else 0
|
||||
print(f"Lignes avec performance jointe : {n_matched}/{len(panel)}")
|
||||
|
||||
# =============================================================================
|
||||
# 4. FEATURE ENGINEERING
|
||||
# =============================================================================
|
||||
#
|
||||
# Features construites par compte × fonds × mois :
|
||||
#
|
||||
# [A] Performance absolue décalée
|
||||
# - perf_6Mo : rendement sur 6 mois (lag=0, observé à t)
|
||||
# - perf_1Yr : rendement sur 1 an
|
||||
#
|
||||
# [B] Performance relative (percentile Morningstar)
|
||||
# - pct_6Mo : percentile dans la catégorie sur 6 mois
|
||||
# - pct_1Yr : percentile dans la catégorie sur 1 an
|
||||
#
|
||||
# [C] Features client (RFM proxy depuis AUM)
|
||||
# - aum_t : encours à t (proxy du M de RFM)
|
||||
# - aum_lag1 : encours à t-1 mois
|
||||
# - aum_lag3 : encours à t-3 mois
|
||||
# - aum_growth_1m : croissance MoM de l'AUM
|
||||
# - aum_growth_3m : croissance sur 3 mois
|
||||
#
|
||||
# [D] Variable cible : flux_net_proxy = AUM(t+1) - AUM(t)
|
||||
# (approximation des flux nets en l'absence des transactions brutes)
|
||||
# NOTE : avec les données de flux bruts (souscriptions + rachats),
|
||||
# remplacer par flux_net = sum(souscriptions) - sum(rachats)
|
||||
# sur la période t → t+1.
|
||||
#
|
||||
# =============================================================================
|
||||
|
||||
print("\n" + "=" * 60)
|
||||
print("4. FEATURE ENGINEERING")
|
||||
print("=" * 60)
|
||||
|
||||
# ── Tri du panel ──────────────────────────────────────────────────────────────
|
||||
panel = panel.sort_values(['Registrar Account - ID', 'Product - Isin', 'Centralisation Date'])
|
||||
|
||||
# ── [C] Features AUM (par compte × fonds) ────────────────────────────────────
|
||||
panel['aum_lag1'] = panel.groupby(['Registrar Account - ID', 'Product - Isin'])['Value - AUM €'].shift(1)
|
||||
panel['aum_lag3'] = panel.groupby(['Registrar Account - ID', 'Product - Isin'])['Value - AUM €'].shift(3)
|
||||
|
||||
panel['aum_growth_1m'] = (panel['Value - AUM €'] - panel['aum_lag1']) / (panel['aum_lag1'].abs() + 1)
|
||||
panel['aum_growth_3m'] = (panel['Value - AUM €'] - panel['aum_lag3']) / (panel['aum_lag3'].abs() + 1)
|
||||
|
||||
# ── [D] Variable cible : ΔAum(t → t+1) ──────────────────────────────────────
|
||||
panel['aum_next'] = panel.groupby(['Registrar Account - ID', 'Product - Isin'])['Value - AUM €'].shift(-1)
|
||||
panel['flux_net_proxy'] = panel['aum_next'] - panel['Value - AUM €']
|
||||
|
||||
# ── Sélection des features ────────────────────────────────────────────────────
|
||||
# Colonnes de performance disponibles (dépend du contenu de perf)
|
||||
PERF_COLS_AVAILABLE = [c for c in perf_cols if any(
|
||||
tag in c for tag in ['6Mo', '1Yr', '6mo', '1yr', '6MoRet', '1YrRet']
|
||||
)]
|
||||
PCT_COLS_AVAILABLE = [c for c in perf_cols if 'percentile' in c.lower()]
|
||||
|
||||
# Si données head (seulement 1YrRet) → on utilise ce qui est disponible
|
||||
FEATURE_COLS = (
|
||||
['Value - AUM €', 'aum_lag1', 'aum_lag3', 'aum_growth_1m', 'aum_growth_3m']
|
||||
+ PERF_COLS_AVAILABLE
|
||||
+ PCT_COLS_AVAILABLE
|
||||
)
|
||||
FEATURE_COLS = [c for c in FEATURE_COLS if c in panel.columns]
|
||||
|
||||
print(f"Features sélectionnées ({len(FEATURE_COLS)}) :")
|
||||
for f in FEATURE_COLS:
|
||||
n_valid = panel[f].notna().sum()
|
||||
print(f" {f:<40} → {n_valid:,} valeurs non-nulles")
|
||||
|
||||
TARGET = 'flux_net_proxy'
|
||||
|
||||
# ── Dataset modèle ────────────────────────────────────────────────────────────
|
||||
model_data = panel.dropna(subset=FEATURE_COLS + [TARGET]).copy()
|
||||
print(f"\nDataset pour modélisation : {model_data.shape[0]:,} lignes")
|
||||
|
||||
# =============================================================================
|
||||
# 5. MODÈLE PRÉDICTIF — WALK-FORWARD VALIDATION
|
||||
# =============================================================================
|
||||
#
|
||||
# Validation walk-forward (expanding window) :
|
||||
# - Évite le data leakage temporel
|
||||
# - À chaque fold : train = tout le passé, test = le mois suivant
|
||||
# - On calcule MAE, R² sur la fenêtre de test
|
||||
#
|
||||
# Modèles comparés :
|
||||
# 1. Baseline : moyenne mobile (benchmark naïf)
|
||||
# 2. Ridge Regression : modèle linéaire régularisé
|
||||
# 3. Random Forest : non-linéaire, robuste aux outliers
|
||||
# 4. Gradient Boosting : state-of-the-art sur données tabulaires
|
||||
#
|
||||
# =============================================================================
|
||||
|
||||
print("\n" + "=" * 60)
|
||||
print("5. WALK-FORWARD VALIDATION")
|
||||
print("=" * 60)
|
||||
|
||||
if model_data.empty:
|
||||
print("⚠ Pas assez de données (fichiers head) pour la modélisation.")
|
||||
print(" Le pipeline est prêt — relancer avec les fichiers complets.")
|
||||
RUN_MODEL = False
|
||||
else:
|
||||
RUN_MODEL = True
|
||||
dates_sorted = sorted(model_data['Centralisation Date'].unique())
|
||||
N_DATES = len(dates_sorted)
|
||||
MIN_TRAIN = max(2, N_DATES // 3) # au moins 1/3 des dates en train
|
||||
print(f"Dates disponibles : {N_DATES} | Min train : {MIN_TRAIN} snapshots")
|
||||
|
||||
if RUN_MODEL and N_DATES > MIN_TRAIN:
|
||||
|
||||
results = []
|
||||
models = {
|
||||
'Ridge': Ridge(alpha=1.0),
|
||||
'Random Forest': RandomForestRegressor(n_estimators=100, max_depth=5,
|
||||
random_state=42, n_jobs=-1),
|
||||
'Gradient Boost': GradientBoostingRegressor(n_estimators=100, max_depth=3,
|
||||
learning_rate=0.05,
|
||||
random_state=42),
|
||||
}
|
||||
scaler = StandardScaler()
|
||||
|
||||
for test_idx in range(MIN_TRAIN, N_DATES):
|
||||
train_dates = dates_sorted[:test_idx]
|
||||
test_date = dates_sorted[test_idx]
|
||||
|
||||
train = model_data[model_data['Centralisation Date'].isin(train_dates)]
|
||||
test = model_data[model_data['Centralisation Date'] == test_date]
|
||||
|
||||
X_train = train[FEATURE_COLS].fillna(0)
|
||||
y_train = train[TARGET]
|
||||
X_test = test[FEATURE_COLS].fillna(0)
|
||||
y_test = test[TARGET]
|
||||
|
||||
if len(X_test) == 0:
|
||||
continue
|
||||
|
||||
X_train_sc = scaler.fit_transform(X_train)
|
||||
X_test_sc = scaler.transform(X_test)
|
||||
|
||||
# Baseline : moyenne de l'AUM passé comme prédiction de flux
|
||||
baseline_pred = np.zeros(len(y_test))
|
||||
baseline_mae = mean_absolute_error(y_test, baseline_pred)
|
||||
|
||||
for model_name, model in models.items():
|
||||
X_tr = X_train_sc if model_name == 'Ridge' else X_train
|
||||
X_te = X_test_sc if model_name == 'Ridge' else X_test
|
||||
model.fit(X_tr, y_train)
|
||||
preds = model.predict(X_te)
|
||||
results.append({
|
||||
'test_date': test_date,
|
||||
'model': model_name,
|
||||
'mae': mean_absolute_error(y_test, preds),
|
||||
'r2': r2_score(y_test, preds) if len(y_test) > 1 else np.nan,
|
||||
'baseline_mae': baseline_mae,
|
||||
'n_test': len(y_test),
|
||||
})
|
||||
|
||||
results_df = pd.DataFrame(results)
|
||||
print("\nRésultats agrégés (médiane sur tous les folds) :")
|
||||
summary = (results_df.groupby('model')
|
||||
.agg(MAE_median=('mae', 'median'),
|
||||
R2_median=('r2', 'median'),
|
||||
MAE_mean=('mae', 'mean'))
|
||||
.round(4))
|
||||
print(summary)
|
||||
|
||||
baseline_mae_median = results_df['baseline_mae'].median()
|
||||
print(f"\nBaseline (zéro) MAE médiane : {baseline_mae_median:.4f}")
|
||||
|
||||
else:
|
||||
if RUN_MODEL:
|
||||
print("⚠ Pas assez de dates distinctes pour le walk-forward.")
|
||||
print(" Modélisation ignorée sur données head — OK sur données complètes.")
|
||||
results_df = pd.DataFrame()
|
||||
|
||||
# =============================================================================
|
||||
# 6. IMPORTANCE DES VARIABLES
|
||||
# =============================================================================
|
||||
|
||||
print("\n" + "=" * 60)
|
||||
print("6. IMPORTANCE DES VARIABLES")
|
||||
print("=" * 60)
|
||||
|
||||
if RUN_MODEL and not model_data.empty and len(model_data) > 10:
|
||||
X_all = model_data[FEATURE_COLS].fillna(0)
|
||||
y_all = model_data[TARGET]
|
||||
|
||||
rf_final = RandomForestRegressor(n_estimators=200, max_depth=6,
|
||||
random_state=42, n_jobs=-1)
|
||||
rf_final.fit(X_all, y_all)
|
||||
|
||||
importances = pd.Series(rf_final.feature_importances_, index=FEATURE_COLS).sort_values(ascending=False)
|
||||
print("Importance des features (Random Forest) :")
|
||||
print(importances.round(4).to_string())
|
||||
|
||||
# Permutation importance (plus robuste)
|
||||
perm = permutation_importance(rf_final, X_all, y_all, n_repeats=10, random_state=42, n_jobs=-1)
|
||||
perm_imp = pd.Series(perm.importances_mean, index=FEATURE_COLS).sort_values(ascending=False)
|
||||
print("\nPermutation importance :")
|
||||
print(perm_imp.round(4).to_string())
|
||||
else:
|
||||
importances = pd.Series(dtype=float)
|
||||
perm_imp = pd.Series(dtype=float)
|
||||
print("Importance des variables : données insuffisantes (head CSV).")
|
||||
print("Simuler les noms de features attendues :")
|
||||
expected = FEATURE_COLS if FEATURE_COLS else [
|
||||
'Value - AUM €', 'aum_lag1', 'aum_lag3',
|
||||
'aum_growth_1m', 'aum_growth_3m',
|
||||
'return_6MoRet', 'return_1YrRet',
|
||||
'percentile_6MoRet', 'percentile_1YrRet'
|
||||
]
|
||||
print(" " + ", ".join(expected))
|
||||
|
||||
# =============================================================================
|
||||
# 7. VISUALISATIONS
|
||||
# =============================================================================
|
||||
|
||||
print("\n" + "=" * 60)
|
||||
print("7. GÉNÉRATION DES VISUALISATIONS")
|
||||
print("=" * 60)
|
||||
|
||||
fig = plt.figure(figsize=(18, 20))
|
||||
fig.patch.set_facecolor('white')
|
||||
gs = gridspec.GridSpec(4, 2, figure=fig, hspace=0.45, wspace=0.35)
|
||||
|
||||
# ── [A] Distribution des AUM par fonds ───────────────────────────────────────
|
||||
ax1 = fig.add_subplot(gs[0, :])
|
||||
aum_by_fund = stocks.groupby('strategy_name')['Value - AUM €'].sum().sort_values(ascending=False)
|
||||
bars = ax1.bar(aum_by_fund.index, aum_by_fund.values / 1e6, color=COLORS[:len(aum_by_fund)])
|
||||
ax1.set_title('AUM total par fonds (données disponibles)', fontsize=13, fontweight='bold', pad=10)
|
||||
ax1.set_ylabel('AUM (M€)')
|
||||
ax1.tick_params(axis='x', rotation=20)
|
||||
for bar, val in zip(bars, aum_by_fund.values):
|
||||
ax1.text(bar.get_x() + bar.get_width()/2, bar.get_height() + 0.5,
|
||||
f'{val/1e6:.1f}M', ha='center', va='bottom', fontsize=8)
|
||||
|
||||
# ── [B] Évolution temporelle de l'AUM ────────────────────────────────────────
|
||||
ax2 = fig.add_subplot(gs[1, 0])
|
||||
aum_time = stocks.groupby('Centralisation Date')['Value - AUM €'].sum()
|
||||
ax2.fill_between(aum_time.index, aum_time.values / 1e6, alpha=0.3, color=COLORS[0])
|
||||
ax2.plot(aum_time.index, aum_time.values / 1e6, color=COLORS[0], linewidth=2)
|
||||
ax2.set_title('AUM agrégé — évolution temporelle', fontsize=12, fontweight='bold')
|
||||
ax2.set_ylabel('AUM (M€)')
|
||||
ax2.tick_params(axis='x', rotation=20)
|
||||
|
||||
# ── [C] Distribution des performances ────────────────────────────────────────
|
||||
ax3 = fig.add_subplot(gs[1, 1])
|
||||
perf_cols_ret = [c for c in perf.columns if 'return' == c]
|
||||
if perf_cols_ret:
|
||||
for col in perf_cols_ret[:3]:
|
||||
ax3.hist(perf[col].dropna(), bins=30, alpha=0.6, label=col)
|
||||
ax3.legend()
|
||||
else:
|
||||
ax3.hist(perf['return'].dropna(), bins=30, color=COLORS[1], alpha=0.8, edgecolor='white')
|
||||
ax3.set_xlabel('Rendement 1 an (%)')
|
||||
ax3.set_title('Distribution des performances (1YrRet)', fontsize=12, fontweight='bold')
|
||||
ax3.set_ylabel('Fréquence')
|
||||
|
||||
# ── [D] Scatter : performance vs percentile ──────────────────────────────────
|
||||
ax4 = fig.add_subplot(gs[2, 0])
|
||||
if 'return' in perf.columns and 'percentile' in perf.columns:
|
||||
sc = ax4.scatter(perf['return'], perf['percentile'],
|
||||
alpha=0.5, c=COLORS[0], edgecolors='none', s=25)
|
||||
ax4.set_xlabel('Rendement 1 an (%)')
|
||||
ax4.set_ylabel('Percentile dans la catégorie')
|
||||
ax4.set_title('Performance vs Rang relatif (peer percentile)', fontsize=12, fontweight='bold')
|
||||
# Ligne de référence médiane
|
||||
ax4.axhline(50, color='red', linestyle='--', alpha=0.5, label='Médiane (50e pct)')
|
||||
ax4.legend(fontsize=9)
|
||||
|
||||
# ── [E] Importance des variables (si disponible) ─────────────────────────────
|
||||
ax5 = fig.add_subplot(gs[2, 1])
|
||||
if not importances.empty:
|
||||
colors_imp = [COLORS[2] if 'perf' in f or 'return' in f or 'percentile' in f
|
||||
else COLORS[0] for f in importances.index]
|
||||
ax5.barh(importances.index[::-1], importances.values[::-1], color=colors_imp[::-1])
|
||||
ax5.set_title('Importance des features (Random Forest)', fontsize=12, fontweight='bold')
|
||||
ax5.set_xlabel('Importance (Gini impurity)')
|
||||
# Légende
|
||||
from matplotlib.patches import Patch
|
||||
legend_els = [Patch(color=COLORS[2], label='Features performance'),
|
||||
Patch(color=COLORS[0], label='Features AUM/comportement')]
|
||||
ax5.legend(handles=legend_els, fontsize=8)
|
||||
else:
|
||||
# Afficher le schéma du pipeline à la place
|
||||
ax5.axis('off')
|
||||
pipeline_text = (
|
||||
"PIPELINE — FEATURES ATTENDUES\n\n"
|
||||
"■ AUM features (comportement):\n"
|
||||
" • Value - AUM € (encours actuel)\n"
|
||||
" • aum_lag1, aum_lag3\n"
|
||||
" • aum_growth_1m, aum_growth_3m\n\n"
|
||||
"■ Performance features (moyen terme):\n"
|
||||
" • return_6MoRet\n"
|
||||
" • return_1YrRet\n\n"
|
||||
"■ Relative performance (peer):\n"
|
||||
" • percentile_6MoRet\n"
|
||||
" • percentile_1YrRet\n\n"
|
||||
"→ Relancer avec données complètes\n"
|
||||
" pour obtenir les importances réelles."
|
||||
)
|
||||
ax5.text(0.05, 0.95, pipeline_text, transform=ax5.transAxes,
|
||||
fontsize=9.5, verticalalignment='top', fontfamily='monospace',
|
||||
bbox=dict(boxstyle='round', facecolor='#eaf2fb', alpha=0.8))
|
||||
ax5.set_title('Features du modèle', fontsize=12, fontweight='bold')
|
||||
|
||||
# ── [F] Résultats walk-forward (si disponible) ───────────────────────────────
|
||||
ax6 = fig.add_subplot(gs[3, :])
|
||||
if not results_df.empty:
|
||||
for model_name, grp in results_df.groupby('model'):
|
||||
ax6.plot(grp['test_date'], grp['mae'], marker='o', label=model_name, linewidth=1.5)
|
||||
ax6.axhline(results_df['baseline_mae'].median(), color='black',
|
||||
linestyle='--', label='Baseline (zéro)', linewidth=1.5)
|
||||
ax6.set_title('Walk-Forward Validation — MAE par modèle', fontsize=12, fontweight='bold')
|
||||
ax6.set_ylabel('MAE (€)')
|
||||
ax6.legend()
|
||||
ax6.tick_params(axis='x', rotation=20)
|
||||
else:
|
||||
ax6.axis('off')
|
||||
# Schéma du walk-forward
|
||||
ax6.set_xlim(0, 10)
|
||||
ax6.set_ylim(0, 3)
|
||||
ax6.set_title('Walk-Forward Validation — Schéma', fontsize=12, fontweight='bold')
|
||||
ax6.set_facecolor('white')
|
||||
|
||||
colors_wf = [COLORS[0], COLORS[2], COLORS[3]]
|
||||
for fold_i in range(5):
|
||||
# Fenêtre train
|
||||
ax6.barh(2, fold_i + 2, left=0, height=0.35,
|
||||
color=COLORS[0], alpha=0.3 + fold_i * 0.08)
|
||||
# Fenêtre test
|
||||
ax6.barh(2, 1, left=fold_i + 2, height=0.35, color=COLORS[3], alpha=0.8)
|
||||
|
||||
ax6.text(3, 2.55, 'Train (expanding window)', fontsize=10, color=COLORS[0], fontweight='bold')
|
||||
ax6.text(5.5, 2.55, 'Test', fontsize=10, color=COLORS[3], fontweight='bold')
|
||||
ax6.text(0.2, 1.4,
|
||||
"Fold 1 : train t₁…t₂ → test t₃\n"
|
||||
"Fold 2 : train t₁…t₃ → test t₄\n"
|
||||
"Fold 3 : train t₁…t₄ → test t₅\n"
|
||||
" ...\n"
|
||||
"→ Évite tout data leakage temporel\n"
|
||||
"→ MAE et R² calculés sur chaque fenêtre de test",
|
||||
fontsize=10, fontfamily='monospace',
|
||||
bbox=dict(boxstyle='round', facecolor='#eaf2fb', alpha=0.8))
|
||||
ax6.set_yticks([])
|
||||
ax6.set_xticks([])
|
||||
|
||||
plt.suptitle('Carmignac × ENSAE — Pipeline : Performance → Flux nets',
|
||||
fontsize=15, fontweight='bold', y=1.01)
|
||||
|
||||
output_path = '/mnt/user-data/outputs/carmignac_pipeline_viz.png'
|
||||
plt.savefig(output_path, dpi=150, bbox_inches='tight', facecolor='white')
|
||||
plt.close()
|
||||
print(f"✅ Visualisation sauvegardée : {output_path}")
|
||||
|
||||
# =============================================================================
|
||||
# 8. RÉSUMÉ & INSTRUCTIONS POUR LES DONNÉES COMPLÈTES
|
||||
# =============================================================================
|
||||
|
||||
print("\n" + "=" * 60)
|
||||
print("8. RÉSUMÉ & PROCHAINES ÉTAPES")
|
||||
print("=" * 60)
|
||||
|
||||
print("""
|
||||
PIPELINE IMPLÉMENTÉ
|
||||
───────────────────
|
||||
Étape 1 — Chargement
|
||||
• equity_stocks_head.csv : AUM mensuels par (compte, fonds, shareclass)
|
||||
• weekly_perf_head.csv : performances hebdomadaires par shareclass
|
||||
|
||||
Étape 2 — Jointure (clé construite)
|
||||
• Parsing shareClass_name → (strategy, type, currency)
|
||||
• Matching vers ISIN via stocks
|
||||
• merge_asof temporel (tolérance ±35j)
|
||||
⚠ En production : utiliser Peers.csv (Morningstar) comme table de référence
|
||||
ISIN complète pour éviter les non-matchés.
|
||||
|
||||
Étape 3 — Feature Engineering
|
||||
• AUM features : lag 1m, lag 3m, croissance 1m, croissance 3m
|
||||
• Perf absolue : return_6MoRet, return_1YrRet (lags à t)
|
||||
• Perf relative : percentile_6MoRet, percentile_1YrRet (vs peers)
|
||||
• Variable cible : ΔAum(t→t+1) [proxy flux nets]
|
||||
⚠ En production : remplacer ΔAum par flux_net = souscriptions - rachats
|
||||
|
||||
Étape 4 — Modèles
|
||||
• Baseline : prédiction zéro
|
||||
• Ridge Regression (linéaire régularisée)
|
||||
• Random Forest (non-linéaire, robuste)
|
||||
• Gradient Boosting (state-of-the-art tabulaire)
|
||||
|
||||
Étape 5 — Validation
|
||||
• Walk-forward expanding window (pas de data leakage)
|
||||
• Métriques : MAE, R²
|
||||
|
||||
POUR LANCER SUR LES DONNÉES COMPLÈTES
|
||||
──────────────────────────────────────
|
||||
1. Remplacer PATH_STOCKS et PATH_PERF par les vrais fichiers
|
||||
2. Ajouter le fichier Peers.csv dans la fonction parse_shareclass_name
|
||||
(jointure directe par ISIN si disponible dans perf complet)
|
||||
3. Remplacer flux_net_proxy par les vraies transactions brutes
|
||||
(fichier flux quotidiens → agrégation mensuelle par compte × fonds)
|
||||
4. Ajouter des features macro (€STR, indices obligataires) depuis
|
||||
market_data/esterRates.csv et Eur_Gov_Indices.xlsx
|
||||
|
||||
LECTURE DES RÉSULTATS
|
||||
──────────────────────
|
||||
La littérature (Sirri & Tufano 1998) prédit une relation CONVEXE :
|
||||
→ Les fonds en haut de percentile (top quartile) attirent des flux
|
||||
disproportionnés
|
||||
→ Les fonds en bas ne perdent pas symétriquement (« smart money »)
|
||||
→ Tester une feature non-linéaire : percentile² ou dummy top/bottom quartile
|
||||
""")
|
||||
12620
client_clusters.csv
12620
client_clusters.csv
File diff suppressed because it is too large
Load Diff
BIN
cluster_map.png
BIN
cluster_map.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
|
@ -1,28 +0,0 @@
|
|||
from sklearn.preprocessing import RobustScaler
|
||||
from sklearn.cluster import KMeans
|
||||
|
||||
def run_clustering_pipeline(feature_df, n_clusters=4):
|
||||
"""
|
||||
Scales features and clusters clients.
|
||||
"""
|
||||
# 1. Preprocessing
|
||||
# Fill missing sensitivities with 0 (neutral) for clients with insufficient history
|
||||
df_clean = feature_df.fillna(0)
|
||||
|
||||
# RobustScaler over StandardScaler for financial data bc less influenced by 'Whale' clients.
|
||||
scaler = RobustScaler()
|
||||
scaled_data = scaler.fit_transform(df_clean)
|
||||
|
||||
# 2. Clustering
|
||||
kmeans = KMeans(n_clusters=n_clusters, random_state=42, n_init=10)
|
||||
labels = kmeans.fit_predict(scaled_data)
|
||||
|
||||
# 3. Attach labels
|
||||
results = df_clean.copy()
|
||||
results['Cluster'] = labels
|
||||
|
||||
return results, kmeans.cluster_centers_, scaler # Returns 3 items
|
||||
|
||||
def get_cluster_profiles(results_df):
|
||||
"""Returns the average profile of each cluster."""
|
||||
return results_df.groupby('Cluster').mean()
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
--- Cluster Profiles (Mean Values), original regression ---
|
||||
Cluster 0 1 2
|
||||
total_subs 8.848696e+06 1.866568e+07 0.000000e+00
|
||||
total_reds -9.907930e+06 -1.866568e+07 -7.255456e+03
|
||||
net_flow_vol -1.059233e+06 0.000000e+00 -7.255456e+03
|
||||
txn_count 1.493652e+02 1.000000e+00 2.000000e+00
|
||||
tenure_days 5.199713e+02 0.000000e+00 0.000000e+00
|
||||
buy_sell_ratio 1.508150e+08 3.733136e+13 -1.000000e+00
|
||||
pct_flow_ALTERNATIVE 1.857841e-02 0.000000e+00 0.000000e+00
|
||||
pct_flow_DIVERSIFIED 1.845385e+02 0.000000e+00 1.443736e+10
|
||||
pct_flow_EQUITY 8.731666e-02 0.000000e+00 0.000000e+00
|
||||
pct_flow_FIXED INCOME -1.842562e+02 1.000000e+00 -1.443736e+10
|
||||
pct_flow_NAN 3.976915e-04 0.000000e+00 0.000000e+00
|
||||
pct_flow_PRIVATE ASSETS 9.285151e-04 0.000000e+00 0.000000e+00
|
||||
avg_aum 8.342624e+05 1.482901e+07 2.185214e+04
|
||||
aum_volatility 8.135300e+05 8.274060e+06 2.058599e+02
|
||||
Registrar Account - ID 0.000000e+00 0.000000e+00 0.000000e+00
|
||||
alpha 0.000000e+00 0.000000e+00 0.000000e+00
|
||||
beta_rate 0.000000e+00 0.000000e+00 0.000000e+00
|
||||
beta_bond 0.000000e+00 0.000000e+00 0.000000e+00
|
||||
r_squared 0.000000e+00 0.000000e+00 0.000000e+00
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
import pandas as pd
|
||||
import os
|
||||
import s3fs
|
||||
fs = s3fs.S3FileSystem(
|
||||
client_kwargs={'endpoint_url': 'https://'+'minio-simple.lab.groupe-genes.fr'},
|
||||
key = os.environ["AWS_ACCESS_KEY_ID"],
|
||||
secret = os.environ["AWS_SECRET_ACCESS_KEY"],
|
||||
token = os.environ["AWS_SESSION_TOKEN"])
|
||||
|
||||
def load_and_clean_data(rates_path, gov_path):
|
||||
# Enforce string types for IDs to prevent 'Mixed Type' warnings
|
||||
dtype_spec = {
|
||||
'Registrar Account - ID': str,
|
||||
'Company - Id': str,
|
||||
'Company - Ultimate Parent Id': str,
|
||||
'Agreement - Code': str
|
||||
}
|
||||
with fs.open('s3://projet-bdc-carmignac-g3/AUM_repaired.csv', 'rb') as f:
|
||||
aum = pd.read_csv(f, sep=",", dtype=dtype_spec)
|
||||
|
||||
with fs.open('s3://projet-bdc-carmignac-g3/flows.csv', 'rb') as f:
|
||||
flows = pd.read_csv(f, sep=",", dtype=dtype_spec)
|
||||
|
||||
flows['Centralisation Date'] = pd.to_datetime(flows['Centralisation Date'])
|
||||
aum['Centralisation Date'] = pd.to_datetime(aum['Centralisation Date'])
|
||||
|
||||
# Market data loading (Standardizing dates)
|
||||
print("Loading Market Data...")
|
||||
rates = pd.read_csv(rates_path)
|
||||
try:
|
||||
rates['Date'] = pd.to_datetime(rates['Date'], dayfirst=True)
|
||||
except:
|
||||
rates['Date'] = pd.to_datetime(rates['Date'])
|
||||
|
||||
gov = pd.read_csv(gov_path)
|
||||
try:
|
||||
gov['Date'] = pd.to_datetime(gov['Date'], dayfirst=True)
|
||||
except:
|
||||
gov['Date'] = pd.to_datetime(gov['Date'])
|
||||
|
||||
return flows, aum, rates, gov
|
||||
|
|
@ -1,225 +0,0 @@
|
|||
import pandas as pd
|
||||
import statsmodels.api as sm
|
||||
import numpy as np
|
||||
|
||||
def compute_static_features(flows_df, aum_df):
|
||||
"""Generates descriptive features from Flows and AUM."""
|
||||
|
||||
# --- 1. Flow Dynamics ---
|
||||
flow_stats = flows_df.groupby('Registrar Account - ID').agg(
|
||||
total_subs=('Value € - Subscription', 'sum'),
|
||||
total_reds=('Value € - Redemption', 'sum'),
|
||||
net_flow_vol=('Value € - NetFlows', 'sum'),
|
||||
txn_count=('Agreement - Code', 'count'),
|
||||
tenure_days=('Centralisation Date', lambda x: (x.max() - x.min()).days)
|
||||
)
|
||||
|
||||
# Robust Buy/Sell Ratio
|
||||
total_vol = flow_stats['total_subs'].abs() + flow_stats['total_reds'].abs()
|
||||
flow_stats['buy_sell_ratio'] = (flow_stats['total_subs'] - flow_stats['total_reds']) / (total_vol + 1.0)
|
||||
flow_stats['buy_sell_ratio'] = flow_stats['buy_sell_ratio'].clip(-1, 1)
|
||||
|
||||
# --- 2. Product Preferences ---
|
||||
pos_flows = flows_df[flows_df['Value € - Subscription'] > 0]
|
||||
asset_pivot = pos_flows.groupby(['Registrar Account - ID', 'Product - Asset Type'])['Value € - Subscription'].sum().unstack(fill_value=0)
|
||||
|
||||
row_sums = asset_pivot.sum(axis=1)
|
||||
asset_pct = asset_pivot.div(row_sums + 1.0, axis=0).add_prefix('pct_flow_')
|
||||
|
||||
# --- 3. AUM Stats ---
|
||||
aum_stats = aum_df.groupby('Registrar Account - ID').agg(
|
||||
avg_aum=('Value - AUM €', 'mean'),
|
||||
aum_volatility=('Value - AUM €', 'std')
|
||||
)
|
||||
|
||||
features = flow_stats.join(asset_pct).join(aum_stats, how='outer').fillna(0)
|
||||
return features
|
||||
|
||||
def compute_shock_sensitivities(flows_df, aum_df, rates_df, gov_df, freq='ME'):
|
||||
"""
|
||||
Computes sensitivity using Robust OLS + Dynamic Feature Selection.
|
||||
Only targets HIGHLY ACTIVE clients (>= 250 transactions).
|
||||
"""
|
||||
print(f"DEBUG: Computing Sensitivities (Threshold=250)...")
|
||||
|
||||
# --- 1. Prepare Market Factors ---
|
||||
# Force Numeric Types
|
||||
rates_df['Yld to Maturity'] = pd.to_numeric(rates_df['Yld to Maturity'], errors='coerce')
|
||||
gov_df['Total Return % 1-wk-LOC'] = pd.to_numeric(gov_df['Total Return % 1-wk-LOC'], errors='coerce')
|
||||
|
||||
rates_res = rates_df.set_index('Date').resample(freq)['Yld to Maturity'].last()
|
||||
delta_rates = rates_res.diff()
|
||||
|
||||
gov_target = gov_df[gov_df['Bond/Index'] == 'EG04'].set_index('Date')
|
||||
gov_target = gov_target[~gov_target.index.duplicated(keep='first')]
|
||||
gov_res = gov_target['Total Return % 1-wk-LOC'].resample(freq).apply(lambda x: (1 + x/100).prod() - 1)
|
||||
|
||||
market_df = pd.concat([delta_rates.rename('Delta_Rate'), gov_res.rename('Bond_Return')], axis=1).dropna()
|
||||
|
||||
# String Period Index for Robust Merging
|
||||
market_df['Period_Str'] = market_df.index.to_period(freq).astype(str)
|
||||
market_df = market_df.set_index('Period_Str')
|
||||
|
||||
# --- 2. Define Shocks ---
|
||||
rate_q1 = market_df['Delta_Rate'].quantile(0.25)
|
||||
rate_q3 = market_df['Delta_Rate'].quantile(0.75)
|
||||
bond_q1 = market_df['Bond_Return'].quantile(0.25)
|
||||
bond_q3 = market_df['Bond_Return'].quantile(0.75)
|
||||
|
||||
market_df['Rate_Spike'] = (market_df['Delta_Rate'] > rate_q3).astype(int)
|
||||
market_df['Rate_Drop'] = (market_df['Delta_Rate'] < rate_q1).astype(int)
|
||||
market_df['Bond_Rally'] = (market_df['Bond_Return'] > bond_q3).astype(int)
|
||||
market_df['Bond_Crash'] = (market_df['Bond_Return'] < bond_q1).astype(int)
|
||||
|
||||
all_shock_cols = ['Rate_Spike', 'Rate_Drop', 'Bond_Rally', 'Bond_Crash']
|
||||
|
||||
# --- 3. Funneling ---
|
||||
aum_df['Value - AUM €'] = pd.to_numeric(aum_df['Value - AUM €'], errors='coerce')
|
||||
mean_aum = aum_df.groupby('Registrar Account - ID')['Value - AUM €'].mean()
|
||||
valid_aum_clients = mean_aum[mean_aum > 1000].index
|
||||
|
||||
# --- UPDATED THRESHOLD HERE ---
|
||||
txn_counts = flows_df['Registrar Account - ID'].value_counts()
|
||||
active_clients = txn_counts[txn_counts >= 250].index
|
||||
|
||||
eligible_clients = list(set(valid_aum_clients) & set(active_clients))
|
||||
|
||||
print(f"Shock Model Funnel: {len(eligible_clients)} clients eligible (Active >= 250 txns).")
|
||||
|
||||
# --- 4. Regression ---
|
||||
flows_df['Period_Str'] = flows_df['Centralisation Date'].dt.to_period(freq).astype(str)
|
||||
flows_df['Quantity - NetFlows'] = pd.to_numeric(flows_df['Quantity - NetFlows'], errors='coerce')
|
||||
|
||||
client_betas = []
|
||||
success_count = 0
|
||||
failure_printed = False
|
||||
|
||||
for client in eligible_clients:
|
||||
c_flows = flows_df[flows_df['Registrar Account - ID'] == client]
|
||||
c_ts = c_flows.groupby('Period_Str')['Quantity - NetFlows'].sum()
|
||||
|
||||
merged = pd.merge(c_ts, market_df, left_index=True, right_index=True, how='inner')
|
||||
|
||||
if len(merged) >= 6:
|
||||
client_avg_wealth = mean_aum.loc[client]
|
||||
|
||||
# Skip invalid AUM
|
||||
if not np.isfinite(client_avg_wealth) or client_avg_wealth == 0:
|
||||
continue
|
||||
|
||||
Y = merged['Quantity - NetFlows'] / client_avg_wealth
|
||||
|
||||
# --- Dynamic Feature Selection ---
|
||||
# Drop shock columns that are all zeros (event never happened for this client)
|
||||
valid_cols = []
|
||||
for col in all_shock_cols:
|
||||
if merged[col].sum() > 0:
|
||||
valid_cols.append(col)
|
||||
|
||||
X = merged[valid_cols]
|
||||
X = sm.add_constant(X)
|
||||
|
||||
# Check data validity
|
||||
if Y.isna().any() or X.isna().any().any():
|
||||
if not failure_printed:
|
||||
print(f"DEBUG CRASH: Client {client} has NaNs.")
|
||||
failure_printed = True
|
||||
continue
|
||||
|
||||
try:
|
||||
model = sm.OLS(Y, X).fit()
|
||||
|
||||
result_dict = {
|
||||
'Registrar Account - ID': client,
|
||||
'alpha_normal': model.params.get('const', 0),
|
||||
'shock_r_squared': model.rsquared
|
||||
}
|
||||
# Fill missing betas with 0
|
||||
for col in all_shock_cols:
|
||||
result_dict[f'beta_{col.lower()}'] = model.params.get(col, 0)
|
||||
|
||||
client_betas.append(result_dict)
|
||||
success_count += 1
|
||||
except Exception as e:
|
||||
if not failure_printed:
|
||||
print(f"DEBUG CRASH: {e}")
|
||||
failure_printed = True
|
||||
continue
|
||||
|
||||
print(f"DEBUG: Successfully modeled {success_count} clients.")
|
||||
|
||||
if not client_betas:
|
||||
return pd.DataFrame(columns=['Registrar Account - ID', 'alpha_normal',
|
||||
'beta_rate_spike', 'beta_rate_drop',
|
||||
'beta_bond_rally', 'beta_bond_crash', 'shock_r_squared'])
|
||||
|
||||
return pd.DataFrame(client_betas).set_index('Registrar Account - ID')
|
||||
|
||||
def compute_linear_sensitivities(flows_df, aum_df, rates_df, gov_df, freq='M'):
|
||||
"""
|
||||
Computes standard linear sensitivity: Flow ~ Alpha + Beta_Rate * dRate + Beta_Bond * BondRet
|
||||
"""
|
||||
print(f"DEBUG: Computing Sensitivities (Linear Model)...")
|
||||
|
||||
# 1. Prepare Market Data
|
||||
rates_df['Yld to Maturity'] = pd.to_numeric(rates_df['Yld to Maturity'], errors='coerce')
|
||||
gov_df['Total Return % 1-wk-LOC'] = pd.to_numeric(gov_df['Total Return % 1-wk-LOC'], errors='coerce')
|
||||
|
||||
rates_res = rates_df.set_index('Date').resample(freq)['Yld to Maturity'].last()
|
||||
delta_rates = rates_res.diff()
|
||||
|
||||
gov_target = gov_df[gov_df['Bond/Index'] == 'EG04'].set_index('Date')
|
||||
gov_target = gov_target[~gov_target.index.duplicated(keep='first')]
|
||||
gov_res = gov_target['Total Return % 1-wk-LOC'].resample(freq).apply(lambda x: (1 + x/100).prod() - 1)
|
||||
|
||||
market_df = pd.concat([delta_rates.rename('Delta_Rate'), gov_res.rename('Bond_Return')], axis=1).dropna()
|
||||
market_df['Period_Str'] = market_df.index.to_period(freq).astype(str)
|
||||
market_df = market_df.set_index('Period_Str')
|
||||
|
||||
# 2. Funneling
|
||||
aum_df['Value - AUM €'] = pd.to_numeric(aum_df['Value - AUM €'], errors='coerce')
|
||||
mean_aum = aum_df.groupby('Registrar Account - ID')['Value - AUM €'].mean()
|
||||
valid_aum_clients = mean_aum[mean_aum > 1000].index
|
||||
|
||||
txn_counts = flows_df['Registrar Account - ID'].value_counts()
|
||||
active_clients = txn_counts[txn_counts >= 250].index
|
||||
eligible_clients = list(set(valid_aum_clients) & set(active_clients))
|
||||
|
||||
print(f"Linear Model Funnel: {len(eligible_clients)} clients eligible.")
|
||||
|
||||
# 3. Regression
|
||||
flows_df['Period_Str'] = flows_df['Centralisation Date'].dt.to_period(freq).astype(str)
|
||||
flows_df['Quantity - NetFlows'] = pd.to_numeric(flows_df['Quantity - NetFlows'], errors='coerce')
|
||||
|
||||
client_betas = []
|
||||
|
||||
for client in eligible_clients:
|
||||
c_flows = flows_df[flows_df['Registrar Account - ID'] == client]
|
||||
c_ts = c_flows.groupby('Period_Str')['Quantity - NetFlows'].sum()
|
||||
|
||||
merged = pd.merge(c_ts, market_df, left_index=True, right_index=True, how='inner')
|
||||
|
||||
if len(merged) >= 6:
|
||||
client_avg_wealth = mean_aum.loc[client]
|
||||
if not np.isfinite(client_avg_wealth) or client_avg_wealth == 0: continue
|
||||
|
||||
Y = merged['Quantity - NetFlows'] / client_avg_wealth
|
||||
X = merged[['Delta_Rate', 'Bond_Return']]
|
||||
X = sm.add_constant(X)
|
||||
|
||||
try:
|
||||
model = sm.OLS(Y, X).fit()
|
||||
client_betas.append({
|
||||
'Registrar Account - ID': client,
|
||||
'alpha_linear': model.params.get('const', 0),
|
||||
'beta_rate_linear': model.params.get('Delta_Rate', 0),
|
||||
'beta_bond_linear': model.params.get('Bond_Return', 0),
|
||||
'linear_r_squared': model.rsquared
|
||||
})
|
||||
except:
|
||||
continue
|
||||
|
||||
if not client_betas:
|
||||
return pd.DataFrame(columns=['Registrar Account - ID', 'alpha_linear', 'beta_rate_linear', 'beta_bond_linear', 'linear_r_squared'])
|
||||
|
||||
return pd.DataFrame(client_betas).set_index('Registrar Account - ID')
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
import pandas as pd
|
||||
from data_loader import load_and_clean_data
|
||||
from features import compute_static_features, compute_shock_sensitivities
|
||||
from clustering import run_clustering_pipeline, get_cluster_profiles
|
||||
|
||||
def main():
|
||||
print("--- Starting Carmignac Client Clustering Pipeline ---")
|
||||
|
||||
print("Loading data...")
|
||||
flows, aum, rates, gov = load_and_clean_data(
|
||||
rates_path='data/str_rates.csv',
|
||||
gov_path='data/eur_gov_indices.csv'
|
||||
)
|
||||
|
||||
# 2. Feature Engineering
|
||||
print("Computing static features...")
|
||||
static_feats = compute_static_features(flows, aum)
|
||||
|
||||
# Option 1: Run Shock Model (Default)
|
||||
sensitivity_feats = compute_shock_sensitivities(flows, aum, rates, gov, freq='ME')
|
||||
|
||||
# Option 2: Run Linear Model (Uncomment to use)
|
||||
# sensitivity_feats = compute_linear_sensitivities(flows, aum, rates, gov, freq='ME')
|
||||
|
||||
# Merge features
|
||||
full_features = static_feats.join(sensitivity_feats, how='left')
|
||||
|
||||
# Fill missing sensitivities with 0 (Passive clients)
|
||||
shock_cols = ['alpha_normal', 'beta_rate_spike', 'beta_rate_drop',
|
||||
'beta_bond_rally', 'beta_bond_crash', 'shock_r_squared']
|
||||
full_features[shock_cols] = full_features[shock_cols].fillna(0)
|
||||
|
||||
print(f"Final Feature Matrix: {full_features.shape}")
|
||||
|
||||
# 3. Clustering
|
||||
print("Running Clustering...")
|
||||
clustered_df, centers, scaler = run_clustering_pipeline(full_features, n_clusters=3)
|
||||
|
||||
# 4. Results
|
||||
print("\n--- Cluster Profiles (Mean Values) ---")
|
||||
profiles = get_cluster_profiles(clustered_df)
|
||||
print(profiles.T)
|
||||
|
||||
clustered_df.to_csv('client_clusters.csv')
|
||||
print("\nResults saved to 'client_clusters.csv'")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
import pandas as pd
|
||||
import matplotlib.pyplot as plt
|
||||
import seaborn as sns
|
||||
from sklearn.decomposition import PCA
|
||||
from sklearn.preprocessing import RobustScaler
|
||||
|
||||
def plot_clusters():
|
||||
print("--- Generating Cluster Visualization ---")
|
||||
|
||||
# 1. Load the results from main.py
|
||||
try:
|
||||
df = pd.read_csv('client_clusters.csv', index_col=0)
|
||||
except FileNotFoundError:
|
||||
print("Error: Run main.py first to generate 'client_clusters.csv'")
|
||||
return
|
||||
|
||||
# 2. Prepare Data for PCA
|
||||
# Drop non-numeric or ID columns if any linger (though index handled it)
|
||||
X = df.drop(columns=['Cluster'])
|
||||
|
||||
# Scale (Critical for PCA)
|
||||
scaler = RobustScaler()
|
||||
X_scaled = scaler.fit_transform(X)
|
||||
|
||||
# 3. Run PCA (Reduce to 2 Dimensions)
|
||||
pca = PCA(n_components=2)
|
||||
components = pca.fit_transform(X_scaled)
|
||||
|
||||
# Create plotting DataFrame
|
||||
plot_df = pd.DataFrame(data=components, columns=['PC1', 'PC2'], index=X.index)
|
||||
plot_df['Cluster'] = df['Cluster'].astype(str) # Convert to string for discrete colors
|
||||
|
||||
# 4. Plot
|
||||
plt.figure(figsize=(12, 8))
|
||||
sns.scatterplot(
|
||||
data=plot_df,
|
||||
x='PC1',
|
||||
y='PC2',
|
||||
hue='Cluster',
|
||||
style='Cluster',
|
||||
palette='viridis',
|
||||
s=60,
|
||||
alpha=0.8
|
||||
)
|
||||
|
||||
plt.title('Client Segmentation Map (PCA Projection)', fontsize=16)
|
||||
plt.xlabel(f'Principal Component 1 ({pca.explained_variance_ratio_[0]:.1%} Variance)', fontsize=12)
|
||||
plt.ylabel(f'Principal Component 2 ({pca.explained_variance_ratio_[1]:.1%} Variance)', fontsize=12)
|
||||
plt.legend(title='Cluster ID', bbox_to_anchor=(1.05, 1), loc='upper left')
|
||||
plt.grid(True, linestyle='--', alpha=0.3)
|
||||
|
||||
plt.tight_layout()
|
||||
plt.savefig('cluster_map.png', dpi=300)
|
||||
print("Visualization saved to 'cluster_map.png'")
|
||||
|
||||
if __name__ == "__main__":
|
||||
plot_clusters()
|
||||
151156
data_exploration/carmignac_perf.csv
Normal file
151156
data_exploration/carmignac_perf.csv
Normal file
File diff suppressed because it is too large
Load Diff
|
|
@ -1,151 +0,0 @@
|
|||
,Agreement - Code,Company - Id,Company - Ultimate Parent Id,Registrar Account - ID,Registrar Account - Region,RegistrarAccount - Country,Product - Asset Type,Product - Strategy,Product - Legal Status,Product - Is Dedie ?,Product - Fund,Product - Shareclass Type,Product - Shareclass Currency,Product - Isin,Centralisation Date,Quantity - AUM,Value - AUM CCY,Value - AUM €
|
||||
0,1010,976.0,16697.0,416573,France,France,Equity,Asia Discovery,SICAV,NO,Carmignac Portfolio Asia Discovery,A,EUR,LU0336083810,2015-02-28,109.305,143606.0021,143606.0021
|
||||
1,1010,976.0,16697.0,416573,France,France,Equity,Asia Discovery,SICAV,NO,Carmignac Portfolio Asia Discovery,A,EUR,LU0336083810,2016-06-30,103.933,134698.2073,134698.2073
|
||||
2,1010,976.0,16697.0,416573,France,France,Equity,Asia Discovery,SICAV,NO,Carmignac Portfolio Asia Discovery,A,EUR,LU0336083810,2016-09-30,102.714,142998.4308,142998.4308
|
||||
3,1010,976.0,16697.0,416573,France,France,Equity,Climate Transition,SICAV,NO,Carmignac Portfolio Climate Transition,A,EUR,LU0164455502,2015-11-30,3679.082,959283.8407,959283.8407
|
||||
4,1010,976.0,16697.0,416573,France,France,Equity,Climate Transition,SICAV,NO,Carmignac Portfolio Climate Transition,A,EUR,LU0164455502,2015-12-31,3667.679,878812.5652,878812.5652
|
||||
5,1010,976.0,16697.0,416573,France,France,Equity,Climate Transition,SICAV,NO,Carmignac Portfolio Climate Transition,A,EUR,LU0164455502,2016-08-31,3662.97,963470.9991,963470.9991
|
||||
6,1010,976.0,16697.0,416573,France,France,Equity,Climate Transition,SICAV,NO,Carmignac Portfolio Climate Transition,A,EUR,LU0164455502,2016-10-31,3596.972,966362.4975,966362.4975
|
||||
7,1010,976.0,16697.0,416573,France,France,Equity,Euro-Entrepreneurs,FCP,NO,Carmignac Euro-Entrepreneurs,A,EUR,FR0010149112,2016-04-30,6313.81135,1749430.8489,1749430.8489
|
||||
8,1010,976.0,16697.0,416573,France,France,Equity,Euro-Entrepreneurs,FCP,NO,Carmignac Euro-Entrepreneurs,A,EUR,FR0010149112,2016-08-31,6031.89135,1729343.25,1729343.25
|
||||
9,1010,976.0,16697.0,416573,France,France,Equity,Grande Europe,SICAV,NO,Carmignac Portfolio Grande Europe,A,EUR,LU0099161993,2017-02-28,30.832,5696.212,5696.212
|
||||
10,1010,976.0,16697.0,416573,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,A,EUR,FR0010148981,2015-09-30,10681.012,11312580.2396,11312580.2396
|
||||
11,1010,976.0,16697.0,416573,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,E,EUR,FR0010312660,2017-02-28,9.909,1726.346,1726.346
|
||||
12,1010,976.0,16697.0,416573,France,France,Equity,Investissement Latitude,FCP,NO,Carmignac Investissement Latitude,A,EUR,FR0010147603,2015-06-30,15248.877,4471123.2252,4471123.2252
|
||||
13,1010,976.0,16697.0,416573,France,France,Equity,Investissement Latitude,FCP,NO,Carmignac Investissement Latitude,A,EUR,FR0010147603,2016-01-31,14252.798,3495641.2375,3495641.2375
|
||||
14,1010,976.0,16697.0,416573,France,France,Equity,Investissement Latitude,FCP,NO,Carmignac Investissement Latitude,A,EUR,FR0010147603,2017-02-28,10364.128,2718821.6982,2718821.6982
|
||||
15,1010,976.0,16697.0,416573,France,France,Equity,Investissement Latitude,FCP,NO,Carmignac Investissement Latitude,A,EUR,FR0010147603,2017-03-31,9979.059,2617706.7569,2617706.7569
|
||||
16,1010,976.0,16697.0,416573,France,France,Equity,Large Cap Emerging Markets Strategy,FCP,NO,Carmignac Emergents,A,EUR,FR0010149302,2015-07-31,6933.327,5740170.7566,5740170.7566
|
||||
17,1010,976.0,16697.0,416573,France,France,Equity,Large Cap Emerging Markets Strategy,FCP,NO,Carmignac Emergents,A,EUR,FR0010149302,2016-07-31,6097.532,5045402.8534,5045402.8534
|
||||
18,1010,976.0,16697.0,416573,France,France,Equity,Large Cap Emerging Markets Strategy,FCP,NO,Carmignac Emergents,A,EUR,FR0010149302,2016-09-30,6140.529,5122367.8865,5122367.8865
|
||||
19,1010,976.0,16697.0,416573,France,France,Equity,Large Cap Emerging Markets Strategy,FCP,NO,Carmignac Emergents,A,EUR,FR0010149302,2016-11-30,6201.72,4932724.0536,4932724.0536
|
||||
20,1010,976.0,16697.0,416573,France,France,Equity,Large Cap Emerging Markets Strategy,FCP,NO,Carmignac Emergents,A,EUR,FR0010149302,2016-12-31,5864.435,4711311.146,4711311.146
|
||||
21,1012,6340.0,16625.0,416580,France,France,Equity,Asia Discovery,SICAV,NO,Carmignac Portfolio Asia Discovery,A,EUR,LU0336083810,2015-01-31,246.0,321015.24,321015.24
|
||||
22,1012,6340.0,16625.0,416580,France,France,Equity,Asia Discovery,SICAV,NO,Carmignac Portfolio Asia Discovery,A,EUR,LU0336083810,2015-05-31,207.0,285173.55,285173.55
|
||||
23,1012,6340.0,16625.0,416580,France,France,Equity,Asia Discovery,SICAV,NO,Carmignac Portfolio Asia Discovery,A,EUR,LU0336083810,2019-07-31,0.0,0.0,0.0
|
||||
24,1012,6340.0,16625.0,416580,France,France,Equity,Asia Discovery,SICAV,NO,Carmignac Portfolio Asia Discovery,A,EUR,LU0336083810,2020-02-29,0.0,0.0,0.0
|
||||
25,1012,6340.0,16625.0,416580,France,France,Equity,Asia Discovery,SICAV,NO,Carmignac Portfolio Asia Discovery,A,EUR,LU0336083810,2020-05-31,0.0,0.0,0.0
|
||||
26,1012,6340.0,16625.0,416580,France,France,Equity,Asia Discovery,SICAV,NO,Carmignac Portfolio Asia Discovery,A,EUR,LU0336083810,2021-04-30,0.0,0.0,0.0
|
||||
27,1012,6340.0,16625.0,416580,France,France,Equity,Climate Transition,SICAV,NO,Carmignac Portfolio Climate Transition,A,EUR,LU0164455502,2015-03-31,18625.0,5724580.0,5724580.0
|
||||
28,1012,6340.0,16625.0,416580,France,France,Equity,Climate Transition,SICAV,NO,Carmignac Portfolio Climate Transition,A,EUR,LU0164455502,2015-10-31,17736.0,4634948.88,4634948.88
|
||||
29,1012,6340.0,16625.0,416580,France,France,Equity,Climate Transition,SICAV,NO,Carmignac Portfolio Climate Transition,A,EUR,LU0164455502,2016-03-31,18639.0,4590412.92,4590412.92
|
||||
30,1012,6340.0,16625.0,416580,France,France,Equity,Climate Transition,SICAV,NO,Carmignac Portfolio Climate Transition,A,EUR,LU0164455502,2016-04-30,19207.0,4973076.44,4973076.44
|
||||
31,1012,6340.0,16625.0,416580,France,France,Equity,Climate Transition,SICAV,NO,Carmignac Portfolio Climate Transition,A,EUR,LU0164455502,2016-08-31,18945.0,4983103.35,4983103.35
|
||||
32,1012,6340.0,16625.0,416580,France,France,Equity,Climate Transition,SICAV,NO,Carmignac Portfolio Climate Transition,A,EUR,LU0164455502,2018-07-31,16786.0,5652685.5,5652685.5
|
||||
33,1012,6340.0,16625.0,416580,France,France,Equity,Climate Transition,SICAV,NO,Carmignac Portfolio Climate Transition,A,EUR,LU0164455502,2019-02-28,0.0,0.0,0.0
|
||||
34,1012,6340.0,16625.0,416580,France,France,Equity,Climate Transition,SICAV,NO,Carmignac Portfolio Climate Transition,A,EUR,LU0164455502,2019-03-31,0.0,0.0,0.0
|
||||
35,1012,6340.0,16625.0,416580,France,France,Equity,Climate Transition,SICAV,NO,Carmignac Portfolio Climate Transition,A,EUR,LU0164455502,2019-04-30,0.0,0.0,0.0
|
||||
36,1012,6340.0,16625.0,416580,France,France,Equity,Climate Transition,SICAV,NO,Carmignac Portfolio Climate Transition,A,EUR,LU0164455502,2020-02-29,0.0,0.0,0.0
|
||||
37,1012,6340.0,16625.0,416580,France,France,Equity,Climate Transition,SICAV,NO,Carmignac Portfolio Climate Transition,A,EUR,LU0164455502,2021-01-31,0.0,0.0,0.0
|
||||
38,1012,6340.0,16625.0,416580,France,France,Equity,Climate Transition,SICAV,NO,Carmignac Portfolio Climate Transition,A,EUR,LU0164455502,2021-05-31,0.0,0.0,0.0
|
||||
39,1012,6340.0,16625.0,416580,France,France,Equity,Euro-Entrepreneurs,FCP,NO,Carmignac Euro-Entrepreneurs,A,EUR,FR0010149112,2016-07-31,15336.302,4317015.65,4317015.65
|
||||
40,1012,6340.0,16625.0,416580,France,France,Equity,Euro-Entrepreneurs,FCP,NO,Carmignac Euro-Entrepreneurs,A,EUR,FR0010149112,2016-12-31,14127.302,4242004.9715,4242004.9715
|
||||
41,1012,6340.0,16625.0,416580,France,France,Equity,Euro-Entrepreneurs,FCP,NO,Carmignac Euro-Entrepreneurs,A,EUR,FR0010149112,2017-11-30,18086.302,6565327.626,6565327.626
|
||||
42,1012,6340.0,16625.0,416580,France,France,Equity,Euro-Entrepreneurs,FCP,NO,Carmignac Euro-Entrepreneurs,A,EUR,FR0010149112,2018-02-28,19086.302,7177785.5931,7177785.5931
|
||||
43,1012,6340.0,16625.0,416580,France,France,Equity,Euro-Entrepreneurs,FCP,NO,Carmignac Euro-Entrepreneurs,A,EUR,FR0010149112,2018-08-31,15840.302,5931876.293,5931876.293
|
||||
44,1012,6340.0,16625.0,416580,France,France,Equity,Euro-Entrepreneurs,FCP,NO,Carmignac Euro-Entrepreneurs,A,EUR,FR0010149112,2018-11-30,15497.302,5283650.1439,5283650.1439
|
||||
45,1012,6340.0,16625.0,416580,France,France,Equity,Euro-Entrepreneurs,FCP,NO,Carmignac Euro-Entrepreneurs,A,EUR,FR0010149112,2019-05-31,0.0,0.0,0.0
|
||||
46,1012,6340.0,16625.0,416580,France,France,Equity,Euro-Entrepreneurs,FCP,NO,Carmignac Euro-Entrepreneurs,A,EUR,FR0010149112,2020-02-29,0.0,0.0,0.0
|
||||
47,1012,6340.0,16625.0,416580,France,France,Equity,Euro-Entrepreneurs,FCP,NO,Carmignac Euro-Entrepreneurs,A,EUR,FR0010149112,2021-05-31,0.0,0.0,0.0
|
||||
48,1012,6340.0,16625.0,416580,France,France,Equity,Grande Europe,SICAV,NO,Carmignac Portfolio Grande Europe,A,EUR,LU0099161993,2015-06-30,246.0,46966.32,46966.32
|
||||
49,1012,6340.0,16625.0,416580,France,France,Equity,Grande Europe,SICAV,NO,Carmignac Portfolio Grande Europe,A,EUR,LU0099161993,2016-03-31,275.0,45501.5,45501.5
|
||||
50,1012,6340.0,16625.0,416580,France,France,Equity,Grande Europe,SICAV,NO,Carmignac Portfolio Grande Europe,A,EUR,LU0099161993,2019-02-28,0.0,0.0,0.0
|
||||
51,1012,6340.0,16625.0,416580,France,France,Equity,Grande Europe,SICAV,NO,Carmignac Portfolio Grande Europe,A,EUR,LU0099161993,2019-03-31,0.0,0.0,0.0
|
||||
52,1012,6340.0,16625.0,416580,France,France,Equity,Grande Europe,SICAV,NO,Carmignac Portfolio Grande Europe,A,EUR,LU0099161993,2019-06-30,0.0,0.0,0.0
|
||||
53,1012,6340.0,16625.0,416580,France,France,Equity,Grande Europe,SICAV,NO,Carmignac Portfolio Grande Europe,A,EUR,LU0099161993,2020-09-30,0.0,0.0,0.0
|
||||
54,1012,6340.0,16625.0,416580,France,France,Equity,Grande Europe,SICAV,NO,Carmignac Portfolio Grande Europe,A,EUR,LU0099161993,2020-12-31,0.0,0.0,0.0
|
||||
55,1012,6340.0,16625.0,416580,France,France,Equity,Grande Europe,SICAV,NO,Carmignac Portfolio Grande Europe,A,EUR,LU0099161993,2021-06-30,0.0,0.0,0.0
|
||||
56,1012,6340.0,16625.0,416580,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,A,EUR,FR0010148981,2015-06-30,30289.0,37940304.29,37940304.29
|
||||
57,1012,6340.0,16625.0,416580,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,A,EUR,FR0010148981,2016-01-31,27726.0,29364052.08,29364052.08
|
||||
58,1012,6340.0,16625.0,416580,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,A,EUR,FR0010148981,2017-02-28,23750.0,28166075.0,28166075.0
|
||||
59,1012,6340.0,16625.0,416580,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,A,EUR,FR0010148981,2017-03-31,23296.0,27853396.48,27853396.48
|
||||
60,1012,6340.0,16625.0,416580,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,A,EUR,FR0010148981,2017-04-30,23445.0,28341957.15,28341957.15
|
||||
61,1012,6340.0,16625.0,416580,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,A,EUR,FR0010148981,2017-08-31,22567.0,27121697.61,27121697.61
|
||||
62,1012,6340.0,16625.0,416580,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,A,EUR,FR0010148981,2017-10-31,22215.0,26971231.5,26971231.5
|
||||
63,1012,6340.0,16625.0,416580,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,A,EUR,FR0010148981,2018-09-30,18587.0,22442873.15,22442873.15
|
||||
64,1012,6340.0,16625.0,416580,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,A,EUR,FR0010148981,2019-09-30,0.0,0.0,0.0
|
||||
65,1012,6340.0,16625.0,416580,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,A,EUR,FR0010148981,2019-10-31,0.0,0.0,0.0
|
||||
66,1012,6340.0,16625.0,416580,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,A,EUR,FR0010148981,2020-03-31,0.0,0.0,0.0
|
||||
67,1012,6340.0,16625.0,416580,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,A,EUR,FR0010148981,2020-10-31,0.0,0.0,0.0
|
||||
68,1012,6340.0,16625.0,416580,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,A,EUR,FR0010148981,2021-07-31,0.0,0.0,0.0
|
||||
69,1012,6340.0,16625.0,416580,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,A,EUR,FR0010148981,2021-08-31,0.0,0.0,0.0
|
||||
70,1012,6340.0,16625.0,416580,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,E,EUR,FR0010312660,2015-06-30,4363.0,813132.31,813132.31
|
||||
71,1012,6340.0,16625.0,416580,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,E,EUR,FR0010312660,2015-12-31,3792.0,633643.2,633643.2
|
||||
72,1012,6340.0,16625.0,416580,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,E,EUR,FR0010312660,2016-01-31,3678.0,576820.74,576820.74
|
||||
73,1012,6340.0,16625.0,416580,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,E,EUR,FR0010312660,2017-03-31,2878.0,505204.12,505204.12
|
||||
74,1012,6340.0,16625.0,416580,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,E,EUR,FR0010312660,2017-04-30,2816.0,499558.4,499558.4
|
||||
75,1012,6340.0,16625.0,416580,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,E,EUR,FR0010312660,2017-05-31,2754.0,492966.0,492966.0
|
||||
76,1012,6340.0,16625.0,416580,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,E,EUR,FR0010312660,2017-10-31,2602.0,461724.9,461724.9
|
||||
77,1012,6340.0,16625.0,416580,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,E,EUR,FR0010312660,2019-06-30,0.0,0.0,0.0
|
||||
78,1012,6340.0,16625.0,416580,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,E,EUR,FR0010312660,2019-08-31,0.0,0.0,0.0
|
||||
79,1012,6340.0,16625.0,416580,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,E,EUR,FR0010312660,2020-03-31,0.0,0.0,0.0
|
||||
80,1012,6340.0,16625.0,416580,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,E,EUR,FR0010312660,2020-08-31,0.0,0.0,0.0
|
||||
81,1012,6340.0,16625.0,416580,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,E,EUR,FR0010312660,2020-09-30,0.0,0.0,0.0
|
||||
82,1012,6340.0,16625.0,416580,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,E,EUR,FR0010312660,2020-12-31,0.0,0.0,0.0
|
||||
83,1012,6340.0,16625.0,416580,France,France,Equity,Investissement Latitude,FCP,NO,Carmignac Investissement Latitude,A,EUR,FR0010147603,2015-08-31,19515.0,5133225.6,5133225.6
|
||||
84,1012,6340.0,16625.0,416580,France,France,Equity,Investissement Latitude,FCP,NO,Carmignac Investissement Latitude,A,EUR,FR0010147603,2017-02-28,13631.0,3575820.23,3575820.23
|
||||
85,1012,6340.0,16625.0,416580,France,France,Equity,Investissement Latitude,FCP,NO,Carmignac Investissement Latitude,A,EUR,FR0010147603,2017-05-31,12783.0,3382637.46,3382637.46
|
||||
86,1012,6340.0,16625.0,416580,France,France,Equity,Investissement Latitude,FCP,NO,Carmignac Investissement Latitude,A,EUR,FR0010147603,2017-07-31,12444.0,3323543.52,3323543.52
|
||||
87,1012,6340.0,16625.0,416580,France,France,Equity,Investissement Latitude,FCP,NO,Carmignac Investissement Latitude,A,EUR,FR0010147603,2018-03-31,11425.0,2950963.25,2950963.25
|
||||
88,1012,6340.0,16625.0,416580,France,France,Equity,Investissement Latitude,FCP,NO,Carmignac Investissement Latitude,A,EUR,FR0010147603,2018-09-30,10269.0,2634922.71,2634922.71
|
||||
89,1012,6340.0,16625.0,416580,France,France,Equity,Investissement Latitude,FCP,NO,Carmignac Investissement Latitude,A,EUR,FR0010147603,2019-04-30,0.0,0.0,0.0
|
||||
90,1012,6340.0,16625.0,416580,France,France,Equity,Investissement Latitude,FCP,NO,Carmignac Investissement Latitude,A,EUR,FR0010147603,2019-06-30,0.0,0.0,0.0
|
||||
91,1012,6340.0,16625.0,416580,France,France,Equity,Investissement Latitude,FCP,NO,Carmignac Investissement Latitude,A,EUR,FR0010147603,2019-10-31,0.0,0.0,0.0
|
||||
92,1012,6340.0,16625.0,416580,France,France,Equity,Investissement Latitude,FCP,NO,Carmignac Investissement Latitude,A,EUR,FR0010147603,2020-03-31,0.0,0.0,0.0
|
||||
93,1012,6340.0,16625.0,416580,France,France,Equity,Investissement Latitude,FCP,NO,Carmignac Investissement Latitude,A,EUR,FR0010147603,2020-12-31,0.0,0.0,0.0
|
||||
94,1012,6340.0,16625.0,416580,France,France,Equity,Investissement Latitude,FCP,NO,Carmignac Investissement Latitude,A,EUR,FR0010147603,2021-03-31,0.0,0.0,0.0
|
||||
95,1012,6340.0,16625.0,416580,France,France,Equity,Investissement Latitude,FCP,NO,Carmignac Investissement Latitude,A,EUR,FR0010147603,2021-06-30,0.0,0.0,0.0
|
||||
96,1012,6340.0,16625.0,416580,France,France,Equity,Large Cap Emerging Markets Strategy,FCP,NO,Carmignac Emergents,A,EUR,FR0010149302,2015-05-31,16477.0,14574895.12,14574895.12
|
||||
97,1012,6340.0,16625.0,416580,France,France,Equity,Large Cap Emerging Markets Strategy,FCP,NO,Carmignac Emergents,A,EUR,FR0010149302,2016-02-29,15566.0,11488797.62,11488797.62
|
||||
98,1012,6340.0,16625.0,416580,France,France,Equity,Large Cap Emerging Markets Strategy,FCP,NO,Carmignac Emergents,A,EUR,FR0010149302,2017-07-31,12331.0,11094077.39,11094077.39
|
||||
99,1012,6340.0,16625.0,416580,France,France,Equity,Large Cap Emerging Markets Strategy,FCP,NO,Carmignac Emergents,A,EUR,FR0010149302,2018-03-31,11342.0,9959296.78,9959296.78
|
||||
100,1012,6340.0,16625.0,416580,France,France,Equity,Large Cap Emerging Markets Strategy,FCP,NO,Carmignac Emergents,A,EUR,FR0010149302,2020-05-31,0.0,0.0,0.0
|
||||
101,1010,976.0,16697.0,416573,France,France,Equity,Asia Discovery,SICAV,NO,Carmignac Portfolio Asia Discovery,A,EUR,LU0336083810,2015-01-31,88.451,115423.2479,115423.2479
|
||||
102,1010,976.0,16697.0,416573,France,France,Equity,Asia Discovery,SICAV,NO,Carmignac Portfolio Asia Discovery,A,EUR,LU0336083810,2015-03-31,135.771,179295.1095,179295.1095
|
||||
103,1010,976.0,16697.0,416573,France,France,Equity,Asia Discovery,SICAV,NO,Carmignac Portfolio Asia Discovery,A,EUR,LU0336083810,2015-10-31,108.467,137327.8994,137327.8994
|
||||
104,1010,976.0,16697.0,416573,France,France,Equity,Asia Discovery,SICAV,NO,Carmignac Portfolio Asia Discovery,A,EUR,LU0336083810,2016-04-30,103.974,131679.9518,131679.9518
|
||||
105,1010,976.0,16697.0,416573,France,France,Equity,Asia Discovery,SICAV,NO,Carmignac Portfolio Asia Discovery,A,EUR,LU0336083810,2016-05-31,103.952,132387.0301,132387.0301
|
||||
106,1010,976.0,16697.0,416573,France,France,Equity,Asia Discovery,SICAV,NO,Carmignac Portfolio Asia Discovery,A,EUR,LU0336083810,2016-08-31,103.882,145367.2767,145367.2767
|
||||
107,1010,976.0,16697.0,416573,France,France,Equity,Climate Transition,SICAV,NO,Carmignac Portfolio Climate Transition,A,EUR,LU0164455502,2015-03-31,3916.458,1203762.5309,1203762.5309
|
||||
108,1010,976.0,16697.0,416573,France,France,Equity,Climate Transition,SICAV,NO,Carmignac Portfolio Climate Transition,A,EUR,LU0164455502,2015-10-31,3728.367,974334.1481,974334.1481
|
||||
109,1010,976.0,16697.0,416573,France,France,Equity,Climate Transition,SICAV,NO,Carmignac Portfolio Climate Transition,A,EUR,LU0164455502,2016-03-31,3700.605,911384.9994,911384.9994
|
||||
110,1010,976.0,16697.0,416573,France,France,Equity,Climate Transition,SICAV,NO,Carmignac Portfolio Climate Transition,A,EUR,LU0164455502,2016-05-31,3684.652,940875.8882,940875.8882
|
||||
111,1010,976.0,16697.0,416573,France,France,Equity,Euro-Entrepreneurs,FCP,NO,Carmignac Euro-Entrepreneurs,A,EUR,FR0010149112,2015-02-28,4824.05935,1397674.7155,1397674.7155
|
||||
112,1010,976.0,16697.0,416573,France,France,Equity,Euro-Entrepreneurs,FCP,NO,Carmignac Euro-Entrepreneurs,A,EUR,FR0010149112,2015-10-31,6215.34535,1813327.0059,1813327.0059
|
||||
113,1010,976.0,16697.0,416573,France,France,Equity,Euro-Entrepreneurs,FCP,NO,Carmignac Euro-Entrepreneurs,A,EUR,FR0010149112,2016-06-30,6185.10035,1664101.2492,1664101.2492
|
||||
114,1010,976.0,16697.0,416573,France,France,Equity,Euro-Entrepreneurs,FCP,NO,Carmignac Euro-Entrepreneurs,A,EUR,FR0010149112,2016-07-31,6119.52035,1722583.7833,1722583.7833
|
||||
115,1010,976.0,16697.0,416573,France,France,Equity,Euro-Entrepreneurs,FCP,NO,Carmignac Euro-Entrepreneurs,A,EUR,FR0010149112,2016-09-30,6030.01935,1765408.7651,1765408.7651
|
||||
116,1010,976.0,16697.0,416573,France,France,Equity,Grande Europe,SICAV,NO,Carmignac Portfolio Grande Europe,A,EUR,LU0099161993,2015-08-31,18.237,3290.3195,3290.3195
|
||||
117,1010,976.0,16697.0,416573,France,France,Equity,Grande Europe,SICAV,NO,Carmignac Portfolio Grande Europe,A,EUR,LU0099161993,2015-11-30,18.237,3222.4779,3222.4779
|
||||
118,1010,976.0,16697.0,416573,France,France,Equity,Grande Europe,SICAV,NO,Carmignac Portfolio Grande Europe,A,EUR,LU0099161993,2015-12-31,19.375,3309.0563,3309.0563
|
||||
119,1010,976.0,16697.0,416573,France,France,Equity,Grande Europe,SICAV,NO,Carmignac Portfolio Grande Europe,A,EUR,LU0099161993,2016-02-29,19.354,3080.9633,3080.9633
|
||||
120,1010,976.0,16697.0,416573,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,A,EUR,FR0010148981,2015-04-30,10632.546,13714070.4817,13714070.4817
|
||||
121,1010,976.0,16697.0,416573,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,A,EUR,FR0010148981,2016-01-31,10191.753,10793881.7672,10793881.7672
|
||||
122,1010,976.0,16697.0,416573,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,A,EUR,FR0010148981,2016-11-30,9371.763,10476600.1401,10476600.1401
|
||||
123,1010,976.0,16697.0,416573,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,A,EUR,FR0010148981,2017-01-31,9000.004,10709824.7599,10709824.7599
|
||||
124,1010,976.0,16697.0,416573,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,E,EUR,FR0010312660,2017-01-31,9.909,1733.0841,1733.0841
|
||||
125,1010,976.0,16697.0,416573,France,France,Equity,Investissement,FCP,NO,Carmignac Investissement,E,EUR,FR0010312660,2017-03-31,9.908,1739.2503,1739.2503
|
||||
126,1010,976.0,16697.0,416573,France,France,Equity,Investissement Latitude,FCP,NO,Carmignac Investissement Latitude,A,EUR,FR0010147603,2015-08-31,15389.867,4048150.6157,4048150.6157
|
||||
127,1010,976.0,16697.0,416573,France,France,Equity,Investissement Latitude,FCP,NO,Carmignac Investissement Latitude,A,EUR,FR0010147603,2016-02-29,13674.192,3309838.1736,3309838.1736
|
||||
128,1010,976.0,16697.0,416573,France,France,Equity,Large Cap Emerging Markets Strategy,FCP,NO,Carmignac Emergents,A,EUR,FR0010149302,2015-05-31,7022.043,6211418.3561,6211418.3561
|
||||
129,1012,6340.0,16625.0,416580,France,France,Equity,Asia Discovery,SICAV,NO,Carmignac Portfolio Asia Discovery,A,EUR,LU0336083810,2015-07-31,195.0,256183.2,256183.2
|
||||
130,1012,6340.0,16625.0,416580,France,France,Equity,Asia Discovery,SICAV,NO,Carmignac Portfolio Asia Discovery,A,EUR,LU0336083810,2016-07-31,180.0,245372.4,245372.4
|
||||
131,1012,6340.0,16625.0,416580,France,France,Equity,Asia Discovery,SICAV,NO,Carmignac Portfolio Asia Discovery,A,EUR,LU0336083810,2016-09-30,238.0,331343.6,331343.6
|
||||
132,1012,6340.0,16625.0,416580,France,France,Equity,Asia Discovery,SICAV,NO,Carmignac Portfolio Asia Discovery,A,EUR,LU0336083810,2016-12-31,250.0,324742.5,324742.5
|
||||
133,1012,6340.0,16625.0,416580,France,France,Equity,Asia Discovery,SICAV,NO,Carmignac Portfolio Asia Discovery,A,EUR,LU0336083810,2017-11-30,229.0,346623.56,346623.56
|
||||
134,1012,6340.0,16625.0,416580,France,France,Equity,Asia Discovery,SICAV,NO,Carmignac Portfolio Asia Discovery,A,EUR,LU0336083810,2018-02-28,220.0,339028.8,339028.8
|
||||
135,1012,6340.0,16625.0,416580,France,France,Equity,Asia Discovery,SICAV,NO,Carmignac Portfolio Asia Discovery,A,EUR,LU0336083810,2018-07-31,181.0,264808.43,264808.43
|
||||
136,1012,6340.0,16625.0,416580,France,France,Equity,Asia Discovery,SICAV,NO,Carmignac Portfolio Asia Discovery,A,EUR,LU0336083810,2018-11-30,157.0,224888.37,224888.37
|
||||
137,1012,6340.0,16625.0,416580,France,France,Equity,Asia Discovery,SICAV,NO,Carmignac Portfolio Asia Discovery,A,EUR,LU0336083810,2019-05-31,0.0,0.0,0.0
|
||||
138,1012,6340.0,16625.0,416580,France,France,Equity,Asia Discovery,SICAV,NO,Carmignac Portfolio Asia Discovery,A,EUR,LU0336083810,2019-12-31,0.0,0.0,0.0
|
||||
139,1012,6340.0,16625.0,416580,France,France,Equity,Asia Discovery,SICAV,NO,Carmignac Portfolio Asia Discovery,A,EUR,LU0336083810,2021-05-31,0.0,0.0,0.0
|
||||
140,1012,6340.0,16625.0,416580,France,France,Equity,Climate Transition,SICAV,NO,Carmignac Portfolio Climate Transition,A,EUR,LU0164455502,2015-02-28,18779.0,5723651.41,5723651.41
|
||||
141,1012,6340.0,16625.0,416580,France,France,Equity,Climate Transition,SICAV,NO,Carmignac Portfolio Climate Transition,A,EUR,LU0164455502,2016-09-30,18716.0,4984819.44,4984819.44
|
||||
142,1012,6340.0,16625.0,416580,France,France,Equity,Climate Transition,SICAV,NO,Carmignac Portfolio Climate Transition,A,EUR,LU0164455502,2018-12-31,0.0,0.0,0.0
|
||||
143,1012,6340.0,16625.0,416580,France,France,Equity,Climate Transition,SICAV,NO,Carmignac Portfolio Climate Transition,A,EUR,LU0164455502,2019-06-30,0.0,0.0,0.0
|
||||
144,1012,6340.0,16625.0,416580,France,France,Equity,Climate Transition,SICAV,NO,Carmignac Portfolio Climate Transition,A,EUR,LU0164455502,2019-07-31,0.0,0.0,0.0
|
||||
145,1012,6340.0,16625.0,416580,France,France,Equity,Climate Transition,SICAV,NO,Carmignac Portfolio Climate Transition,A,EUR,LU0164455502,2019-08-31,0.0,0.0,0.0
|
||||
146,1012,6340.0,16625.0,416580,France,France,Equity,Climate Transition,SICAV,NO,Carmignac Portfolio Climate Transition,A,EUR,LU0164455502,2020-01-31,0.0,0.0,0.0
|
||||
147,1012,6340.0,16625.0,416580,France,France,Equity,Climate Transition,SICAV,NO,Carmignac Portfolio Climate Transition,A,EUR,LU0164455502,2020-08-31,0.0,0.0,0.0
|
||||
148,1012,6340.0,16625.0,416580,France,France,Equity,Climate Transition,SICAV,NO,Carmignac Portfolio Climate Transition,A,EUR,LU0164455502,2020-09-30,0.0,0.0,0.0
|
||||
149,1012,6340.0,16625.0,416580,France,France,Equity,Euro-Entrepreneurs,FCP,NO,Carmignac Euro-Entrepreneurs,A,EUR,FR0010149112,2015-01-31,16119.302,4429422.9966,4429422.9966
|
||||
|
Gitea Version: 1.22.0 |
