paco-dev #2

Merged
pgoze-ensae merged 39 commits from paco-dev into main 2026-04-13 21:51:04 +02:00
8 changed files with 1151 additions and 24 deletions
Showing only changes of commit 25b5097e7f - Show all commits

29
clustering/clustering.py Normal file
View File

@ -0,0 +1,29 @@
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)
# Scaling: RobustScaler is preferred over StandardScaler for financial data
# because it is less influenced by 'Whale' clients (outliers).
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_
def get_cluster_profiles(results_df):
"""Returns the average profile of each cluster."""
return results_df.groupby('Cluster').mean()

27
clustering/data_loader.py Normal file
View File

@ -0,0 +1,27 @@
import pandas as pd
def load_and_clean_data(flows_path, aum_path, rates_path, gov_path):
"""
Loads raw CSVs and parses dates for consistent time-series analysis.
"""
# 1. Load Flows
flows = pd.read_csv(flows_path)
flows['Centralisation Date'] = pd.to_datetime(flows['Centralisation Date'])
# 2. Load AUM
aum = pd.read_csv(aum_path)
aum['Centralisation Date'] = pd.to_datetime(aum['Centralisation Date'])
# 3. Load Market Data (STR Rates)
# Handling potential dd/mm/yyyy formats common in EU 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'])
# 4. Load Gov Indices
gov = pd.read_csv(gov_path)
gov['Date'] = pd.to_datetime(gov['Date'])
return flows, aum, rates, gov

91
clustering/features.py Normal file
View File

@ -0,0 +1,91 @@
import pandas as pd
import statsmodels.api as sm
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 between first and last activity
tenure_days=('Centralisation Date', lambda x: (x.max() - x.min()).days)
)
# Flow Ratio: -1 (Pure Seller) to +1 (Pure Buyer)
flow_stats['buy_sell_ratio'] = (flow_stats['total_subs'] - flow_stats['total_reds']) / \
(flow_stats['total_subs'] + flow_stats['total_reds'] + 1e-6)
# --- 2. Product Preferences ---
# Calculate % of flows going to each Asset Type
asset_pivot = flows_df.groupby(['Registrar Account - ID', 'Product - Asset Type'])['Value € - Subscription'].sum().unstack(fill_value=0)
asset_pct = asset_pivot.div(asset_pivot.sum(axis=1) + 1e-6, 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')
)
# Merge all static features
features = flow_stats.join(asset_pct).join(aum_stats, how='outer').fillna(0)
return features
def compute_market_sensitivities(flows_df, rates_df, gov_df, freq='M'):
"""
Computes Beta sensitivity to Rates and Gov Bonds.
Freq: 'M' (Monthly) recommended for long history.
"""
# 1. Prepare Market Factors
# Resample Rates (Take last value of period)
rates_res = rates_df.set_index('Date').resample(freq)['Yld to Maturity'].last()
delta_rates = rates_res.diff().rename('Delta_Rate')
# Resample Gov Bonds (Using 'EG04' 7-10Y Euro Gov as proxy)
gov_target = gov_df[gov_df['Bond/Index'] == 'EG04'].set_index('Date')
gov_target = gov_target[~gov_target.index.duplicated(keep='first')] # Dedup
# Calculate return over period
gov_res = gov_target['Total Return % 1-wk-LOC'].resample(freq).apply(lambda x: (1 + x/100).prod() - 1)
gov_res = gov_res.rename('Bond_Return')
market_factors = pd.concat([delta_rates, gov_res], axis=1).dropna()
# 2. Prepare Client Flows (Aggregated by same frequency)
flows_df['Period'] = flows_df['Centralisation Date'].dt.to_period(freq).dt.to_timestamp()
client_betas = []
# Only analyze clients with sufficient activity (>5 transactions)
active_clients = flows_df['Registrar Account - ID'].value_counts()
active_clients = active_clients[active_clients >= 5].index
for client in active_clients:
c_flows = flows_df[flows_df['Registrar Account - ID'] == client]
c_ts = c_flows.groupby('Period')['Quantity - NetFlows'].sum()
# Inner join to align dates (Client Activity vs Market Data)
merged = pd.concat([c_ts, market_factors], axis=1, join='inner')
# Need enough points for regression
if len(merged) >= 5:
Y = merged['Quantity - NetFlows']
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,
'beta_rate': model.params.get('Delta_Rate', 0),
'beta_bond': model.params.get('Bond_Return', 0),
'r_squared': model.rsquared
})
except:
continue
if not client_betas:
return pd.DataFrame(columns=['Registrar Account - ID', 'beta_rate', 'beta_bond', 'r_squared'])
return pd.DataFrame(client_betas).set_index('Registrar Account - ID')

43
clustering/main.py Normal file
View File

@ -0,0 +1,43 @@
import pandas as pd
from data_loader import load_and_clean_data
from features import compute_static_features, compute_market_sensitivities
from clustering import run_clustering_pipeline, get_cluster_profiles
def main():
print("--- Starting Carmignac Client Clustering Pipeline ---")
# 1. Load Data
print("Loading data...")
flows, aum, rates, gov = load_and_clean_data(
'flows_sample.csv',
'aum_sample.csv',
'str_rates.csv',
'eur_gov_indices.csv'
)
# 2. Feature Engineering
print("Computing static features...")
static_feats = compute_static_features(flows, aum)
print("Computing market sensitivities (Betas)...")
# Note: Using 'W' (Weekly) to maximize points for the sample.
# Use 'M' (Monthly) for the full dataset.
sensitivity_feats = compute_market_sensitivities(flows, rates, gov, freq='W')
# Merge features
full_features = static_feats.join(sensitivity_feats, how='left')
# 3. Clustering
print(f"Running Clustering on {len(full_features)} clients...")
clustered_df, centers = 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()

View File

@ -10,7 +10,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 30, "execution_count": 1,
"id": "126c8a80-d9ad-4816-84f0-0c3d580f62c8", "id": "126c8a80-d9ad-4816-84f0-0c3d580f62c8",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -18,10 +18,17 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Requirement already satisfied: openpyxl in /opt/python/lib/python3.13/site-packages (3.1.5)\n", "Collecting openpyxl\n",
"Requirement already satisfied: et-xmlfile in /opt/python/lib/python3.13/site-packages (from openpyxl) (2.0.0)\n", " Downloading openpyxl-3.1.5-py2.py3-none-any.whl.metadata (2.5 kB)\n",
"Collecting et-xmlfile (from openpyxl)\n",
" Downloading et_xmlfile-2.0.0-py3-none-any.whl.metadata (2.7 kB)\n",
"Downloading openpyxl-3.1.5-py2.py3-none-any.whl (250 kB)\n",
"Downloading et_xmlfile-2.0.0-py3-none-any.whl (18 kB)\n",
"Installing collected packages: et-xmlfile, openpyxl\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2/2\u001b[0m [openpyxl]1/2\u001b[0m [openpyxl]\n",
"\u001b[1A\u001b[2KSuccessfully installed et-xmlfile-2.0.0 openpyxl-3.1.5\n",
"\n", "\n",
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m25.2\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m25.3\u001b[0m\n", "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m25.3\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m26.0\u001b[0m\n",
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n" "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n"
] ]
} }
@ -2822,7 +2829,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.13.8" "version": "3.13.11"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@ -0,0 +1,61 @@
Bond/Index,Description,Date,Total Return % 1-wk-LOC,Yield to Maturity (s.a.),Yield to Maturity (conv.)
G0D0,ICE BofA German Government Index,2008-08-22,-0.302,4.21,4.25
G0D0,ICE BofA German Government Index,2008-08-29,0.304,4.18,4.22
G0D0,ICE BofA German Government Index,2008-09-05,0.978,3.99,4.03
G0D0,ICE BofA German Government Index,2008-09-12,-1.058,4.17,4.21
G0D0,ICE BofA German Government Index,2008-09-19,-0.286,4.22,4.27
G0D0,ICE BofA German Government Index,2008-09-26,0.661,4.05,4.09
G0D0,ICE BofA German Government Index,2008-10-03,1.89,3.71,3.75
G0D0,ICE BofA German Government Index,2008-10-10,0.094,3.61,3.65
G0D0,ICE BofA German Government Index,2008-10-17,-0.355,3.67,3.7
G0D0,ICE BofA German Government Index,2008-10-24,1.637,3.39,3.42
G0D0,ICE BofA German Government Index,2008-10-31,-0.535,3.41,3.44
G0D0,ICE BofA German Government Index,2008-11-07,1.325,3.2,3.23
G0D0,ICE BofA German Government Index,2008-11-14,0.449,3.07,3.1
G0D0,ICE BofA German Government Index,2008-11-21,1.356,2.89,2.92
G0D0,ICE BofA German Government Index,2008-11-28,0.778,2.86,2.88
G0D0,ICE BofA German Government Index,2008-12-05,1.466,2.69,2.7
G0D0,ICE BofA German Government Index,2008-12-12,-1.91,2.96,2.98
G0D0,ICE BofA German Government Index,2008-12-19,1.798,2.65,2.67
G0D0,ICE BofA German Government Index,2008-12-26,0.312,2.6,2.62
G0D0,ICE BofA German Government Index,2009-01-02,0.264,2.56,2.57
EG04,ICE BofA 7-10 Year Euro Government Index,2011-03-11,0.375,4.17,4.21
EG04,ICE BofA 7-10 Year Euro Government Index,2011-03-18,0.8,4.07,4.1
EG04,ICE BofA 7-10 Year Euro Government Index,2011-03-25,-0.685,4.17,4.21
EG04,ICE BofA 7-10 Year Euro Government Index,2011-04-01,-0.785,4.31,4.35
EG04,ICE BofA 7-10 Year Euro Government Index,2011-04-08,0.023,4.33,4.37
EG04,ICE BofA 7-10 Year Euro Government Index,2011-04-15,0.168,4.31,4.35
EG04,ICE BofA 7-10 Year Euro Government Index,2011-04-22,0.3205,4.265,4.305
EG04,ICE BofA 7-10 Year Euro Government Index,2011-04-29,0.473,4.22,4.26
EG04,ICE BofA 7-10 Year Euro Government Index,2011-05-06,0.455,4.22,4.26
EG04,ICE BofA 7-10 Year Euro Government Index,2011-05-13,0.517,4.15,4.19
EG04,ICE BofA 7-10 Year Euro Government Index,2011-05-20,-0.18,4.19,4.23
EG04,ICE BofA 7-10 Year Euro Government Index,2011-05-27,0.494,4.12,4.16
EG04,ICE BofA 7-10 Year Euro Government Index,2011-06-03,0.297,4.11,4.15
EG04,ICE BofA 7-10 Year Euro Government Index,2011-06-10,-0.326,4.16,4.2
EG04,ICE BofA 7-10 Year Euro Government Index,2011-06-17,-0.217,4.17,4.21
EG04,ICE BofA 7-10 Year Euro Government Index,2011-06-24,-0.135,4.18,4.23
EG04,ICE BofA 7-10 Year Euro Government Index,2011-07-01,-0.055,4.18,4.22
EG04,ICE BofA 7-10 Year Euro Government Index,2011-07-08,-0.699,4.24,4.29
EG04,ICE BofA 7-10 Year Euro Government Index,2011-07-15,-0.923,4.35,4.4
EG04,ICE BofA 7-10 Year Euro Government Index,2011-07-22,1.181,4.25,4.29
EG04,ICE BofA 7-10 Year Euro Government Index,2016-01-15,0.122,0.85,0.85
EG04,ICE BofA 7-10 Year Euro Government Index,2016-01-22,0.269,0.82,0.82
EG04,ICE BofA 7-10 Year Euro Government Index,2016-01-29,1.123,0.67,0.67
EG04,ICE BofA 7-10 Year Euro Government Index,2016-02-05,-0.268,0.72,0.72
EG04,ICE BofA 7-10 Year Euro Government Index,2016-02-12,-0.209,0.75,0.75
EG04,ICE BofA 7-10 Year Euro Government Index,2016-02-19,0.454,0.69,0.69
EG04,ICE BofA 7-10 Year Euro Government Index,2016-02-26,0.547,0.62,0.62
EG04,ICE BofA 7-10 Year Euro Government Index,2016-03-04,-0.154,0.64,0.65
EG04,ICE BofA 7-10 Year Euro Government Index,2016-03-11,0.28,0.61,0.61
EG04,ICE BofA 7-10 Year Euro Government Index,2016-03-18,0.357,0.56,0.57
EG04,ICE BofA 7-10 Year Euro Government Index,2016-03-25,0.41100000000000003,0.535,0.54
EG04,ICE BofA 7-10 Year Euro Government Index,2016-04-01,0.465,0.51,0.51
EG04,ICE BofA 7-10 Year Euro Government Index,2016-04-08,-0.114,0.53,0.53
EG04,ICE BofA 7-10 Year Euro Government Index,2016-04-15,-0.097,0.54,0.54
EG04,ICE BofA 7-10 Year Euro Government Index,2016-04-22,-0.66,0.63,0.63
EG04,ICE BofA 7-10 Year Euro Government Index,2016-04-29,-0.338,0.68,0.68
EG04,ICE BofA 7-10 Year Euro Government Index,2016-05-06,0.65,0.6,0.6
EG04,ICE BofA 7-10 Year Euro Government Index,2016-05-13,0.211,0.57,0.57
EG04,ICE BofA 7-10 Year Euro Government Index,2016-05-20,-0.142,0.59,0.59
EG04,ICE BofA 7-10 Year Euro Government Index,2016-05-27,0.471,0.53,0.53
1 Bond/Index Description Date Total Return % 1-wk-LOC Yield to Maturity (s.a.) Yield to Maturity (conv.)
2 G0D0 ICE BofA German Government Index 2008-08-22 -0.302 4.21 4.25
3 G0D0 ICE BofA German Government Index 2008-08-29 0.304 4.18 4.22
4 G0D0 ICE BofA German Government Index 2008-09-05 0.978 3.99 4.03
5 G0D0 ICE BofA German Government Index 2008-09-12 -1.058 4.17 4.21
6 G0D0 ICE BofA German Government Index 2008-09-19 -0.286 4.22 4.27
7 G0D0 ICE BofA German Government Index 2008-09-26 0.661 4.05 4.09
8 G0D0 ICE BofA German Government Index 2008-10-03 1.89 3.71 3.75
9 G0D0 ICE BofA German Government Index 2008-10-10 0.094 3.61 3.65
10 G0D0 ICE BofA German Government Index 2008-10-17 -0.355 3.67 3.7
11 G0D0 ICE BofA German Government Index 2008-10-24 1.637 3.39 3.42
12 G0D0 ICE BofA German Government Index 2008-10-31 -0.535 3.41 3.44
13 G0D0 ICE BofA German Government Index 2008-11-07 1.325 3.2 3.23
14 G0D0 ICE BofA German Government Index 2008-11-14 0.449 3.07 3.1
15 G0D0 ICE BofA German Government Index 2008-11-21 1.356 2.89 2.92
16 G0D0 ICE BofA German Government Index 2008-11-28 0.778 2.86 2.88
17 G0D0 ICE BofA German Government Index 2008-12-05 1.466 2.69 2.7
18 G0D0 ICE BofA German Government Index 2008-12-12 -1.91 2.96 2.98
19 G0D0 ICE BofA German Government Index 2008-12-19 1.798 2.65 2.67
20 G0D0 ICE BofA German Government Index 2008-12-26 0.312 2.6 2.62
21 G0D0 ICE BofA German Government Index 2009-01-02 0.264 2.56 2.57
22 EG04 ICE BofA 7-10 Year Euro Government Index 2011-03-11 0.375 4.17 4.21
23 EG04 ICE BofA 7-10 Year Euro Government Index 2011-03-18 0.8 4.07 4.1
24 EG04 ICE BofA 7-10 Year Euro Government Index 2011-03-25 -0.685 4.17 4.21
25 EG04 ICE BofA 7-10 Year Euro Government Index 2011-04-01 -0.785 4.31 4.35
26 EG04 ICE BofA 7-10 Year Euro Government Index 2011-04-08 0.023 4.33 4.37
27 EG04 ICE BofA 7-10 Year Euro Government Index 2011-04-15 0.168 4.31 4.35
28 EG04 ICE BofA 7-10 Year Euro Government Index 2011-04-22 0.3205 4.265 4.305
29 EG04 ICE BofA 7-10 Year Euro Government Index 2011-04-29 0.473 4.22 4.26
30 EG04 ICE BofA 7-10 Year Euro Government Index 2011-05-06 0.455 4.22 4.26
31 EG04 ICE BofA 7-10 Year Euro Government Index 2011-05-13 0.517 4.15 4.19
32 EG04 ICE BofA 7-10 Year Euro Government Index 2011-05-20 -0.18 4.19 4.23
33 EG04 ICE BofA 7-10 Year Euro Government Index 2011-05-27 0.494 4.12 4.16
34 EG04 ICE BofA 7-10 Year Euro Government Index 2011-06-03 0.297 4.11 4.15
35 EG04 ICE BofA 7-10 Year Euro Government Index 2011-06-10 -0.326 4.16 4.2
36 EG04 ICE BofA 7-10 Year Euro Government Index 2011-06-17 -0.217 4.17 4.21
37 EG04 ICE BofA 7-10 Year Euro Government Index 2011-06-24 -0.135 4.18 4.23
38 EG04 ICE BofA 7-10 Year Euro Government Index 2011-07-01 -0.055 4.18 4.22
39 EG04 ICE BofA 7-10 Year Euro Government Index 2011-07-08 -0.699 4.24 4.29
40 EG04 ICE BofA 7-10 Year Euro Government Index 2011-07-15 -0.923 4.35 4.4
41 EG04 ICE BofA 7-10 Year Euro Government Index 2011-07-22 1.181 4.25 4.29
42 EG04 ICE BofA 7-10 Year Euro Government Index 2016-01-15 0.122 0.85 0.85
43 EG04 ICE BofA 7-10 Year Euro Government Index 2016-01-22 0.269 0.82 0.82
44 EG04 ICE BofA 7-10 Year Euro Government Index 2016-01-29 1.123 0.67 0.67
45 EG04 ICE BofA 7-10 Year Euro Government Index 2016-02-05 -0.268 0.72 0.72
46 EG04 ICE BofA 7-10 Year Euro Government Index 2016-02-12 -0.209 0.75 0.75
47 EG04 ICE BofA 7-10 Year Euro Government Index 2016-02-19 0.454 0.69 0.69
48 EG04 ICE BofA 7-10 Year Euro Government Index 2016-02-26 0.547 0.62 0.62
49 EG04 ICE BofA 7-10 Year Euro Government Index 2016-03-04 -0.154 0.64 0.65
50 EG04 ICE BofA 7-10 Year Euro Government Index 2016-03-11 0.28 0.61 0.61
51 EG04 ICE BofA 7-10 Year Euro Government Index 2016-03-18 0.357 0.56 0.57
52 EG04 ICE BofA 7-10 Year Euro Government Index 2016-03-25 0.41100000000000003 0.535 0.54
53 EG04 ICE BofA 7-10 Year Euro Government Index 2016-04-01 0.465 0.51 0.51
54 EG04 ICE BofA 7-10 Year Euro Government Index 2016-04-08 -0.114 0.53 0.53
55 EG04 ICE BofA 7-10 Year Euro Government Index 2016-04-15 -0.097 0.54 0.54
56 EG04 ICE BofA 7-10 Year Euro Government Index 2016-04-22 -0.66 0.63 0.63
57 EG04 ICE BofA 7-10 Year Euro Government Index 2016-04-29 -0.338 0.68 0.68
58 EG04 ICE BofA 7-10 Year Euro Government Index 2016-05-06 0.65 0.6 0.6
59 EG04 ICE BofA 7-10 Year Euro Government Index 2016-05-13 0.211 0.57 0.57
60 EG04 ICE BofA 7-10 Year Euro Government Index 2016-05-20 -0.142 0.59 0.59
61 EG04 ICE BofA 7-10 Year Euro Government Index 2016-05-27 0.471 0.53 0.53

View File

@ -10,7 +10,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 8, "execution_count": 1,
"id": "127753ac", "id": "127753ac",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -20,7 +20,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9, "execution_count": 2,
"id": "ae3c64fe", "id": "ae3c64fe",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -36,7 +36,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": 3,
"id": "84b9ac42", "id": "84b9ac42",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -62,34 +62,802 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 13, "execution_count": 12,
"id": "83472648", "id": "83472648",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [],
{
"name": "stderr",
"output_type": "stream",
"text": [
"/tmp/ipykernel_10061/1081306672.py:2: DtypeWarning: Columns (0,1,2,3) have mixed types. Specify dtype option on import or set low_memory=False.\n",
" df = pd.read_csv(f, sep=\";\")\n"
]
}
],
"source": [ "source": [
"with fs.open('s3://projet-bdc-data/carmignac/AUM ENSAE V2 -20251105.csv', 'rb') as f:\n", "with fs.open('s3://projet-bdc-data/carmignac/Data Modélisation/market data/Eur Gov Indices Weekly Step.xlsx', 'rb') as f:\n",
" df = pd.read_csv(f, sep=\";\")\n", " df = pd.read_excel(f)\n",
"\n", "\n",
"sample_df = sample_by_blocks(df, block_size=10, num_blocks=10, random_state=42)" "sample_df = sample_by_blocks(df, block_size=20, num_blocks=3, random_state=42)"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 15, "execution_count": 13,
"id": "79af063e",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Bond/Index</th>\n",
" <th>Description</th>\n",
" <th>Date</th>\n",
" <th>Total Return % 1-wk-LOC</th>\n",
" <th>Yield to Maturity (s.a.)</th>\n",
" <th>Yield to Maturity (conv.)</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>G0D0</td>\n",
" <td>ICE BofA German Government Index</td>\n",
" <td>2008-08-22</td>\n",
" <td>-0.3020</td>\n",
" <td>4.210</td>\n",
" <td>4.250</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>G0D0</td>\n",
" <td>ICE BofA German Government Index</td>\n",
" <td>2008-08-29</td>\n",
" <td>0.3040</td>\n",
" <td>4.180</td>\n",
" <td>4.220</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>G0D0</td>\n",
" <td>ICE BofA German Government Index</td>\n",
" <td>2008-09-05</td>\n",
" <td>0.9780</td>\n",
" <td>3.990</td>\n",
" <td>4.030</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>G0D0</td>\n",
" <td>ICE BofA German Government Index</td>\n",
" <td>2008-09-12</td>\n",
" <td>-1.0580</td>\n",
" <td>4.170</td>\n",
" <td>4.210</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>G0D0</td>\n",
" <td>ICE BofA German Government Index</td>\n",
" <td>2008-09-19</td>\n",
" <td>-0.2860</td>\n",
" <td>4.220</td>\n",
" <td>4.270</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>G0D0</td>\n",
" <td>ICE BofA German Government Index</td>\n",
" <td>2008-09-26</td>\n",
" <td>0.6610</td>\n",
" <td>4.050</td>\n",
" <td>4.090</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>G0D0</td>\n",
" <td>ICE BofA German Government Index</td>\n",
" <td>2008-10-03</td>\n",
" <td>1.8900</td>\n",
" <td>3.710</td>\n",
" <td>3.750</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>G0D0</td>\n",
" <td>ICE BofA German Government Index</td>\n",
" <td>2008-10-10</td>\n",
" <td>0.0940</td>\n",
" <td>3.610</td>\n",
" <td>3.650</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>G0D0</td>\n",
" <td>ICE BofA German Government Index</td>\n",
" <td>2008-10-17</td>\n",
" <td>-0.3550</td>\n",
" <td>3.670</td>\n",
" <td>3.700</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>G0D0</td>\n",
" <td>ICE BofA German Government Index</td>\n",
" <td>2008-10-24</td>\n",
" <td>1.6370</td>\n",
" <td>3.390</td>\n",
" <td>3.420</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>G0D0</td>\n",
" <td>ICE BofA German Government Index</td>\n",
" <td>2008-10-31</td>\n",
" <td>-0.5350</td>\n",
" <td>3.410</td>\n",
" <td>3.440</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>G0D0</td>\n",
" <td>ICE BofA German Government Index</td>\n",
" <td>2008-11-07</td>\n",
" <td>1.3250</td>\n",
" <td>3.200</td>\n",
" <td>3.230</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>G0D0</td>\n",
" <td>ICE BofA German Government Index</td>\n",
" <td>2008-11-14</td>\n",
" <td>0.4490</td>\n",
" <td>3.070</td>\n",
" <td>3.100</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>G0D0</td>\n",
" <td>ICE BofA German Government Index</td>\n",
" <td>2008-11-21</td>\n",
" <td>1.3560</td>\n",
" <td>2.890</td>\n",
" <td>2.920</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>G0D0</td>\n",
" <td>ICE BofA German Government Index</td>\n",
" <td>2008-11-28</td>\n",
" <td>0.7780</td>\n",
" <td>2.860</td>\n",
" <td>2.880</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>G0D0</td>\n",
" <td>ICE BofA German Government Index</td>\n",
" <td>2008-12-05</td>\n",
" <td>1.4660</td>\n",
" <td>2.690</td>\n",
" <td>2.700</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16</th>\n",
" <td>G0D0</td>\n",
" <td>ICE BofA German Government Index</td>\n",
" <td>2008-12-12</td>\n",
" <td>-1.9100</td>\n",
" <td>2.960</td>\n",
" <td>2.980</td>\n",
" </tr>\n",
" <tr>\n",
" <th>17</th>\n",
" <td>G0D0</td>\n",
" <td>ICE BofA German Government Index</td>\n",
" <td>2008-12-19</td>\n",
" <td>1.7980</td>\n",
" <td>2.650</td>\n",
" <td>2.670</td>\n",
" </tr>\n",
" <tr>\n",
" <th>18</th>\n",
" <td>G0D0</td>\n",
" <td>ICE BofA German Government Index</td>\n",
" <td>2008-12-26</td>\n",
" <td>0.3120</td>\n",
" <td>2.600</td>\n",
" <td>2.620</td>\n",
" </tr>\n",
" <tr>\n",
" <th>19</th>\n",
" <td>G0D0</td>\n",
" <td>ICE BofA German Government Index</td>\n",
" <td>2009-01-02</td>\n",
" <td>0.2640</td>\n",
" <td>2.560</td>\n",
" <td>2.570</td>\n",
" </tr>\n",
" <tr>\n",
" <th>20</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2011-03-11</td>\n",
" <td>0.3750</td>\n",
" <td>4.170</td>\n",
" <td>4.210</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2011-03-18</td>\n",
" <td>0.8000</td>\n",
" <td>4.070</td>\n",
" <td>4.100</td>\n",
" </tr>\n",
" <tr>\n",
" <th>22</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2011-03-25</td>\n",
" <td>-0.6850</td>\n",
" <td>4.170</td>\n",
" <td>4.210</td>\n",
" </tr>\n",
" <tr>\n",
" <th>23</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2011-04-01</td>\n",
" <td>-0.7850</td>\n",
" <td>4.310</td>\n",
" <td>4.350</td>\n",
" </tr>\n",
" <tr>\n",
" <th>24</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2011-04-08</td>\n",
" <td>0.0230</td>\n",
" <td>4.330</td>\n",
" <td>4.370</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2011-04-15</td>\n",
" <td>0.1680</td>\n",
" <td>4.310</td>\n",
" <td>4.350</td>\n",
" </tr>\n",
" <tr>\n",
" <th>26</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2011-04-22</td>\n",
" <td>0.3205</td>\n",
" <td>4.265</td>\n",
" <td>4.305</td>\n",
" </tr>\n",
" <tr>\n",
" <th>27</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2011-04-29</td>\n",
" <td>0.4730</td>\n",
" <td>4.220</td>\n",
" <td>4.260</td>\n",
" </tr>\n",
" <tr>\n",
" <th>28</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2011-05-06</td>\n",
" <td>0.4550</td>\n",
" <td>4.220</td>\n",
" <td>4.260</td>\n",
" </tr>\n",
" <tr>\n",
" <th>29</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2011-05-13</td>\n",
" <td>0.5170</td>\n",
" <td>4.150</td>\n",
" <td>4.190</td>\n",
" </tr>\n",
" <tr>\n",
" <th>30</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2011-05-20</td>\n",
" <td>-0.1800</td>\n",
" <td>4.190</td>\n",
" <td>4.230</td>\n",
" </tr>\n",
" <tr>\n",
" <th>31</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2011-05-27</td>\n",
" <td>0.4940</td>\n",
" <td>4.120</td>\n",
" <td>4.160</td>\n",
" </tr>\n",
" <tr>\n",
" <th>32</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2011-06-03</td>\n",
" <td>0.2970</td>\n",
" <td>4.110</td>\n",
" <td>4.150</td>\n",
" </tr>\n",
" <tr>\n",
" <th>33</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2011-06-10</td>\n",
" <td>-0.3260</td>\n",
" <td>4.160</td>\n",
" <td>4.200</td>\n",
" </tr>\n",
" <tr>\n",
" <th>34</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2011-06-17</td>\n",
" <td>-0.2170</td>\n",
" <td>4.170</td>\n",
" <td>4.210</td>\n",
" </tr>\n",
" <tr>\n",
" <th>35</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2011-06-24</td>\n",
" <td>-0.1350</td>\n",
" <td>4.180</td>\n",
" <td>4.230</td>\n",
" </tr>\n",
" <tr>\n",
" <th>36</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2011-07-01</td>\n",
" <td>-0.0550</td>\n",
" <td>4.180</td>\n",
" <td>4.220</td>\n",
" </tr>\n",
" <tr>\n",
" <th>37</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2011-07-08</td>\n",
" <td>-0.6990</td>\n",
" <td>4.240</td>\n",
" <td>4.290</td>\n",
" </tr>\n",
" <tr>\n",
" <th>38</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2011-07-15</td>\n",
" <td>-0.9230</td>\n",
" <td>4.350</td>\n",
" <td>4.400</td>\n",
" </tr>\n",
" <tr>\n",
" <th>39</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2011-07-22</td>\n",
" <td>1.1810</td>\n",
" <td>4.250</td>\n",
" <td>4.290</td>\n",
" </tr>\n",
" <tr>\n",
" <th>40</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2016-01-15</td>\n",
" <td>0.1220</td>\n",
" <td>0.850</td>\n",
" <td>0.850</td>\n",
" </tr>\n",
" <tr>\n",
" <th>41</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2016-01-22</td>\n",
" <td>0.2690</td>\n",
" <td>0.820</td>\n",
" <td>0.820</td>\n",
" </tr>\n",
" <tr>\n",
" <th>42</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2016-01-29</td>\n",
" <td>1.1230</td>\n",
" <td>0.670</td>\n",
" <td>0.670</td>\n",
" </tr>\n",
" <tr>\n",
" <th>43</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2016-02-05</td>\n",
" <td>-0.2680</td>\n",
" <td>0.720</td>\n",
" <td>0.720</td>\n",
" </tr>\n",
" <tr>\n",
" <th>44</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2016-02-12</td>\n",
" <td>-0.2090</td>\n",
" <td>0.750</td>\n",
" <td>0.750</td>\n",
" </tr>\n",
" <tr>\n",
" <th>45</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2016-02-19</td>\n",
" <td>0.4540</td>\n",
" <td>0.690</td>\n",
" <td>0.690</td>\n",
" </tr>\n",
" <tr>\n",
" <th>46</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2016-02-26</td>\n",
" <td>0.5470</td>\n",
" <td>0.620</td>\n",
" <td>0.620</td>\n",
" </tr>\n",
" <tr>\n",
" <th>47</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2016-03-04</td>\n",
" <td>-0.1540</td>\n",
" <td>0.640</td>\n",
" <td>0.650</td>\n",
" </tr>\n",
" <tr>\n",
" <th>48</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2016-03-11</td>\n",
" <td>0.2800</td>\n",
" <td>0.610</td>\n",
" <td>0.610</td>\n",
" </tr>\n",
" <tr>\n",
" <th>49</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2016-03-18</td>\n",
" <td>0.3570</td>\n",
" <td>0.560</td>\n",
" <td>0.570</td>\n",
" </tr>\n",
" <tr>\n",
" <th>50</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2016-03-25</td>\n",
" <td>0.4110</td>\n",
" <td>0.535</td>\n",
" <td>0.540</td>\n",
" </tr>\n",
" <tr>\n",
" <th>51</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2016-04-01</td>\n",
" <td>0.4650</td>\n",
" <td>0.510</td>\n",
" <td>0.510</td>\n",
" </tr>\n",
" <tr>\n",
" <th>52</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2016-04-08</td>\n",
" <td>-0.1140</td>\n",
" <td>0.530</td>\n",
" <td>0.530</td>\n",
" </tr>\n",
" <tr>\n",
" <th>53</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2016-04-15</td>\n",
" <td>-0.0970</td>\n",
" <td>0.540</td>\n",
" <td>0.540</td>\n",
" </tr>\n",
" <tr>\n",
" <th>54</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2016-04-22</td>\n",
" <td>-0.6600</td>\n",
" <td>0.630</td>\n",
" <td>0.630</td>\n",
" </tr>\n",
" <tr>\n",
" <th>55</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2016-04-29</td>\n",
" <td>-0.3380</td>\n",
" <td>0.680</td>\n",
" <td>0.680</td>\n",
" </tr>\n",
" <tr>\n",
" <th>56</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2016-05-06</td>\n",
" <td>0.6500</td>\n",
" <td>0.600</td>\n",
" <td>0.600</td>\n",
" </tr>\n",
" <tr>\n",
" <th>57</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2016-05-13</td>\n",
" <td>0.2110</td>\n",
" <td>0.570</td>\n",
" <td>0.570</td>\n",
" </tr>\n",
" <tr>\n",
" <th>58</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2016-05-20</td>\n",
" <td>-0.1420</td>\n",
" <td>0.590</td>\n",
" <td>0.590</td>\n",
" </tr>\n",
" <tr>\n",
" <th>59</th>\n",
" <td>EG04</td>\n",
" <td>ICE BofA 7-10 Year Euro Government Index</td>\n",
" <td>2016-05-27</td>\n",
" <td>0.4710</td>\n",
" <td>0.530</td>\n",
" <td>0.530</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Bond/Index Description Date \\\n",
"0 G0D0 ICE BofA German Government Index 2008-08-22 \n",
"1 G0D0 ICE BofA German Government Index 2008-08-29 \n",
"2 G0D0 ICE BofA German Government Index 2008-09-05 \n",
"3 G0D0 ICE BofA German Government Index 2008-09-12 \n",
"4 G0D0 ICE BofA German Government Index 2008-09-19 \n",
"5 G0D0 ICE BofA German Government Index 2008-09-26 \n",
"6 G0D0 ICE BofA German Government Index 2008-10-03 \n",
"7 G0D0 ICE BofA German Government Index 2008-10-10 \n",
"8 G0D0 ICE BofA German Government Index 2008-10-17 \n",
"9 G0D0 ICE BofA German Government Index 2008-10-24 \n",
"10 G0D0 ICE BofA German Government Index 2008-10-31 \n",
"11 G0D0 ICE BofA German Government Index 2008-11-07 \n",
"12 G0D0 ICE BofA German Government Index 2008-11-14 \n",
"13 G0D0 ICE BofA German Government Index 2008-11-21 \n",
"14 G0D0 ICE BofA German Government Index 2008-11-28 \n",
"15 G0D0 ICE BofA German Government Index 2008-12-05 \n",
"16 G0D0 ICE BofA German Government Index 2008-12-12 \n",
"17 G0D0 ICE BofA German Government Index 2008-12-19 \n",
"18 G0D0 ICE BofA German Government Index 2008-12-26 \n",
"19 G0D0 ICE BofA German Government Index 2009-01-02 \n",
"20 EG04 ICE BofA 7-10 Year Euro Government Index 2011-03-11 \n",
"21 EG04 ICE BofA 7-10 Year Euro Government Index 2011-03-18 \n",
"22 EG04 ICE BofA 7-10 Year Euro Government Index 2011-03-25 \n",
"23 EG04 ICE BofA 7-10 Year Euro Government Index 2011-04-01 \n",
"24 EG04 ICE BofA 7-10 Year Euro Government Index 2011-04-08 \n",
"25 EG04 ICE BofA 7-10 Year Euro Government Index 2011-04-15 \n",
"26 EG04 ICE BofA 7-10 Year Euro Government Index 2011-04-22 \n",
"27 EG04 ICE BofA 7-10 Year Euro Government Index 2011-04-29 \n",
"28 EG04 ICE BofA 7-10 Year Euro Government Index 2011-05-06 \n",
"29 EG04 ICE BofA 7-10 Year Euro Government Index 2011-05-13 \n",
"30 EG04 ICE BofA 7-10 Year Euro Government Index 2011-05-20 \n",
"31 EG04 ICE BofA 7-10 Year Euro Government Index 2011-05-27 \n",
"32 EG04 ICE BofA 7-10 Year Euro Government Index 2011-06-03 \n",
"33 EG04 ICE BofA 7-10 Year Euro Government Index 2011-06-10 \n",
"34 EG04 ICE BofA 7-10 Year Euro Government Index 2011-06-17 \n",
"35 EG04 ICE BofA 7-10 Year Euro Government Index 2011-06-24 \n",
"36 EG04 ICE BofA 7-10 Year Euro Government Index 2011-07-01 \n",
"37 EG04 ICE BofA 7-10 Year Euro Government Index 2011-07-08 \n",
"38 EG04 ICE BofA 7-10 Year Euro Government Index 2011-07-15 \n",
"39 EG04 ICE BofA 7-10 Year Euro Government Index 2011-07-22 \n",
"40 EG04 ICE BofA 7-10 Year Euro Government Index 2016-01-15 \n",
"41 EG04 ICE BofA 7-10 Year Euro Government Index 2016-01-22 \n",
"42 EG04 ICE BofA 7-10 Year Euro Government Index 2016-01-29 \n",
"43 EG04 ICE BofA 7-10 Year Euro Government Index 2016-02-05 \n",
"44 EG04 ICE BofA 7-10 Year Euro Government Index 2016-02-12 \n",
"45 EG04 ICE BofA 7-10 Year Euro Government Index 2016-02-19 \n",
"46 EG04 ICE BofA 7-10 Year Euro Government Index 2016-02-26 \n",
"47 EG04 ICE BofA 7-10 Year Euro Government Index 2016-03-04 \n",
"48 EG04 ICE BofA 7-10 Year Euro Government Index 2016-03-11 \n",
"49 EG04 ICE BofA 7-10 Year Euro Government Index 2016-03-18 \n",
"50 EG04 ICE BofA 7-10 Year Euro Government Index 2016-03-25 \n",
"51 EG04 ICE BofA 7-10 Year Euro Government Index 2016-04-01 \n",
"52 EG04 ICE BofA 7-10 Year Euro Government Index 2016-04-08 \n",
"53 EG04 ICE BofA 7-10 Year Euro Government Index 2016-04-15 \n",
"54 EG04 ICE BofA 7-10 Year Euro Government Index 2016-04-22 \n",
"55 EG04 ICE BofA 7-10 Year Euro Government Index 2016-04-29 \n",
"56 EG04 ICE BofA 7-10 Year Euro Government Index 2016-05-06 \n",
"57 EG04 ICE BofA 7-10 Year Euro Government Index 2016-05-13 \n",
"58 EG04 ICE BofA 7-10 Year Euro Government Index 2016-05-20 \n",
"59 EG04 ICE BofA 7-10 Year Euro Government Index 2016-05-27 \n",
"\n",
" Total Return % 1-wk-LOC Yield to Maturity (s.a.) \\\n",
"0 -0.3020 4.210 \n",
"1 0.3040 4.180 \n",
"2 0.9780 3.990 \n",
"3 -1.0580 4.170 \n",
"4 -0.2860 4.220 \n",
"5 0.6610 4.050 \n",
"6 1.8900 3.710 \n",
"7 0.0940 3.610 \n",
"8 -0.3550 3.670 \n",
"9 1.6370 3.390 \n",
"10 -0.5350 3.410 \n",
"11 1.3250 3.200 \n",
"12 0.4490 3.070 \n",
"13 1.3560 2.890 \n",
"14 0.7780 2.860 \n",
"15 1.4660 2.690 \n",
"16 -1.9100 2.960 \n",
"17 1.7980 2.650 \n",
"18 0.3120 2.600 \n",
"19 0.2640 2.560 \n",
"20 0.3750 4.170 \n",
"21 0.8000 4.070 \n",
"22 -0.6850 4.170 \n",
"23 -0.7850 4.310 \n",
"24 0.0230 4.330 \n",
"25 0.1680 4.310 \n",
"26 0.3205 4.265 \n",
"27 0.4730 4.220 \n",
"28 0.4550 4.220 \n",
"29 0.5170 4.150 \n",
"30 -0.1800 4.190 \n",
"31 0.4940 4.120 \n",
"32 0.2970 4.110 \n",
"33 -0.3260 4.160 \n",
"34 -0.2170 4.170 \n",
"35 -0.1350 4.180 \n",
"36 -0.0550 4.180 \n",
"37 -0.6990 4.240 \n",
"38 -0.9230 4.350 \n",
"39 1.1810 4.250 \n",
"40 0.1220 0.850 \n",
"41 0.2690 0.820 \n",
"42 1.1230 0.670 \n",
"43 -0.2680 0.720 \n",
"44 -0.2090 0.750 \n",
"45 0.4540 0.690 \n",
"46 0.5470 0.620 \n",
"47 -0.1540 0.640 \n",
"48 0.2800 0.610 \n",
"49 0.3570 0.560 \n",
"50 0.4110 0.535 \n",
"51 0.4650 0.510 \n",
"52 -0.1140 0.530 \n",
"53 -0.0970 0.540 \n",
"54 -0.6600 0.630 \n",
"55 -0.3380 0.680 \n",
"56 0.6500 0.600 \n",
"57 0.2110 0.570 \n",
"58 -0.1420 0.590 \n",
"59 0.4710 0.530 \n",
"\n",
" Yield to Maturity (conv.) \n",
"0 4.250 \n",
"1 4.220 \n",
"2 4.030 \n",
"3 4.210 \n",
"4 4.270 \n",
"5 4.090 \n",
"6 3.750 \n",
"7 3.650 \n",
"8 3.700 \n",
"9 3.420 \n",
"10 3.440 \n",
"11 3.230 \n",
"12 3.100 \n",
"13 2.920 \n",
"14 2.880 \n",
"15 2.700 \n",
"16 2.980 \n",
"17 2.670 \n",
"18 2.620 \n",
"19 2.570 \n",
"20 4.210 \n",
"21 4.100 \n",
"22 4.210 \n",
"23 4.350 \n",
"24 4.370 \n",
"25 4.350 \n",
"26 4.305 \n",
"27 4.260 \n",
"28 4.260 \n",
"29 4.190 \n",
"30 4.230 \n",
"31 4.160 \n",
"32 4.150 \n",
"33 4.200 \n",
"34 4.210 \n",
"35 4.230 \n",
"36 4.220 \n",
"37 4.290 \n",
"38 4.400 \n",
"39 4.290 \n",
"40 0.850 \n",
"41 0.820 \n",
"42 0.670 \n",
"43 0.720 \n",
"44 0.750 \n",
"45 0.690 \n",
"46 0.620 \n",
"47 0.650 \n",
"48 0.610 \n",
"49 0.570 \n",
"50 0.540 \n",
"51 0.510 \n",
"52 0.530 \n",
"53 0.540 \n",
"54 0.630 \n",
"55 0.680 \n",
"56 0.600 \n",
"57 0.570 \n",
"58 0.590 \n",
"59 0.530 "
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sample_df"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "36ec4312", "id": "36ec4312",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"sample_df.to_csv('aum_sample.csv', index=False)" "sample_df.to_csv('eur_gov_indices.csv', index=False)"
] ]
} }
], ],

View File

@ -0,0 +1,101 @@
Date,Yld to Maturity
04/12/2015,-0.138
07/12/2015,-0.142
08/12/2015,-0.147
09/12/2015,-0.235
10/12/2015,-0.232
11/12/2015,-0.231
14/12/2015,-0.23
15/12/2015,-0.239
16/12/2015,-0.241
17/12/2015,-0.238
18/12/2015,-0.237
21/12/2015,-0.231
22/12/2015,-0.231
23/12/2015,-0.234
24/12/2015,-0.244
28/12/2015,-0.238
29/12/2015,-0.223
30/12/2015,-0.14
31/12/2015,-0.127
04/01/2016,-0.241
05/01/2016,-0.251
06/01/2016,-0.253
07/01/2016,-0.233
08/01/2016,-0.235
11/01/2016,-0.236
12/01/2016,-0.233
13/01/2016,-0.237
14/01/2016,-0.24
15/01/2016,-0.239
18/01/2016,-0.24
19/01/2016,-0.239
20/01/2016,-0.238
21/01/2016,-0.24
22/01/2016,-0.241
25/01/2016,-0.238
26/01/2016,-0.236
27/01/2016,-0.237
28/01/2016,-0.239
29/01/2016,-0.228
31/01/2016,-0.228
01/02/2016,-0.237
02/02/2016,-0.232
03/02/2016,-0.247
04/02/2016,-0.231
05/02/2016,-0.236
08/02/2016,-0.242
09/02/2016,-0.237
10/02/2016,-0.237
11/02/2016,-0.239
12/02/2016,-0.24
15/02/2016,-0.243
16/02/2016,-0.242
17/02/2016,-0.244
18/02/2016,-0.244
19/02/2016,-0.243
22/02/2016,-0.242
23/02/2016,-0.246
24/02/2016,-0.247
25/02/2016,-0.249
26/02/2016,-0.243
29/02/2016,-0.227
01/03/2016,-0.238
02/03/2016,-0.234
03/03/2016,-0.238
04/03/2016,-0.236
07/03/2016,-0.239
08/03/2016,-0.234
09/03/2016,-0.236
10/03/2016,-0.242
11/03/2016,-0.242
14/03/2016,-0.243
15/03/2016,-0.248
16/03/2016,-0.339
17/03/2016,-0.347
18/03/2016,-0.345
21/03/2016,-0.345
22/03/2016,-0.344
23/03/2016,-0.346
24/03/2016,-0.349
28/03/2016,-0.349
29/03/2016,-0.347
30/03/2016,-0.347
31/03/2016,-0.303
01/04/2016,-0.335
04/04/2016,-0.331
05/04/2016,-0.332
06/04/2016,-0.334
07/04/2016,-0.33
08/04/2016,-0.334
11/04/2016,-0.333
12/04/2016,-0.341
13/04/2016,-0.337
14/04/2016,-0.34
15/04/2016,-0.341
18/04/2016,-0.348
19/04/2016,-0.34
20/04/2016,-0.343
21/04/2016,-0.342
22/04/2016,-0.34
25/04/2016,-0.341
1 Date Yld to Maturity
2 04/12/2015 -0.138
3 07/12/2015 -0.142
4 08/12/2015 -0.147
5 09/12/2015 -0.235
6 10/12/2015 -0.232
7 11/12/2015 -0.231
8 14/12/2015 -0.23
9 15/12/2015 -0.239
10 16/12/2015 -0.241
11 17/12/2015 -0.238
12 18/12/2015 -0.237
13 21/12/2015 -0.231
14 22/12/2015 -0.231
15 23/12/2015 -0.234
16 24/12/2015 -0.244
17 28/12/2015 -0.238
18 29/12/2015 -0.223
19 30/12/2015 -0.14
20 31/12/2015 -0.127
21 04/01/2016 -0.241
22 05/01/2016 -0.251
23 06/01/2016 -0.253
24 07/01/2016 -0.233
25 08/01/2016 -0.235
26 11/01/2016 -0.236
27 12/01/2016 -0.233
28 13/01/2016 -0.237
29 14/01/2016 -0.24
30 15/01/2016 -0.239
31 18/01/2016 -0.24
32 19/01/2016 -0.239
33 20/01/2016 -0.238
34 21/01/2016 -0.24
35 22/01/2016 -0.241
36 25/01/2016 -0.238
37 26/01/2016 -0.236
38 27/01/2016 -0.237
39 28/01/2016 -0.239
40 29/01/2016 -0.228
41 31/01/2016 -0.228
42 01/02/2016 -0.237
43 02/02/2016 -0.232
44 03/02/2016 -0.247
45 04/02/2016 -0.231
46 05/02/2016 -0.236
47 08/02/2016 -0.242
48 09/02/2016 -0.237
49 10/02/2016 -0.237
50 11/02/2016 -0.239
51 12/02/2016 -0.24
52 15/02/2016 -0.243
53 16/02/2016 -0.242
54 17/02/2016 -0.244
55 18/02/2016 -0.244
56 19/02/2016 -0.243
57 22/02/2016 -0.242
58 23/02/2016 -0.246
59 24/02/2016 -0.247
60 25/02/2016 -0.249
61 26/02/2016 -0.243
62 29/02/2016 -0.227
63 01/03/2016 -0.238
64 02/03/2016 -0.234
65 03/03/2016 -0.238
66 04/03/2016 -0.236
67 07/03/2016 -0.239
68 08/03/2016 -0.234
69 09/03/2016 -0.236
70 10/03/2016 -0.242
71 11/03/2016 -0.242
72 14/03/2016 -0.243
73 15/03/2016 -0.248
74 16/03/2016 -0.339
75 17/03/2016 -0.347
76 18/03/2016 -0.345
77 21/03/2016 -0.345
78 22/03/2016 -0.344
79 23/03/2016 -0.346
80 24/03/2016 -0.349
81 28/03/2016 -0.349
82 29/03/2016 -0.347
83 30/03/2016 -0.347
84 31/03/2016 -0.303
85 01/04/2016 -0.335
86 04/04/2016 -0.331
87 05/04/2016 -0.332
88 06/04/2016 -0.334
89 07/04/2016 -0.33
90 08/04/2016 -0.334
91 11/04/2016 -0.333
92 12/04/2016 -0.341
93 13/04/2016 -0.337
94 14/04/2016 -0.34
95 15/04/2016 -0.341
96 18/04/2016 -0.348
97 19/04/2016 -0.34
98 20/04/2016 -0.343
99 21/04/2016 -0.342
100 22/04/2016 -0.34
101 25/04/2016 -0.341