mirror of
https://github.com/bspeice/speice.io
synced 2024-12-23 09:08:10 -05:00
384 lines
507 KiB
Plaintext
384 lines
507 KiB
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Profitability using the Investment Formula\n",
|
||
|
"\n",
|
||
|
"I've previously talked about crafting an [Investment Formula][1] that would guarantee making money if you could predict which direction the stock market was going to go. This is going to be the first in a series of posts trying to flesh out what an actual investment strategy based on this formula would look like.\n",
|
||
|
"\n",
|
||
|
"But first, the formula doesn't take into account two very important things: **leverage**, and the **number of days invested**. That's why I want to set up what I'm going to call the **Profitability Score**.\n",
|
||
|
"\n",
|
||
|
"The definition is going to be very simple:\n",
|
||
|
"\n",
|
||
|
"- $p$: Profit made once you exit the investment\n",
|
||
|
"- $i$: Initial investment into the asset\n",
|
||
|
"- $m$: Maximum investment in the asset\n",
|
||
|
"- $l = m / i$: The maximum leverage of an investment, as the ratio of maximum invested to initial investment\n",
|
||
|
"- $d$: The number of days it takes to turn a profit\n",
|
||
|
"\n",
|
||
|
"$s = \\frac{1000 p}{i(l + d)} = \\frac{1000 p}{m + i\\cdot d}$\n",
|
||
|
"\n",
|
||
|
"Crazy, right? The score is simply the (normalized) profit you made divided by the leverage plus days invested. The $\\cdot 1000$ is just to turn the number into something more reasonable - people don't like hearing something with a profitability score of .001 for example.\n",
|
||
|
"\n",
|
||
|
"# Theoretical Justification\n",
|
||
|
"\n",
|
||
|
"The formula itself is designed to be simple in principle: I like making a profit, and I want to penalize the leverage you incur and days you have to invest. Ideally, we want to have a stock that goes up all the time. However, the investment formula takes advantage of a different case: trying to profit from highly volatile assets. If we can make money when the investment only has one day up, let's do it!\n",
|
||
|
"\n",
|
||
|
"Even so, there are two potential issues: First, stocks that trend upward will have a higher profitability score - both leverage and days invested will be 1. To protect against only investing in this trend, I can do things like taking $\\log(d)$. I don't want to start biasing the scoring function until I have a practical reason to do so, so right now I'll leave it standing.\n",
|
||
|
"\n",
|
||
|
"The second issue is how to penalize leverage and days invested relative to each other. As it currently stands, a leverage of 6x with only 1 day invested is the same as leveraging 2x with 3 days invested. In the future, I'd again want to look at making the impact of days invested smaller - I can get over an extra 3 days in the market if it means that I don't have to incur a highly leveraged position.\n",
|
||
|
"\n",
|
||
|
"So there could be things about the scoring function we change in the future, but I want to run some actual tests before we start worrying about things like that!\n",
|
||
|
"\n",
|
||
|
"# Running a simulation\n",
|
||
|
"\n",
|
||
|
"This won't be an incredibly rigorous backtest, I just want to see some results from the work so far. Let's set up the simulation code again, and start looking into some random stocks. **If you've read the last blog post, you can skip over the code.** The only difference is that it's been ported to python to make the data-wrangling easier. Julia doesn't yet support some of the multi-index things I'm trying to do.\n",
|
||
|
"\n",
|
||
|
"[1]: https://bspeice.github.io/guaranteed-money-maker.html"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 19,
|
||
|
"metadata": {
|
||
|
"collapsed": false
|
||
|
},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"import numpy as np\n",
|
||
|
"import pandas as pd\n",
|
||
|
"import matplotlib.pyplot as plt\n",
|
||
|
"from Quandl import get as qget\n",
|
||
|
"%matplotlib inline\n",
|
||
|
"api_key = ''\n",
|
||
|
"\n",
|
||
|
"profitability = lambda p, i, m, d: 1000*p / (m + i*d)\n",
|
||
|
"\n",
|
||
|
"def is_profitable(current_price, purchase_history, open_history):\n",
|
||
|
" shares = (purchase_history / open_history).sum()\n",
|
||
|
" return current_price * shares > sum(purchase_history)\n",
|
||
|
"\n",
|
||
|
"def daily_investment(current_open, current_close, purchase_history, open_history):\n",
|
||
|
" t1 = current_close / current_open - 1\n",
|
||
|
" t2 = (purchase_history - purchase_history * current_close / open_history).sum()\n",
|
||
|
" return t2 / t1\n",
|
||
|
"\n",
|
||
|
"def simulate_day(open_vals, close_vals, init, expected, bias):\n",
|
||
|
" invested = np.array([init])\n",
|
||
|
" \n",
|
||
|
" day = 1\n",
|
||
|
" profitable = is_profitable(close_vals[day-1], invested, open_vals[0:len(invested)]) \\\n",
|
||
|
" or is_profitable(open_vals[day], invested, open_vals[0:len(invested)])\n",
|
||
|
"\n",
|
||
|
" while not profitable:\n",
|
||
|
" expected_close = open_vals[day] * expected\n",
|
||
|
" todays_purchase = daily_investment(open_vals[day], expected_close, invested, open_vals[0:day])\n",
|
||
|
" invested = np.append(invested, todays_purchase + bias)\n",
|
||
|
" # expected_profit = expected_close * (invested / open_vals[0:len(invested)]).sum() - invested.sum()\n",
|
||
|
" day += 1\n",
|
||
|
" profitable = is_profitable(close_vals[day-1], invested, open_vals[0:len(invested)]) \\\n",
|
||
|
" or is_profitable(open_vals[day], invested, open_vals[0:len(invested)])\n",
|
||
|
" \n",
|
||
|
" shares = (invested / open_vals[0:len(invested)]).sum()\n",
|
||
|
" \n",
|
||
|
" # Make sure we can't see into the future - we know either today's close or tomorrow's open\n",
|
||
|
" # will be profitable, but we need to check which one.\n",
|
||
|
" if is_profitable(close_vals[day-1], invested, open_vals[0:len(invested)]):\n",
|
||
|
" ending_price = close_vals[day-1]\n",
|
||
|
" else:\n",
|
||
|
" ending_price = open_vals[day]\n",
|
||
|
" \n",
|
||
|
" profit = shares * ending_price - sum(invested)\n",
|
||
|
" return invested, profit\n",
|
||
|
"\n",
|
||
|
"def simulate_ts(name, start, end, initial, expected, bias):\n",
|
||
|
" ticker_info = qget(name, trim_start=start, api_key=api_key)\n",
|
||
|
" evaluation_times = ticker_info[:end].index\n",
|
||
|
" \n",
|
||
|
" # Handle Google vs. YFinance data\n",
|
||
|
" if \"Adjusted Close\" in ticker_info.columns:\n",
|
||
|
" close_column = \"Adjusted Close\"\n",
|
||
|
" else:\n",
|
||
|
" close_column = \"Close\"\n",
|
||
|
" \n",
|
||
|
" sim = {d: simulate_day(ticker_info[d:][\"Open\"], ticker_info[d:][close_column],\n",
|
||
|
" 100, 1.02, 10) for d in evaluation_times}\n",
|
||
|
" sim_series = pd.Series(sim)\n",
|
||
|
" result = pd.DataFrame()\n",
|
||
|
" result[\"profit\"] = sim_series.apply(lambda x: x[1])\n",
|
||
|
" result[\"max\"] = sim_series.apply(lambda x: max(x[0]))\n",
|
||
|
" result[\"days\"] = sim_series.apply(lambda x: len(x[0]))\n",
|
||
|
" result[\"score\"] = sim_series.apply(lambda x: profitability(x[1], x[0][0], max(x[0]), len(x[0])))\n",
|
||
|
" result[\"investments\"] = sim_series.apply(lambda x: x[0])\n",
|
||
|
" \n",
|
||
|
" return result\n",
|
||
|
"\n",
|
||
|
"def simulate_tickers(tickers):\n",
|
||
|
" from datetime import datetime\n",
|
||
|
" results = {}\n",
|
||
|
" for ticker in tickers:\n",
|
||
|
" start = datetime(2015, 1, 1)\n",
|
||
|
" results_df = simulate_ts(ticker, start, datetime(2016, 1, 1), 100, 1.01, 10)\n",
|
||
|
" results[ticker] = results_df\n",
|
||
|
" \n",
|
||
|
" return pd.concat(list(results.values()), keys=list(results.keys()), axis=1)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# And now the interesting part\n",
|
||
|
"\n",
|
||
|
"Let's start looking into the data! FANG stocks have been big over the past year, let's see how they look:"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 7,
|
||
|
"metadata": {
|
||
|
"collapsed": false
|
||
|
},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"fang_df = simulate_tickers([\"YAHOO/FB\", \"YAHOO/AAPL\", \"YAHOO/NFLX\", \"YAHOO/GOOG\"])"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 8,
|
||
|
"metadata": {
|
||
|
"collapsed": false
|
||
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABBgAAAIICAYAAADE513IAAAABHNCSVQICAgIfA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cUxEPHHI+fQabj/I8Rmm3wJ7UlwJZArYOTO3zsx/67Ftr/fPH1J0Uvyo+45yisINjOh9UtaD\naFF0Js1SvB5+QfH62bLHQy7vEeON5WMX6738CeDxEbErQEQ8nGKqz6eGVLRTkrRI7GCQpPGza/nz\nig1tlJlnACso5qR/HXg28GXggrJewHz9po8YB1XVFL0751g/CVXu7/W6iOLKIx8FrgfeCLyA4kPx\nARQ5df+fP55imki7WOPrKC7JeI8Pzpn5bopRA4dQ1A54HfDdiDhqHnG2h+dvPsf99+/artNcx2ex\n3ZmZF2Tm+Zn5X5m5ofdiFe+fnspOoLMpaje8A3gxRR2FvSg6n8a13XcixbFvj2Jo/zyhmnAkSf0a\n1380ktRkr6f4dvc/NrZhZs5m5qmZ+ZeZ+UiK4ovPYLTD9QPYqcf6R1PE3VnB/2bgwT22fWSPdQst\nIHc1sGNE3ON/WVmkcIeuOIbhauBhZXHJbjsDt2VmdwHAYXoDxd/oqx3rXgX8NDNfkJknZuZZmXk+\nxTfW91JOg7gEeF1EbAG8FPhSZs722HYmMz+WmfsBD6MoWPmOeYzS+Clzv0ag+FvNNZpkvkZVyHFY\nfgn8D8V74h4iYilFAc1+X58byn1/irbd3pn50cz8amZ+nWKaSa/RC9DjOEXEcmDpADF22+Dxysw1\nwFeAV0bE5hQdZN/JzHuNrpAkjTc7GCRpTETEfSLiA8DTgP/Y0FUNym236HHXNMWHu84P9Wvp/SF/\nEG/q/KBdxvJXFMOq/7N
|
||
|
"text/plain": [
|
||
|
"<matplotlib.figure.Figure at 0x1d03825bda0>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"fang_df.xs('days', axis=1, level=1).hist()\n",
|
||
|
"plt.gcf().set_size_inches(18, 8);\n",
|
||
|
"plt.gcf().suptitle(\"Distribution of Days Until Profitability\", fontsize=18);"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 10,
|
||
|
"metadata": {
|
||
|
"collapsed": false
|
||
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABBEAAAGECAYAAABgaLg8AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzs3Xt41OWZ//HPPTlCSMIhBcJR1NZiWzxctoBuV/gJHsBq\nWWURNFsXu7TqWqsLrW5bhdbK1l1W4VJ3V6hCFFcNUrUtBw3Ws9JdLVCUutoSREQwAsmEw0xm5vn9\nMZMxh0kyk8N8h+T9uq65yDzzzPf7zAxovvfc9/2Yc04AAAAAAADt8Xm9AAAAAAAAcHwgiAAAAAAA\nAJJCEAEAAAAAACSFIAIAAAAAAEgKQQQAAAAAAJAUgggAAAAAACApBBEAABnFohaa2Z/NrN7MwrHx\nlWYW6aZzLjSziJmNSnJ+lZk932zsBTP7S7Oxblszjn+p/r0DACATEEQAACRkZufGLnAa3/xm9r9m\n9j0z667/h1wt6TZJmyTNlXRVbNxJanJBbmaXmtntXXBOF7slK5JgfqLnd+eacRxo5/Nu8fcDAIBM\nZ86l8jsTAKC3MLNzJf1O0qOS1kkyScMUvcgfK+kB59x3u+G8qyVd5Jwb2Gw8S1KWcy7YaOwhSX/n\nnMvq5DlvVzRwMcY590ES83MkOedcqNHY7ySNds6dmI414/jQ1ucdC8RlN/77AQBApsv2egEAgIz3\nlnPu0YY7ZvafknZI+raZ/cQ590miJ5lZtqIX0IEUzzdU0qHmg865sKRw89OkeOwu4ZyrT3JexqzZ\nC2bWzzlX5/U6ulMSr7HVz9s5F5FEAAEAcFyhnAEAkBLnnF/S64peHJ0oNantPtXM/t3Mdks6Kml8\nw/PM7Ntm9qaZHTGzQ2a20czOafT4ubH+AZMkndCohOLB2ONN+gvEvvn/u9jPDXPDZtYwdoqZ3W9m\n282s1swOx0oxrmnj5fUzs2Vmtje2zjfM7P81n5SoJ0Iiq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ClaQ/dPDYdbFj9W823vBtbZP/z8XO2doWjybp\nJjPLaTR/hKTZkv7knOuqUobW1ixJcs79UdHGgNfEbh84555L5sCxmvfmGt7bgbE/n1V0V41/MrOh\nbRyuSz63WOr/aklfM7PLWln359o5xieKNr38hpmd2uzhWxW9UF/bbPy3ir7Ov4vdwrF1NPaEos0a\nF5lZfoJ1FZlZbltrS0Kbn3c3ScfrAgD0UmQiAAC6lXPu/8zsXxXdKvAlM3tc0caG/6DotouzO1Fj\n/oai39r/h5n9VtGu828453aZ2bOSrjKzY5L+R9IJim5P+Bd9dkHdXLakl83sv2Nr/I6kfEW3Xuwq\nida82TlX1WjOA4o2UnSSFqZw7B1m9oaiWzJ+pGhzwXmK9lR4TIo2nDSzaxTtc7HdzFZIel/SYEX7\nFixxzv26iz+3Hyna1PBxM6uIvQdBRZszTpP0v4pubdmWGxXt8fCKmd2naJr+NxRtnrjaOfdC48nO\nuVDsc/xHSWdJqow1hWw8Z08sU2N57L17WNIuRbdUHKfo1pinSvogydeZSDKfd5dK0+sCAPRSBBEA\nAG1JtI996gdx7hYze0/SdZIWK3oB+YakK1yjve2bnbe19TT234qm5V8h6XJFMw/+XlK5pCsVrcG/\nWNFvot9T9FvrsKQHWzn230n6rqQfSuovaaukv2slJTzRGpMZa23NVY3mPCbp3xW9WF+Z4Jit+TdF\nL8pvkFSs6I4ar0v6l1iGQ3RBzv3azP5K0UaMcyUVStqn6A4Kjeel8rm1+nfFOVcb2zHinyT9raIX\nsSFFt2F8RUnsPOGce9PMzla0Wea1ir43f1G0ROHfW3naKkWDCH1jPyc67koze1fSfEUDLv0VzWB4\nV9HtTZv3FEj130Myn3e
|
||
|
"text/plain": [
|
||
|
"<matplotlib.figure.Figure at 0x1d038672278>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"fang_df.xs('score', axis=1, level=1).plot()\n",
|
||
|
"plt.gcf().set_size_inches(18, 6)\n",
|
||
|
"plt.gcf().suptitle(\"Profitability score over time\", fontsize=18);"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"Let's think about these graphs. First, the histogram. What we like seeing is a lot of 1's - that means there were a lot of days that the stock went up and we didn't have to worry about actually implementing the strategy - we were able to close the trade at a profit.\n",
|
||
|
"\n",
|
||
|
"Looking at the profitability score over time though is a bit more interesting. First off, stocks that are more volatile will tend to have a higher profitability score, no two ways about that. However, Netflix consistently outperformed on this metric. We know that 2015 was a good year for Netflix, so that's a (small) sign the strategy is performing as expected.\n",
|
||
|
"\n",
|
||
|
"The final interesting note happens around the end of August 2015. Around this period, the markets were selling off in a big way due to issues in China (not unlike what's happening now). Even so, all of the FANG stocks saw an uptick in profitability around this time. This is another sign that the strategy being developed performs better during periods of volatility, rather than from riding markets up or down.\n",
|
||
|
"\n",
|
||
|
"What about FANG vs. some cyclicals?"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 13,
|
||
|
"metadata": {
|
||
|
"collapsed": true
|
||
|
},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"cyclic_df = simulate_tickers([\"YAHOO/X\", \"YAHOO/CAT\", \"YAHOO/NFLX\", \"YAHOO/GOOG\"])"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 14,
|
||
|
"metadata": {
|
||
|
"collapsed": false
|
||
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABBgAAAIICAYAAADE513IAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzs3XmYbFdZ9/3vL0QiY04ASYBADshgQOKReVBpIIwqoAIi\nUw6TCCiDvEICjwRUTIKIwUdQkRACEmaBgEDCkHZARqEhEob4wElCS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lP0frLC+q1Q5f5Kz4t0Vx75G+A84HeBB9J9KD6CLqal7/OvopsmMijW\n+AS6SzJe4YNzVb2AbtTAM+hqBzwB+ESSY0Zo52B4/tVXuP0aS7YbttLx2Ww/qarTq+rDVfWvVbWn\nc3ES58+y+iTQqXS1G54DPIiujsLhdMmnae33vYbu2A9GMQx+nzCZ5kiS1mpa32gkqWVPpPt295/3\ntmFVLVbVyVX15Kr6Wbrii7/Mxg7XD3DoMutvQ9fu4Qr+FwHXWWbbn11m3WoLyH0FuFWSK7yX9UUK\nb7mkHevhK8AN++KSS90a+E5VLS0AuJ6eRPc/es/QukcDX62qB1bVa6rq/VX1YbpvrK+knwbxGeAJ\nSfYHfhN4R1UtLrPtrqp6RVU9ArghXcHK54wwSuOrrPwcge5/tdJoklFtVCHH9fJN4Lt058QVJNlG\nV0Bzrc/PPcX+SLq+3f2r6m+q6j1V9SG6aSbLjV6AZY5TkoOAbWO0cak9Hq+q2g28G3hUkqvTJcg+\nXlVXGl0hSZpuJhgkaUok2SfJS4G7A/+8p6sa9Nvuv8xNC3Qf7oY/1H+P5T/kj+Mpwx+0+7b8Ht2w\n6n8Z2u7LwF2T/PTQtgf
|
||
|
"text/plain": [
|
||
|
"<matplotlib.figure.Figure at 0x1d0388267f0>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"cyclic_df.xs('days', axis=1, level=1).hist()\n",
|
||
|
"plt.gcf().set_size_inches(18, 8);\n",
|
||
|
"plt.gcf().suptitle(\"Distribution of Days Until Profitability\", fontsize=18);"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 15,
|
||
|
"metadata": {
|
||
|
"collapsed": false
|
||
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABBEAAAGECAYAAABgaLg8AAAABHNCSVQIC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f\nX5CzqsY/G2NO6WR3aXnfgqn/6yR9zhhzXZx5D0+wjw/lNL38W2PMeVF33yPnRP3ZqO2/kvM8/yF4\nawvOI9LTcpo1LjbGFMaYV7ExJr+zubnQ6fvdTXrieQEA+igyEQAA3cpa+2djzA/kLBX4ijHm53Ia\nG/6TnGUX53Shxvw1OVft/8MY8ys5Xedfs9ZWG2NekHSjMaZZ0u8lnSpnecK/6JMT6mi5kn5jjPlZ\ncI5fk1QoZ+nFdIk159ettXsjxqyQ00jRSlqUxL53G2Nek7Mk4yE5zQXny+mp8JTkNJw0xtwkp8/F\nLmPMKknvSSqR07dgqbX2v9L8vt0rp6nhz40xlcHXoFVOc8YZkv5HztKWnblVTo+H3xpjHpWTpv+3\ncponrrPWbo0cbK31B9/H/yvpIklVwaaQkWMOBjM1VgZfu7WSquUsqThOztKY50na5/J5xuLm/U6r\nHnpeAIA+iiACAKAzsdaxT34n1t5tjHlX0gJJS+ScQL4m6Us2Ym37qOPGm0+kn8lJy/+SpOvlZB78\no6QKSTfIqcG/Rs6V6HflXLVuk/R4nH3/g6SvS7pL0mBJOyX9Q5yU8FhzdLMt3pz3Rox5StIP5Zys\nr46xz3j+Tc5J+S2SBslZUWO7pH8NZjg4E7L2v4wx/0dOI8Z5kgZKOiJnBYXIccm8b3F/V6y1dcEV\nI/5Z0hflnMT65SzD+Fu5WHnCWvuGMeYSOc0yb5bz2vxFTonCD+M8bI2cIEL/4Pex9rvaGPOOpIVy\nAi6D5WQwvCNnedPongL
|
||
|
"text/plain": [
|
||
|
"<matplotlib.figure.Figure at 0x1d0387d1b00>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"cyclic_df.xs('score', axis=1, level=1).plot()\n",
|
||
|
"plt.gcf().set_size_inches(18, 6)\n",
|
||
|
"plt.gcf().suptitle(\"Profitability score over time\", fontsize=18);"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"Some more interesting results come from this as well. First off, US Steel (X) has a much smoother distribution of days until profitability - it doesn't have a huge number of values at 1 and then drop off. Intuitively, we're not terribly large fans of this, we want a stock to go up! However, on the profitability score it is the only serious contender to Netflix.\n",
|
||
|
"\n",
|
||
|
"Second, we see the same trend around August - the algorithm performs well in volatile markets.\n",
|
||
|
"\n",
|
||
|
"For a final test, let's try some biotech and ETFs!"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 21,
|
||
|
"metadata": {
|
||
|
"collapsed": false
|
||
|
},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"biotech_df = simulate_tickers(['YAHOO/REGN', 'YAHOO/CELG', 'GOOG/NASDAQ_BIB', 'GOOG/NASDAQ_IBB'])"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 22,
|
||
|
"metadata": {
|
||
|
"collapsed": false
|
||
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABBgAAAIICAYAAADE513IAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzs3Xu8HWV56PHfAymIN4JagkohoBIRtZGqUVtrUIyXnkLa\nehDRSMTDaaX11h4t6GmxFwU8WilHbUuDMbaCEm/BSw1iSFsraL1s7hA8GkAkWzEEVCoSeM4fMytZ\nrKy9ZmevvffM7PX7fj7rs/c7M2vmWc+71uxZ737fdyIzkSRJkiRJGsYedQcgSZIkSZLazwYGSZIk\nSZI0NBsYJEmSJEnS0GxgkCRJkiRJQ7OBQZIkSZIkDc0GBkmSJEmSNDQbGCSpBSJiZUTcHxG/Wecx\nI+LE2Y5joliaLiIeGREfiYhby9g31B3TKIiIjRHxvZ5lH46I++uKaTIi4lcj4ssRsbV8v/x5RBzc\n+X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o+x8U/939fNWGmbktM8/PzN/PzMdRTL74XGa2u34Ah/dZfgRF3N0z+G8FHtFn\n28f1Wba7E8h9F1gUEQ/4W1ZOUnhYTxzT4bvAY8rJJXs9CbgrM3snAJxOJ1Pk6HNdy14FfC8zX5qZ\nH8rML2bmBor/WO+iHAbxbeC1EbEv8LvApzNzW59tN2fmBzLzeOAxFBNWvnUSvTS+x8TvEShyNVFv\nksmaqYkcp8uPgJ9QfCYeICLmU0ygOdX356DXfgLFtd2LM/P9mfm5zPwyxTCTfr0XoE89RcQBwPwh\nYuw1sL4ycxz4LPDKiHgwRQPZ1zJzl94VkqRms4FBkhoiIvaIiPcAvw58ftBdDcpt9+2zaoziy133\nl/qf0v9L/jBe1/1Fu4z
|
||
|
"text/plain": [
|
||
|
"<matplotlib.figure.Figure at 0x1d03a50e198>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"biotech_df.xs('days', axis=1, level=1).hist()\n",
|
||
|
"plt.gcf().set_size_inches(18, 8);\n",
|
||
|
"plt.gcf().suptitle(\"Distribution of Days Until Profitability\", fontsize=18);"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 23,
|
||
|
"metadata": {
|
||
|
"collapsed": false
|
||
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABBEAAAGECAYAAABgaLg8AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzs3Xl81NW9//HXmWwIWQgJS5BFLXUBCrYPlwDaIgQR8EoV\nI4JyBex1K9aLoiLK9tBfqViuSrF61VoSRGVx7S1LDUqpEFBcUFwoAgGUiIYlAQJJZub8/pjJOJnM\nJJOZhCy8n4/H90FyvmfOOd/vjMj3M+d8jrHWIiIiIiIiIiJSG0djD0BEREREREREmg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y7z0ox5OccTiwGc/WljW5C0+O\nh/eMMU/hmab/H3iSJy621q71r2ytdXrfx0nABUCeNymkf51vvTM1nvPeu0XAbjxbKvbBszVmT2BP\nmNcZTDjvd706SdclIiKnKAURRESkJsH2sa97I9ZONcZsB+4A5uB5gNwIXG/99rYP6DfUePy9jGda\n/vXAtXhmHkwAcoEb8KzBvxLPN9Hb8Xxr7QJeCNH2fwK3AfcDbYEtwH+GmBIebIzhlIUac4FfnVeA\n/8HzsL4wSJuh/BHPQ/mdQAqeHTXygT94Zzh4BmTt34wxl+BJxDgRSAL249lBwb9eXd63kJ8Va22J\nd8eIe4Dr8DzEOvFsw/geYew8Ya390BjTH0+yzNvx3JudeJYo/E+Il+XgCSK09v4crN2FxphtwBQ8\nAZe2eGYwbMOzvWlgToG6/vcQzvsdrpr+e6xSHsF1iYiIhMWcnATDIiIiEi7vVPNCPN9YD6+tvoiI\niMjJopwIIiIiTc+NeL4
|
||
|
"text/plain": [
|
||
|
"<matplotlib.figure.Figure at 0x1d0384f2cf8>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"biotech_df.xs('score', axis=1, level=1).plot()\n",
|
||
|
"plt.gcf().set_size_inches(18, 6)\n",
|
||
|
"plt.gcf().suptitle(\"Profitability score over time\", fontsize=18);"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"In this example, we don't see a whole lot of interesting things: the scores are all fairly close together with notable exceptions in late August, and mid-October.\n",
|
||
|
"\n",
|
||
|
"What is interesting is that during the volatile period, the ETF's performed significantly better than the stocks did in terms of profitability. The leveraged ETF (BIB) performed far above anyone else, and it appears that indeed, it is most profitable during volatile periods. Even so, it was far more likely to take multiple days to give a return. Its count of 1-day investments trails the other ETF and both stocks by a decent margin.\n",
|
||
|
"\n",
|
||
|
"And consider me an OCD freak, but I just really like Celgene's distribution - it looks nice and smooth."
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Summary and plans for the next post\n",
|
||
|
"\n",
|
||
|
"So far I'm really enjoying playing with this strategy - there's a lot of depth here to understand, though the preliminary results seem to indicate that it profits mostly from taking the other side of a volatile trade. I'd be interested to run results later on data from January - It's been a particularly volatile start to the year so it would be neat to see whether this strategy would work then.\n",
|
||
|
"\n",
|
||
|
"For the next post, I want to start playing with some of the parameters: How do the bias and expected close influence the process? The values have been fairly conservative so far, it will be interesting to see how the simulations respond afterward."
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"kernelspec": {
|
||
|
"display_name": "Python 3",
|
||
|
"language": "python",
|
||
|
"name": "python3"
|
||
|
},
|
||
|
"language_info": {
|
||
|
"codemirror_mode": {
|
||
|
"name": "ipython",
|
||
|
"version": 3
|
||
|
},
|
||
|
"file_extension": ".py",
|
||
|
"mimetype": "text/x-python",
|
||
|
"name": "python",
|
||
|
"nbconvert_exporter": "python",
|
||
|
"pygments_lexer": "ipython3",
|
||
|
"version": "3.5.1"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 0
|
||
|
}
|