227 lines
8.0 KiB
Plaintext
227 lines
8.0 KiB
Plaintext
{
|
||
"cells": [
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "ec753176",
|
||
"metadata": {},
|
||
"source": [
|
||
"# Notes"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "b13688b9",
|
||
"metadata": {},
|
||
"source": [
|
||
"## Main Takeaways"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "5df7046f",
|
||
"metadata": {},
|
||
"source": [
|
||
"## Daily routine"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "5a622bb3",
|
||
"metadata": {},
|
||
"source": [
|
||
"\"The largest block of time I need to spend is in the morning\n",
|
||
"before the market opens: I typically need to run various programs to\n",
|
||
"download and process the latest historical data, read company news\n",
|
||
"that comes up on my alert screen, run programs to generate the orders for the day, and then launch a few baskets of orders before\n",
|
||
"the market opens and start a program that will launch orders automatically throughout the day. I would also update my spreadsheet\n",
|
||
"to record the previous day’s profit and loss (P&L) of the different\n",
|
||
"strategies I run based on the brokerages’ statements. All of this takes\n",
|
||
"about two hours.\" - Quant trader morning routine"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "f0855890",
|
||
"metadata": {},
|
||
"source": [
|
||
"## Definitions"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "7aab1f0d",
|
||
"metadata": {},
|
||
"source": [
|
||
"- ***directional trades*** - long or short only\n",
|
||
"- ***dollar-neutral trades*** - hedged or pair trades\n",
|
||
"- ***dollar neutral portfolio*** - The market value of the long positions equals the market value of the short positions\n",
|
||
"- ***market neutral portfolio*** - The beta of the portfolio with respect to a market index is close to zero, where beta measures the ratio between the expected returns of the portfolio and the expected returns of the market index\n",
|
||
"- ***Leverage*** - Borrowing funds to buy an investment\n",
|
||
"- ***slippage*** - The difference between the price that triggers the trading signal and the average execution price of the entire order"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "8ec7516e",
|
||
"metadata": {},
|
||
"source": [
|
||
"**Defn** Information Ratio (Sharpe ratio):\n",
|
||
"\n",
|
||
"$$\\text{Information Ratio} = \\frac{\\text{Average of Excess Returns}}{\\text{Standard Deviation of Excess Returns}}$$\n",
|
||
"\n",
|
||
"$$\\text{Excess Returns} = \\text{Portfolio Returns} - \\text{Benchmark Returns}$$"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "865b04b1",
|
||
"metadata": {},
|
||
"source": [
|
||
"- ***equaity curve***: A line chart of your portfolio's value over time\n",
|
||
"- ***drawdown***: The decline from a peak to a subsequent trough, expressed as a percentage. It's a measure of loss from a prior high, not from your starting point.\n",
|
||
"- ***maximum drawdown***: The largest peak-to-trough decline over the entire history of a strategy. It answers: \"What's the worst loss someone could have experienced if they invested at the worst possible time?\" It's one of the most common risk metrics used to evaluate strategies.\n",
|
||
"- ***high watermark***: The highest portfolio value ever reached\n",
|
||
"- ***maximum drawdown duration***: The longest amount of time spent below the high watermark.\n",
|
||
"- ***basis points***: 1 basis point is 0.01%\n",
|
||
"- ***regime shift*** - Situation when the financial market structure or the macroeconomic environment undergoes a drastic change so much so that trading strategies that were profitable before may not be profitable now"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "a845580c",
|
||
"metadata": {},
|
||
"source": [
|
||
"## Ruling out bad strategies"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "303f8dc1",
|
||
"metadata": {},
|
||
"source": [
|
||
"\n",
|
||
"- If a strategy trades only a few times a year, chances are its\n",
|
||
"Sharpe ratio won’t be high. This does not prevent it from being\n",
|
||
"part of your multistrategy trading business, but it does disqualify\n",
|
||
"the strategy from being your main profit center.\n",
|
||
"- If a strategy has deep (e.g., more than 10 percent) or lengthy\n",
|
||
"(e.g., four or more months) drawdowns, it is unlikely that it will\n",
|
||
"have a high Sharpe ratio. I will explain the concept of drawdown\n",
|
||
"in the next section, but you can just visually inspect the equity\n",
|
||
"curve (which is also the cumulative profit-and-loss curve, assuming no redemption or cash infusion) to see if it is very bumpy\n",
|
||
"or not. Any peak-to-trough of that curve is a drawdown. (See\n",
|
||
"Figure 2.1 for an example.)\n",
|
||
"\n",
|
||
"As a rule of thumb, any strategy that has a Sharpe ratio of less\n",
|
||
"than 1 is not suitable as a stand-alone strategy\n",
|
||
"\n",
|
||
"For a given strategy, its important to ask the following:\n",
|
||
"\n",
|
||
"- Does it outperform a benchmark?\n",
|
||
"- Does it have a high enough Sharpe ratio?\n",
|
||
"- Does it have a small enough drawdown and short enough drawdown duration?\n",
|
||
"- Does the backtest suffer from survivorship bias?\n",
|
||
"- Does the strategy lose steam in recent years compared to its earlier years?\n",
|
||
"- Does the Strategy Suffer from Data-Snooping Bias?\n",
|
||
"- Does the strategy have its own “niche” that protects it from intense competition from large institutional money managers?"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "ecc17253",
|
||
"metadata": {},
|
||
"source": [
|
||
"## Backtesting\n"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "98567746",
|
||
"metadata": {},
|
||
"source": [
|
||
"- When gathering data for backtesting, ensure data is split and dividend adjusted.\n",
|
||
"- A backtest that relies on high and low data is less reliable than one that relies on the open and close\n",
|
||
"- Typically, an extreme return should be accompanied by a news announcement, or should occur on a day when the market index also experienced extreme returns. If not, then your data is suspect."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "0dbd8630",
|
||
"metadata": {},
|
||
"source": [
|
||
"$$\\text{Annualized Sharpe Ratio} = \\sqrt{N_T} \\times \\text{Sharpe Ratio Based on }T$$"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "319f28df",
|
||
"metadata": {},
|
||
"source": [
|
||
"Incorporate transaction costs into backtests. Transaction costs include:\n",
|
||
"\n",
|
||
"- Commission\n",
|
||
"- Liquidity cost\n",
|
||
"- Opportunity cost\n",
|
||
"- Market Impact\n",
|
||
"- Slippage"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "1cbf1e0a",
|
||
"metadata": {},
|
||
"source": [
|
||
"Potential backtest performance issues:\n",
|
||
"\n",
|
||
"- Data: Split/dividend adjustments, noise in daily high/low, and\n",
|
||
"survivorship bias.\n",
|
||
"- Performance measurement: Annualized Sharpe ratio and maximum drawdown.\n",
|
||
"- Look-ahead bias: Using unobtainable future information for past\n",
|
||
"trading decisions.\n",
|
||
"- Data-snooping bias: Using too many parameters to fit historical\n",
|
||
"data, and avoiding it using large enough sample, out-of-sample\n",
|
||
"testing, and sensitivity analysis.\n",
|
||
"- Transaction cost: Impact of transaction costs on performance.\n",
|
||
"- Strategy refinement: Common ways to make small variations on\n",
|
||
"the strategy to optimize performance."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "8047f4f0",
|
||
"metadata": {},
|
||
"source": [
|
||
"## Execution Systems: Why does actual performance diverge from expectations?"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "30a1531a",
|
||
"metadata": {},
|
||
"source": [
|
||
"- Do you have bugs in your ATS software?\n",
|
||
"- Do the trades generated by your ATS match the ones generated\n",
|
||
"by your backtest program?\n",
|
||
"- Are the execution costs much higher than what you expected?\n",
|
||
"- Are you trading illiquid stocks that caused a lot of market impact?\n",
|
||
"- Strategy may have suffered from data-snooping bias or regime shift"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "d5ea890d",
|
||
"metadata": {},
|
||
"source": [
|
||
"## Money and Risk Management"
|
||
]
|
||
}
|
||
],
|
||
"metadata": {
|
||
"language_info": {
|
||
"name": "python"
|
||
}
|
||
},
|
||
"nbformat": 4,
|
||
"nbformat_minor": 5
|
||
}
|