The total change in the price of an investment over a set time period
cumulative_return = (price[t] / prince ) - 1
cumulative_return = (price at end / price the beginning ) - 1 price[t] is any particular day and price is the price at the beginning
Bollinger Bands (r)
Bands that are 2 standard deviations above and below the rolling mean.
Rolling mean +/- std deviation * 2
Why is data not pristine
- Data is an amalgamation of different sources and prices.
- Not all stocks trade every day.
Why does data go missing?
Some stocks stop trading and start trading. Some stock trade under the same ticker but different name. Some stocks trade erratically due to low market cap. 01-05-03
How do you fill gaps when there are gaps in data of a stock.
- Fill forward first,
- fill backwards second
- do not interpolate a trend.
Why are Bollinger Bands important.
The theory states that if the stock crosses the bands then it may be a point to pay attention.
How much did the price go up or down on a particular day.
- daily_return[t] = (price[t] / prince[t-1] ) - 1
- t = day t
How do you use a histogram to plot daily returns?
Take the daily return over a plot in time and fill the histogram values based on the number of occurrences of the daily returns.
What would you expect a histogram of daily returns to look like?
A normal or Gaussian distribution.
The difference between a normal Gaussian distribution and the distribution of the.
Kurtosis is positive with larger tails and negative with skinny tails.
beta (scatter plot)
- When fitting a line to scatter plot, beta the slope of the line..
- This indicates how reactive is the stock to the market.
alpha (scatter plot)
- When fitting a line to scatter plot, Alpha is where the line intercepts the vertical axis (y=0).
- This indicates how the stock is returning compared to the market as a whole.
How do you use a scatter plot to plot daily returns?
When comparing two stocks, take the daily returns of two stocks and plot (x, y) as (stock_a, stock_b).
Using linear regression plot the mean as a line to find beta and alpha.
E.G. when comparing a stock against the market as a whole
Slope vs correlation.
Correlation is how tight the points are to the mean, where as the slope is just the slope of the line.
What is a portfolio?
Allocation of funds to a set of stocks
How do you calculate the total value of the portfolio day by day?
- normalize the prices
- multiply normalized values x portfolio allocations
- Take that and multiply it by starting values
- sum each row
Risk adjusted Return
- Lower Risk is better
- Higher return is better
(Rp - Rf) / σp
ex ante E[Rp - Rf] / STD[Rp]
- Rp: portfolio return
- Rf: risk free rate of return
- σp: Standard Deviation of portfolio return
Lectures 01-07-05; 01-07-06
What is Risk free rate of return and where can you get it?
Return if you put your money into a bank
Can get it from
- 3 Month Tbill
- or Just use 0%
Lecture 01-07-05; 01-07-11
How do you calculate daily risk free rate if using Libor or 3 month tbill.
- Take the APR of the risk free option, (Libor, tbill)
- Add 1 to the APR
- Take the 252 root of that sum
- subtract 1
What is the annualized version of the sharpe ratio.
Since it was intended to be an annual measurement but can change based on frequencey of the sample SR
- Annualized Sharpe Ratio = K * SR
- K = sqrt(# of samples per year)
- Daily K = sqrt(252)
- Weekly K = sqrt(52)
- Monthly K = sqrt(12)
What is an optimizer?
- Finds minimum Values of functions using convex polyogns
- Build parameterized models based on data.
- Refine allocations to stocks in portfolios.
How to use an optimizer?
- Provide a function to minimize
- Provide an initial guess
- Optimizer searches for the minima
What are the methods do minimizers use?
How can minimizers be defeated?
- Lines with no gradient
- Many local minima
- More than 1 global minimal
- discontinuous lines
Lecture 01-08-03; 01-08-04
What are the easiest type of problems for minimizers and why?
What is a convex function?
In mathematics, a real-valued function defined on an n-dimensional interval is called convex (or convex downward or concave upward) if the line segment between any two points on the graph of the function lies above or on the graph. Must have one minima.
What is a parameterized model?
A model that take parameters or coefficients.
What is a good error metric for models?
- sum of all abs error
- sum of square error
Lecture 01-08-08, 01-08-09
What is portfolio optimization?
- Given a set of assets and a time period.
- Find an allocation of funds to assets that maximizes performance.
How do you measure performance in portfolio optimization?
- Cumulative return
- Volatility or risk
- Sharpe Ratio (Risk adjusted return)