Final Flashcards
What is fundamental analysis?
Trends based on: Is price below value Value of a company Earnings Dividends Cashflows
What is fundamental analysis?
Trends based on: Is price below value Value of a company Earnings Dividends Cashflows
What is technical analysis
Trends based on:
price or volume (only)
What are indicators?
Heuristics used for technical analsyis (statistics).
Individual indicators are ___
weak
When is technical analysis effective?
- combinations of indicators
- contrasts (stock vs market)
- shorter time periods
What is the best trading horizon for fundamental factors?
—> increasing value when time increases, valuable after years
What is the best trading horizon for technical factors?
When does decision speed increase?
At a smaller trading horizon in technical analysis
When does decision complexity increase?
At a larger trading horizon in fundamental analysis
What is momentum?
How much has the price changed over some number of days
What is Simple Moving Average
Lookback over a window to get a rolling average
What are Bollinger Bands
Bollinger Bands is a simple moving average divided by standard deviations. It is the SMA with volatility taken into account.
How do you calculate Momentum?
Momentum = price[t] / price[t - n] - 1.0
Typically -0.5 to 0.5
How do you calculate Simple Moving Average?
price[t] / [ price.mean (over lookback) ] - 1.0
How do you calculate a Bollinger Band
BB = price[t] - SMA[t] / 2 * std
What is a BB sell signal?
Price is above the upper band moving in (crossing the upper band)
How do you normalize technical indicators?
values - mean / std
normalize values between -1 and 1.0
How do you normalize technical indicators?
values - mean / std
normalize values between -1 and 1.0
What is technical analysis
Trends based on:
price or volume (only)
What are indicators?
Heuristics used for technical analsyis (statistics).
Individual indicators are ___
weak
When is technical analysis effective?
- combinations of indicators
- contrasts (stock vs market)
- shorter time periods
What is the best trading horizon for fundamental factors?
—> increasing value when time increases, valuable after years
How do we adjust the price for dividends?
Go back in time on the stock data and subtract dividend payments when they occur.
When does decision speed increase?
At a smaller trading horizon in technical analysis
When does decision complexity increase?
At a larger trading horizon in fundamental analysis
What is momentum?
How much has the price changed over some number of days
What is Simple Moving Average
Lookback over a window to get a rolling average
What are Bollinger Bands
Bollinger Bands is a simple moving average divided by standard deviations. It is the SMA with volatility taken into account.
How do you calculate Momentum?
Momentum = price[t] / price[t - n] - 1.0
Typically -0.5 to 0.5
How do you calculate Simple Moving Average?
price[t] / [ price.mean (over lookback) ] - 1.0
How do you calculate a Bollinger Band
BB = price[t] - SMA[t] / 2 * std
What is the Strong Efficient Markets Hypothesis?
Prices reflect all information public and private
- even insider info can’t be leveraged.
What is a BB buy signal?
Price is below the lower band moving in (crossing the lower band)
How do you normalize technical indicators?
values - mean / std
normalize values between -1 and 1.0
What is the finest resolution of data?
A tick, a successful buy/sell transaction with volume
How is tick data organized?
Typically minute by minute or hour by hour.
Contains data including:
open, high, low, close, volume
What is Grinold’s Fundamental Law?
A fundamental law of active portfolio management.
performance = skill * sqrt( breadth)
IR = IC * sqrt(trading opportunities)
IR - information ratio
IC - information coefficent
What is IR?
Information Ratio
The Sharpe Ratio of excess returns. The manner in which the portfolio manager is exceeding the market performance.
What is adjusted close?
A timeline of stock prices adjusted for stock splits. Based on going back over historical data and fixing the splits.
Can a single theory relate differing trade strategies?
Yes, the fundamental law of active portfolio management
How do we adjust the price for dividends?
Go back in time on the stock data and subtract dividend payments when they occur.
What is survivor bias?
Strategy that selects stocks for analysis yesterday based off of success today.
If looking at historic stock data, look at the SP500 or stocks at the historical time
What is the Efficient Markets Hypothesis?
We cannot exploit assumptions in advance of the market.
- Large number of investors in market
- New information arrives randomly
- Prices adjust quickly
- Prices reflect all available information
What is breadth?
The number of trading opportunities per year?
What is the fundamental law, as expressed by richard grinold?
IR = IC * sqrt (BR)
perf = skill * rt(breadth)
Where does stock information come from?
- price/volume (rapid, quick, everyone can see it)
- fundamental (quarterly reports, public, root of company value)
- exogenous (information about the world affecting company, ex. price of oil affects airline)
- company insiders (ceo knows that company will have success)
What are the 3 forms of the Efficient Markets Hypothesis?
Weak - future prices cannot be predicted by analyzing historical prices
Semi-strong- prices adjust rapidly to new public information
Strong - prices reflect all information public and private
What is the Weak Efficient Markets Hypothesis?
Future prices cannot be predicted by analyzing historical prices
- silent on fundamental analysis or insider info
What is the Semi-Strong Efficient Markets Hypothesis?
Prices adjust rapidly to new public information
- silent on insider info
What is the Strong Efficient Markets Hypothesis?
Prices reflect all information public and private
- even insider info can’t be leveraged.
What does the weak EMH prohibit?
technical analysis
What does the Semi-Strong EMH prohibit?
technical analysis
fundamental analysis
What does the Strong EMH prohibit?
technical analysis
fundamental analysis
insider info
What is the PE ratio?
Price to Earnings ratio
What is Grinold’s Fundamental Law?
A fundamental law of active portfolio management.
performance = skill * sqrt( breadth)
What is IR?
Information Ratio
The Sharpe Ratio of excess returns. The manner in which the portfolio manager is exceeding the market performance.
What are the 3 takeaways from considering risk and reward together
- Higher alpha generates higher sharpe ratio
- More execution opportunities provides higher sharpe ratio
- Sharpe ratio grows as the square root of breadth
Can a single theory relate differing trade strategies?
Yes, the fundamental law of active portfolio management
What is IR?
Information Ratio:
The information ratio is the mean of all of the alpha components divided by the standard deviation of the alpha components.
IR = Mean (alpha p(t) ) /
Std( alpha p(t))
Is it the Sharpe Ratio of excess return
What is the return on the market for a particular day?
R(t) = Beta * r(t) + alpha p(t)
Beta * r(t) - market alpha p(t) - skill
What is IC?
The correlation of the managers forecasts to actual returns
ranges from 0.0 to 1.0
What is breadth?
The number of trading opportunities per year?
What is the fundamental law, as expressed by richard grinald?
IR = IC * sqrt (BR)
What is Portfolio Optimization?
Mean variance optimization
What is risk?
Volatility, standard deviation of historical daily returns
What is covariance of two stocks?
The correlation coefficient of the daily returns of two stocks?
When is covariance positive? negative?
Positive covariance when elements are correlated, negative covariance when elements are anti-correlated
What is Mean Variance Optimization (MVO)?
Anti-correlation in the short term, correlation in the long term. Allocating funds in such a way that risks cancel out in the short time
What factors does a Mean Variance Optimizer require?
Inputs: Expected return volatility covariance target return
Output:
Asset weights for portfolio that minimize risks
What are MVO inputs?
Expected return
volatility
covariance
target return
What are MVO outputs?
Asset weight for portfolio that minimzes risks
What is the Efficient Frontier?
For any particular return level, there is an optimal portfolio (lowest risk for the particular return).
As you reduce the return the curve comes back. Risk eventually increases as you reduce the return.
The efficient frontier is the line of optimal portfolios. There are no portfolios above the efficient frontier but all portfolio’s below the frontier are suboptimal in some way
What is the significance of a line from the origin to the efficient frontier?
That is the line where the Sharpe Ratio is maximized for the assets
What is Reinforcement Learning?
A problem, not a solution. Many problems solve the RL problem.
Sense - Think - Act
What is Pi(s)
The policy that a robot has to determine actions based on states, rewards
How do you map a trading problem to RL?
Environment: market
State: Features, Holdings
Reward: daily returns
Action: Buy, Sell, Nothing
What is a Markov Decision Problem?
Set of states S
Set of actions A
Transition function T[s, a, s’]
Reward Function R[s,a]
What is the transition function in RL?
T[s, a, s’]
3d object. Records the probability of s’ given s and a. The sum of all T[s, a] = 1.0
If we have T and R in RL what are the algorithms that can be used?
Policy Iteration
Value Iteration
What is an experience tuple on RL?
What is a model-based RL algorithm?
Build model of T[s, a, s’] and R[s,a]
Value/Policy Iteration
What is a model-free RL algorithm?
QLearning.
Develop a policy directly by looking at data
What is the function for discounted reward?
Sum of i to inf:
gamma ^ (i - 1) * Ri
What is Q in QLearner
Q[s, a] a function or table. Q is the value of an action.
Q[s, a] = immediate reward + discounted reward
How do you use Q in QLearner?
Use Q to determine the policy of which action to take given a specific state.
Policy (Pi) of S = argmax of a ( Q[s, a] )
What is the big picture QLEarning procedure?
- Select training data
- Iterate over time
- Test Policy Pi
- Repeat until Converged
What are the details of the QLearning procedure?
- Set startime, init Q[]
- Compute S
- Select A
- Observe R, S’
- Update Q
What is the update rule for QLearner?
Q’[S, A] = (1 - alpha)Q[s,a] + alpha*ImprovedEstimate
Q’[S,A] = (1 - alpha)Q[S,A] + alpha ( R + gamma * laterRewards)
Q’[S,A] = (1 - alpha)Q[S,A] + alpha (r + gamma * Q[S’, ArgMaxA’(Q[S’,A’]) ]
What is gamma?
The Discount Factor used to progressively reduce the value of future rewards.
Between 0 and 1
What is alpha?
The Learning Rate used to vary the weight given to a new experience compared to past Q-values.
Between 0 and 1
What is ArgMax A’ ( Q[S’,A’] )
The action that maximizes the Q-value among all possible actions a’ from s’
How is QLearning made successful? How is this accomplished?
QLearning success is dependent on exploration.
This is accomplished by randomizing action selection. Choose random actions frequently in the beginning and reduce the randomness as you go.
What are the actions for the QLearner in trading?
Buy
Sell
Do Nothing
How do you discretize a number?
Stepsize = side (data) / steps data.sort() for in in range (0, steps) { threshold[i] = data[(i+1) * stepsize] }
What is the advantage of QLearning compared to Model methods of RL?
It can be applied to domains where all states and/or transitions are not fully defined
What is the Dyna process?
Learn Model T, R
Hallucinate Experience
Update Q
How do we hallucinate an experience with dyna?
s = random a = random s' = infer from T[] r = R[s,a]
How do we update our model using Dyna?
Generate T’[S, A, S’]
R’[S,A]
How do you Learn T for Dyna?
T[S,A,S’] = Prob S, A -> S
init Tc [] = 0.00001
While executing, observe S, A, S’
increment Tc[S,A,S’]
How do we evalute T for Dyna?
T[S,A,S’] = Tc[S,A,S’] / sum Tc[S,A] (all S’)
How do you learn R for Dyna?
R[S,A] = Expected reward fo s,a r = immediate reward R'[S,A] = (1 - alpha) *R[S,A] + alpha * r
What is the entire Dyna Q process?
(QLearn) Init Q Table Observe S Execute A, Observe S',r Update Q with (Dyna) T'[S,A,S'] update R'[S,A] update (repeat) S = random A = random S' = infer from T[] r = R[S,A] update Q with
How do you validate a time-series model like a ML trade strategy?
Backtest to validate the model using:
Roll Forward Cross Validation
You can’t slice time randomly. The future predicts the past.
What is in sample backtesting?
Back testing over the same data you used to train your model.
The method is doomed to succeed.
How do you avoid in sample backtesting?
Build safeguards and procedures to prevent testing over the same data you train over. ie. train over 2007, test over 2008
What is survivor bias?
Selective use of data in a statistical study that emphasizes examples that are alive at the end of the study.
How do you prevent survivor bias?
Use historic index membership
Pair with SBF-free data
Use these indices as your universe for testing
What is market impact?
The act of trading affects price. Historical data does not include your trades and is therefore not an accurate representation of the price you would get
How do you ignore market impact on ML strategy?
Include a “slippage” or “market impact” model in backtests
What is a basket indicator?
An indicator that looks for divergence between stock and index
What is the Relative Strength Index?
An oscillatory indicator. On days the stock goes up how much does it go up on days the stock goes down how much does it go down.
0 to 100 scale. Under 30 oversold, over 70 over bought
What is the basket strategy?
When to go long? short? close?
Long: - symbol is oversold, index is not Short: - symbol is overbought, index is not Close: - symbol crosses through SMA
Divergence strategy