Datacamp Python 3
Datacamp Python 3
benchmark
I N T R O D U C T I O N TO P O R T F O L I O A N A LY S I S I N P Y T H O N
Charlotte Werger
Data Scientist
Active investing against a benchmark
Calculated as the difference between the benchmark and the actual return.
Active return is achieved by "active" investing, i.e. taking overweight and underweight positions
from the benchmark.
Passive investment funds, or index trackers, don't use active return as a measure for
performance.
Tracking error is the name used for the difference in portfolio and benchmark for a passive
investment fund.
print (grouped_df['active_weight'])
GICS Sector
Consumer Discretionary 20.257
Financials -2.116
...etc
Charlotte Werger
Data Scientist
What is a factor?
Factors in portfolios are like nutrients in food
# Plot results
df['corr'].plot()
Charlotte Werger
Data Scientist
Using factors to explain performance
Empirical factor models exist that have been tested on historic data.
b1, b2 = model.params
Charlotte Werger
Data Scientist
Professional portfolio analysis tools
Strategy works on historic data: not guaranteed to work well on future data -> changes in markets
1 Github: https://github.com/quantopian/pyfolio
pf.create_position_tear_sheet(returns, positions,
sector_mappings=sect_map)