Skip to content

Instantly share code, notes, and snippets.

@aarongilman
Last active October 27, 2020 01:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aarongilman/9574262d95c4d36f515f178c0901b712 to your computer and use it in GitHub Desktop.
Save aarongilman/9574262d95c4d36f515f178c0901b712 to your computer and use it in GitHub Desktop.
Exploration of predictit.org odds and recent market performance
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"from IPython.display import HTML "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Checking in on the data as we head into the election"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"I thought it may be interesting to take the betting odds from predictit.org for Biden and Trump and treat them like they were an investment alongside the US Sectors and Industries for clues as to what the market is saying in respect to what will do poorly or well under each potential outcome."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"data sources: predictit.org for odds on election outcome and tiingo for security price data"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Part 1: Data Gathering"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"jupyter": {
"source_hidden": true
},
"slideshow": {
"slide_type": "skip"
},
"tags": [
"hide_input"
]
},
"outputs": [],
"source": [
"import pandas as pd\n",
"from pandas_datareader import data as web\n",
"from dateutil.relativedelta import relativedelta\n",
"from datetime import datetime\n",
"import seaborn as sns\n",
"%matplotlib inline"
]
},
{
"cell_type": "code",
"execution_count": 67,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"import os\n",
"os.environ['TIINGO_API_KEY'] = \"put your api key here\""
]
},
{
"cell_type": "code",
"execution_count": 68,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"sectors = [\"XLY\",\"XLP\",\"XLE\",\"XLF\",\"XLV\",\"XLI\",\"XLB\",\"XLRE\",\"XLK\",\"XLC\",\"XLU\",\"SPY\"]"
]
},
{
"cell_type": "code",
"execution_count": 69,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"industries = [\"MOO\",\"IBB\",\"PBW\",\"GDX\",\"ITB\",\"KIE\",\"FDN\",\"AMLP\",\"XME\",\"XOP\",\"OIH\",\"VNQ\",\"KRE\",\"XRT\",\"SMH\",\"IGV\",\"PHO\"]"
]
},
{
"cell_type": "code",
"execution_count": 117,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"names_key = {\"MOO\": \"agriculture\",\"IBB\": \"biotech\",\"PBW\": \"clean_energy\",\"GDX\": \"gold_miners\",\n",
" \"ITB\": \"homebuilders\",\"KIE\": \"insurance\",\"FDN\": \"internet\",\"AMLP\": \"mlp\",\"XME\": \"metals_mining\",\n",
" \"XOP\": \"oil_and_gas_ep\",\"OIH\": \"oil_services\",\"VNQ\": \"reits\",\"KRE\": \"regional_banks\",\"XRT\": \"retail\",\n",
" \"SMH\": \"semi_conductors\",\"IGV\":\"software\",\"PHO\": \"water_resources\",\n",
" \"XLY\": \"consumer_discretionary\",\"XLP\": \"consumer_staples\",\"XLE\": \"energy\",\"XLF\": \"financials\",\n",
" \"XLV\": \"health_care\",\"XLI\": \"industrials\",\"XLB\": \"materials\",\"XLRE\": \"real_estate\",\n",
" \"XLK\": \"technology\",\"XLC\": \"communications\",\"XLU\": \"utilities\", \"SPY\": \"sp500\", \"Biden\": \"biden_odds\", \"Trump\": \"trump_odds\"\n",
" }"
]
},
{
"cell_type": "code",
"execution_count": 71,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"tickers = sectors + industries"
]
},
{
"cell_type": "code",
"execution_count": 72,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"adjusted_close = pd.DataFrame(columns=tickers)\n",
"null_tickers = []\n",
"\n",
"for ticker in tickers:\n",
" try:\n",
" data_panel = web.DataReader([ticker], \"tiingo\").loc[ticker]['adjClose'].to_frame()\n",
" data_panel.columns = [ticker]\n",
" data_panel.index = pd.to_datetime(data_panel.index)\n",
" if data_panel.index.max().tz_localize(None) < datetime.today() - relativedelta(days=5):\n",
" print(\"{} most recent date is {}\".format(ticker, str(data_panel.index.max())))\n",
" else:\n",
" adjusted_close[ticker] = data_panel[ticker]\n",
" except:\n",
" null_tickers.append(ticker)\n",
" print(\"{} not found\".format(ticker))"
]
},
{
"cell_type": "code",
"execution_count": 73,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"adjusted_close.index = adjusted_close.index.tz_localize(None)"
]
},
{
"cell_type": "code",
"execution_count": 74,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"election_data = pd.read_csv('election_data.csv')"
]
},
{
"cell_type": "code",
"execution_count": 75,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"election_data = election_data.set_index(['date', 'name'])"
]
},
{
"cell_type": "code",
"execution_count": 76,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"election_data = election_data.unstack(level=-1)"
]
},
{
"cell_type": "code",
"execution_count": 77,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"election_data = election_data.close_price.rename_axis([None], axis=1).reset_index()\n",
"election_data = election_data.set_index('date')"
]
},
{
"cell_type": "code",
"execution_count": 78,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"election_data.index = pd.to_datetime(election_data.index)"
]
},
{
"cell_type": "code",
"execution_count": 79,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"election_data = election_data.sort_index(ascending=True)"
]
},
{
"cell_type": "code",
"execution_count": 80,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"all_data = pd.merge(election_data, adjusted_close, left_index=True, right_index=True)"
]
},
{
"cell_type": "code",
"execution_count": 81,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"daily_changes = all_data.pct_change()"
]
},
{
"cell_type": "code",
"execution_count": 82,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"thirty_day_corr = daily_changes.iloc[-21:].corr()"
]
},
{
"cell_type": "code",
"execution_count": 83,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"sixty_day_corr = daily_changes.iloc[-42:].corr()"
]
},
{
"cell_type": "code",
"execution_count": 84,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"two_week_corr = daily_changes.iloc[-10:].corr()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Part 2: Analysis and Exploring the Data for Clues"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"I might lose some people here, but what I am trying to do is examine how the daily changes in the betting odds for Trump and Biden have correlated with the daily changes in US Sectors and Industries. \n",
"This is the same analysis you would do to see how correlated a basket of securities may be with one another, or the holdings in your portfolio. We are taking the daily prices, and getting the percentage changes between each day to see how they move with or against eachother. "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"First, we will look at the last 21 days (roughly 30 calendar days) to see how the sectors and industries have moved with the changes in the betting odds of each candidate. "
]
},
{
"cell_type": "code",
"execution_count": 85,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"thirty_day_corr = thirty_day_corr[['Biden', 'Trump']]"
]
},
{
"cell_type": "code",
"execution_count": 86,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"thirty_day_corr = thirty_day_corr.drop(['Trump', 'Biden'], axis=0)"
]
},
{
"cell_type": "code",
"execution_count": 87,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"thirty_day_corr['name'] = thirty_day_corr.index.to_series().map(names_key)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Inverse correlation with Biden probability of win (top 5)"
]
},
{
"cell_type": "code",
"execution_count": 89,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Biden</th>\n",
" <th>Trump</th>\n",
" <th>name</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>AMLP</th>\n",
" <td>-0.358687</td>\n",
" <td>0.222781</td>\n",
" <td>mlp</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XOP</th>\n",
" <td>-0.354613</td>\n",
" <td>0.257035</td>\n",
" <td>oil_and_gas_ep</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLE</th>\n",
" <td>-0.337303</td>\n",
" <td>0.288056</td>\n",
" <td>energy</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLI</th>\n",
" <td>-0.329300</td>\n",
" <td>0.308651</td>\n",
" <td>industrials</td>\n",
" </tr>\n",
" <tr>\n",
" <th>OIH</th>\n",
" <td>-0.293264</td>\n",
" <td>0.184944</td>\n",
" <td>oil_services</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Biden Trump name\n",
"AMLP -0.358687 0.222781 mlp\n",
"XOP -0.354613 0.257035 oil_and_gas_ep\n",
"XLE -0.337303 0.288056 energy\n",
"XLI -0.329300 0.308651 industrials\n",
"OIH -0.293264 0.184944 oil_services"
]
},
"execution_count": 89,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"thirty_day_corr.sort_values(by='Biden').head(5)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Nothing surprising with the results here, as they are relatively intuitive and in line with what you would think. 4 out of 5 sectors/industries that have had the lowest correlation with Biden's odds happen to be related to oil and energy production/consumption."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Positive correlation with Biden probability of win (bottom 5)"
]
},
{
"cell_type": "code",
"execution_count": 90,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Biden</th>\n",
" <th>Trump</th>\n",
" <th>name</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>SMH</th>\n",
" <td>0.191788</td>\n",
" <td>0.315877</td>\n",
" <td>semi_conductors</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XRT</th>\n",
" <td>0.199777</td>\n",
" <td>0.039550</td>\n",
" <td>retail</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLP</th>\n",
" <td>0.201265</td>\n",
" <td>0.293470</td>\n",
" <td>consumer_staples</td>\n",
" </tr>\n",
" <tr>\n",
" <th>IGV</th>\n",
" <td>0.208014</td>\n",
" <td>0.240449</td>\n",
" <td>software</td>\n",
" </tr>\n",
" <tr>\n",
" <th>ITB</th>\n",
" <td>0.244726</td>\n",
" <td>-0.201353</td>\n",
" <td>homebuilders</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Biden Trump name\n",
"SMH 0.191788 0.315877 semi_conductors\n",
"XRT 0.199777 0.039550 retail\n",
"XLP 0.201265 0.293470 consumer_staples\n",
"IGV 0.208014 0.240449 software\n",
"ITB 0.244726 -0.201353 homebuilders"
]
},
"execution_count": 90,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"thirty_day_corr.sort_values(by='Biden').tail(5)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The most correlated sectors (meaning when Biden's odds go up, these sectors tend to go up in price and vice-a-versa) are Homebuilders, Software, Consumer Staples, Retail and Semi-Conductors. Kind of random overall and certainly not as intuitive as the negative correlation group."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Inverse correlation with Trump probability of win (top 5)"
]
},
{
"cell_type": "code",
"execution_count": 91,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Biden</th>\n",
" <th>Trump</th>\n",
" <th>name</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>ITB</th>\n",
" <td>0.244726</td>\n",
" <td>-0.201353</td>\n",
" <td>homebuilders</td>\n",
" </tr>\n",
" <tr>\n",
" <th>VNQ</th>\n",
" <td>0.098780</td>\n",
" <td>-0.145101</td>\n",
" <td>reits</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLRE</th>\n",
" <td>0.072001</td>\n",
" <td>-0.105775</td>\n",
" <td>real_estate</td>\n",
" </tr>\n",
" <tr>\n",
" <th>PBW</th>\n",
" <td>0.121667</td>\n",
" <td>-0.069509</td>\n",
" <td>clean_energy</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLU</th>\n",
" <td>-0.105744</td>\n",
" <td>0.012653</td>\n",
" <td>utilities</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Biden Trump name\n",
"ITB 0.244726 -0.201353 homebuilders\n",
"VNQ 0.098780 -0.145101 reits\n",
"XLRE 0.072001 -0.105775 real_estate\n",
"PBW 0.121667 -0.069509 clean_energy\n",
"XLU -0.105744 0.012653 utilities"
]
},
"execution_count": 91,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"thirty_day_corr.sort_values(by='Trump').head(5)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The lowest correlation with Trump's odds of winning make sense for the most part. REITs and Real Estate generally will be unaffected by changes in tax code due to the way they are structured, and Clean Energy and Utilities are favored under a Biden win (relatively speaking). "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Positive correlation with Trump probability of win (top 5)"
]
},
{
"cell_type": "code",
"execution_count": 92,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Biden</th>\n",
" <th>Trump</th>\n",
" <th>name</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>XLV</th>\n",
" <td>-0.107735</td>\n",
" <td>0.423726</td>\n",
" <td>health_care</td>\n",
" </tr>\n",
" <tr>\n",
" <th>SPY</th>\n",
" <td>-0.032973</td>\n",
" <td>0.428318</td>\n",
" <td>sp500</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLK</th>\n",
" <td>0.043714</td>\n",
" <td>0.465146</td>\n",
" <td>technology</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLC</th>\n",
" <td>-0.072248</td>\n",
" <td>0.512056</td>\n",
" <td>communications</td>\n",
" </tr>\n",
" <tr>\n",
" <th>MOO</th>\n",
" <td>-0.230897</td>\n",
" <td>0.590906</td>\n",
" <td>agriculture</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Biden Trump name\n",
"XLV -0.107735 0.423726 health_care\n",
"SPY -0.032973 0.428318 sp500\n",
"XLK 0.043714 0.465146 technology\n",
"XLC -0.072248 0.512056 communications\n",
"MOO -0.230897 0.590906 agriculture"
]
},
"execution_count": 92,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"thirty_day_corr.sort_values(by='Trump').tail(5)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The highest correlation with a Trumps election odds are Healthcare, the S&P 500, Technology, Communications and Agriculture. The fact that healthcare has such a positive correlation to Trump's odds, but is not in the top five for negative correlation with Biden odds may show that healthcare is already priced for a Biden win at this point and may offer some relative value should Trump end up winning."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now what about the last two months? This may help weed out some randomness from the last month (or not)."
]
},
{
"cell_type": "code",
"execution_count": 93,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"sixty_day_corr = sixty_day_corr[['Biden', 'Trump']]"
]
},
{
"cell_type": "code",
"execution_count": 94,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"sixty_day_corr = sixty_day_corr.drop(['Trump', 'Biden'], axis=0)"
]
},
{
"cell_type": "code",
"execution_count": 95,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"sixty_day_corr['name'] = sixty_day_corr.index.to_series().map(names_key)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Inverse correlation with Biden probability of win (top 5)"
]
},
{
"cell_type": "code",
"execution_count": 97,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Biden</th>\n",
" <th>Trump</th>\n",
" <th>name</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>XOP</th>\n",
" <td>-0.184910</td>\n",
" <td>0.146874</td>\n",
" <td>oil_and_gas_ep</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLE</th>\n",
" <td>-0.154462</td>\n",
" <td>0.138974</td>\n",
" <td>energy</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLB</th>\n",
" <td>-0.151697</td>\n",
" <td>0.112168</td>\n",
" <td>materials</td>\n",
" </tr>\n",
" <tr>\n",
" <th>MOO</th>\n",
" <td>-0.141861</td>\n",
" <td>0.208704</td>\n",
" <td>agriculture</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLI</th>\n",
" <td>-0.131766</td>\n",
" <td>0.056440</td>\n",
" <td>industrials</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Biden Trump name\n",
"XOP -0.184910 0.146874 oil_and_gas_ep\n",
"XLE -0.154462 0.138974 energy\n",
"XLB -0.151697 0.112168 materials\n",
"MOO -0.141861 0.208704 agriculture\n",
"XLI -0.131766 0.056440 industrials"
]
},
"execution_count": 97,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sixty_day_corr.sort_values(by='Biden').head(5)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The two lowest correlated sectors/industry are again energy related which is no surprise. "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Positive correlation with Biden probability of win (bottom 5)"
]
},
{
"cell_type": "code",
"execution_count": 98,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Biden</th>\n",
" <th>Trump</th>\n",
" <th>name</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>IBB</th>\n",
" <td>0.099513</td>\n",
" <td>0.073609</td>\n",
" <td>biotech</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLRE</th>\n",
" <td>0.102936</td>\n",
" <td>-0.156825</td>\n",
" <td>real_estate</td>\n",
" </tr>\n",
" <tr>\n",
" <th>VNQ</th>\n",
" <td>0.105734</td>\n",
" <td>-0.166976</td>\n",
" <td>reits</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLP</th>\n",
" <td>0.163886</td>\n",
" <td>0.034102</td>\n",
" <td>consumer_staples</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLU</th>\n",
" <td>0.186581</td>\n",
" <td>-0.199489</td>\n",
" <td>utilities</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Biden Trump name\n",
"IBB 0.099513 0.073609 biotech\n",
"XLRE 0.102936 -0.156825 real_estate\n",
"VNQ 0.105734 -0.166976 reits\n",
"XLP 0.163886 0.034102 consumer_staples\n",
"XLU 0.186581 -0.199489 utilities"
]
},
"execution_count": 98,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sixty_day_corr.sort_values(by='Biden').tail(5)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Biotech, REITs, Utilities, Consumer Staples make up the top 5, but Biotech is very close to 0. Outside of Utilities and Consumer Staples these look more random/uncorrelated than anything else. Not much here."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Inverse correlation with Trump probability of win (top 5)"
]
},
{
"cell_type": "code",
"execution_count": 99,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Biden</th>\n",
" <th>Trump</th>\n",
" <th>name</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>XLU</th>\n",
" <td>0.186581</td>\n",
" <td>-0.199489</td>\n",
" <td>utilities</td>\n",
" </tr>\n",
" <tr>\n",
" <th>VNQ</th>\n",
" <td>0.105734</td>\n",
" <td>-0.166976</td>\n",
" <td>reits</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLRE</th>\n",
" <td>0.102936</td>\n",
" <td>-0.156825</td>\n",
" <td>real_estate</td>\n",
" </tr>\n",
" <tr>\n",
" <th>ITB</th>\n",
" <td>0.087515</td>\n",
" <td>-0.106483</td>\n",
" <td>homebuilders</td>\n",
" </tr>\n",
" <tr>\n",
" <th>PBW</th>\n",
" <td>0.008528</td>\n",
" <td>-0.017871</td>\n",
" <td>clean_energy</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Biden Trump name\n",
"XLU 0.186581 -0.199489 utilities\n",
"VNQ 0.105734 -0.166976 reits\n",
"XLRE 0.102936 -0.156825 real_estate\n",
"ITB 0.087515 -0.106483 homebuilders\n",
"PBW 0.008528 -0.017871 clean_energy"
]
},
"execution_count": 99,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sixty_day_corr.sort_values(by='Trump').head(5)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Utilities appear to be a fairly correlated with both Biden (positive) and Trump (negative), so the market is clearly tit for tat when it comes to predicted impact of either candidate. Same appears to be true fro REITs and Real Estate. This may be where the money has been going as a hedge against a Trump loss and also impacts from higher corporate taxes."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Positive correlation with Trump probability of win (top 5)"
]
},
{
"cell_type": "code",
"execution_count": 100,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Biden</th>\n",
" <th>Trump</th>\n",
" <th>name</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>FDN</th>\n",
" <td>-0.087476</td>\n",
" <td>0.176426</td>\n",
" <td>internet</td>\n",
" </tr>\n",
" <tr>\n",
" <th>IGV</th>\n",
" <td>-0.115033</td>\n",
" <td>0.192522</td>\n",
" <td>software</td>\n",
" </tr>\n",
" <tr>\n",
" <th>MOO</th>\n",
" <td>-0.141861</td>\n",
" <td>0.208704</td>\n",
" <td>agriculture</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLC</th>\n",
" <td>-0.097236</td>\n",
" <td>0.215920</td>\n",
" <td>communications</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLK</th>\n",
" <td>-0.050322</td>\n",
" <td>0.253730</td>\n",
" <td>technology</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Biden Trump name\n",
"FDN -0.087476 0.176426 internet\n",
"IGV -0.115033 0.192522 software\n",
"MOO -0.141861 0.208704 agriculture\n",
"XLC -0.097236 0.215920 communications\n",
"XLK -0.050322 0.253730 technology"
]
},
"execution_count": 100,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sixty_day_corr.sort_values(by='Trump').tail(5)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Finally, the most correlated sectors with Trump's betting odds mostly involve technology. I am wondering if the market is pricing in the potential for unfavorable treatment towards the technology giants or a potential break up of the megacap tech companies?"
]
},
{
"cell_type": "code",
"execution_count": 111,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"last_month_performance = (all_data.loc['2020-10-23']-all_data.loc['2020-09-25'])/all_data.loc['2020-09-25']"
]
},
{
"cell_type": "code",
"execution_count": 114,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"last_month_performance = last_month_performance.sort_values().to_frame()"
]
},
{
"cell_type": "code",
"execution_count": 118,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"last_month_performance['name'] = last_month_performance.index.to_series().map(names_key)"
]
},
{
"cell_type": "code",
"execution_count": 120,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"last_month_performance.columns = ['last_30_day_performance', 'name']"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"I thought it would be interesting to look at the performance across the US Sectors and Industries from September 25 to today. This was the date that the odds really took off for a Biden win. It looks as though his odds jumped around 12.3% while Trump's declined around 10.87%. What has moved the most/least from that point to today?"
]
},
{
"cell_type": "code",
"execution_count": 121,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>last_30_day_performance</th>\n",
" <th>name</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Trump</th>\n",
" <td>-0.108696</td>\n",
" <td>trump_odds</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLE</th>\n",
" <td>0.006958</td>\n",
" <td>energy</td>\n",
" </tr>\n",
" <tr>\n",
" <th>GDX</th>\n",
" <td>0.010411</td>\n",
" <td>gold_miners</td>\n",
" </tr>\n",
" <tr>\n",
" <th>IBB</th>\n",
" <td>0.022627</td>\n",
" <td>biotech</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLRE</th>\n",
" <td>0.027690</td>\n",
" <td>real_estate</td>\n",
" </tr>\n",
" <tr>\n",
" <th>VNQ</th>\n",
" <td>0.034234</td>\n",
" <td>reits</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLP</th>\n",
" <td>0.037278</td>\n",
" <td>consumer_staples</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLK</th>\n",
" <td>0.039494</td>\n",
" <td>technology</td>\n",
" </tr>\n",
" <tr>\n",
" <th>MOO</th>\n",
" <td>0.040534</td>\n",
" <td>agriculture</td>\n",
" </tr>\n",
" <tr>\n",
" <th>ITB</th>\n",
" <td>0.043550</td>\n",
" <td>homebuilders</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLV</th>\n",
" <td>0.046593</td>\n",
" <td>health_care</td>\n",
" </tr>\n",
" <tr>\n",
" <th>OIH</th>\n",
" <td>0.048680</td>\n",
" <td>oil_services</td>\n",
" </tr>\n",
" <tr>\n",
" <th>SPY</th>\n",
" <td>0.051866</td>\n",
" <td>sp500</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLB</th>\n",
" <td>0.056676</td>\n",
" <td>materials</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XOP</th>\n",
" <td>0.059684</td>\n",
" <td>oil_and_gas_ep</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLI</th>\n",
" <td>0.061184</td>\n",
" <td>industrials</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLC</th>\n",
" <td>0.061347</td>\n",
" <td>communications</td>\n",
" </tr>\n",
" <tr>\n",
" <th>IGV</th>\n",
" <td>0.062914</td>\n",
" <td>software</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLY</th>\n",
" <td>0.063021</td>\n",
" <td>consumer_discretionary</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLF</th>\n",
" <td>0.074926</td>\n",
" <td>financials</td>\n",
" </tr>\n",
" <tr>\n",
" <th>FDN</th>\n",
" <td>0.077500</td>\n",
" <td>internet</td>\n",
" </tr>\n",
" <tr>\n",
" <th>SMH</th>\n",
" <td>0.087213</td>\n",
" <td>semi_conductors</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLU</th>\n",
" <td>0.102691</td>\n",
" <td>utilities</td>\n",
" </tr>\n",
" <tr>\n",
" <th>PHO</th>\n",
" <td>0.110796</td>\n",
" <td>water_resources</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XME</th>\n",
" <td>0.111594</td>\n",
" <td>metals_mining</td>\n",
" </tr>\n",
" <tr>\n",
" <th>KIE</th>\n",
" <td>0.111804</td>\n",
" <td>insurance</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XRT</th>\n",
" <td>0.113748</td>\n",
" <td>retail</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Biden</th>\n",
" <td>0.122807</td>\n",
" <td>biden_odds</td>\n",
" </tr>\n",
" <tr>\n",
" <th>AMLP</th>\n",
" <td>0.158487</td>\n",
" <td>mlp</td>\n",
" </tr>\n",
" <tr>\n",
" <th>PBW</th>\n",
" <td>0.199079</td>\n",
" <td>clean_energy</td>\n",
" </tr>\n",
" <tr>\n",
" <th>KRE</th>\n",
" <td>0.232706</td>\n",
" <td>regional_banks</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" last_30_day_performance name\n",
"Trump -0.108696 trump_odds\n",
"XLE 0.006958 energy\n",
"GDX 0.010411 gold_miners\n",
"IBB 0.022627 biotech\n",
"XLRE 0.027690 real_estate\n",
"VNQ 0.034234 reits\n",
"XLP 0.037278 consumer_staples\n",
"XLK 0.039494 technology\n",
"MOO 0.040534 agriculture\n",
"ITB 0.043550 homebuilders\n",
"XLV 0.046593 health_care\n",
"OIH 0.048680 oil_services\n",
"SPY 0.051866 sp500\n",
"XLB 0.056676 materials\n",
"XOP 0.059684 oil_and_gas_ep\n",
"XLI 0.061184 industrials\n",
"XLC 0.061347 communications\n",
"IGV 0.062914 software\n",
"XLY 0.063021 consumer_discretionary\n",
"XLF 0.074926 financials\n",
"FDN 0.077500 internet\n",
"SMH 0.087213 semi_conductors\n",
"XLU 0.102691 utilities\n",
"PHO 0.110796 water_resources\n",
"XME 0.111594 metals_mining\n",
"KIE 0.111804 insurance\n",
"XRT 0.113748 retail\n",
"Biden 0.122807 biden_odds\n",
"AMLP 0.158487 mlp\n",
"PBW 0.199079 clean_energy\n",
"KRE 0.232706 regional_banks"
]
},
"execution_count": 121,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"last_month_performance"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"What is interesting is that every single sector and industry is positive performance wise from that day to today. Regional banks are up over 23%, followed by 19.9% from Clean Energy and around 15.85% for MLPs. This performance is very odd and sends a fairly mixed message overall."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"By now, almost everyone who follows the market has heard about the statistic that the market's performance 3-months leading up to the election is a fairly accurate predictor as to who wins. Positive performance typically indicates the incumbent party (Trump) wins while negative performance indicates the challenger wins (Biden). Let's see what that signal is telling us as of Friday's close?"
]
},
{
"cell_type": "code",
"execution_count": 122,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"three_month_rule_performance = (all_data.loc['2020-10-23']-all_data.loc['2020-08-05'])/all_data.loc['2020-08-05']"
]
},
{
"cell_type": "code",
"execution_count": 123,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"three_month_rule_performance = three_month_rule_performance.sort_values().to_frame()"
]
},
{
"cell_type": "code",
"execution_count": 124,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"three_month_rule_performance['name'] = three_month_rule_performance.index.to_series().map(names_key)"
]
},
{
"cell_type": "code",
"execution_count": 125,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": [
"three_month_rule_performance.columns = ['three_months_to_election_performance', 'name']"
]
},
{
"cell_type": "code",
"execution_count": 126,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>three_months_to_election_performance</th>\n",
" <th>name</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>OIH</th>\n",
" <td>-0.255269</td>\n",
" <td>oil_services</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLE</th>\n",
" <td>-0.174280</td>\n",
" <td>energy</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XOP</th>\n",
" <td>-0.161826</td>\n",
" <td>oil_and_gas_ep</td>\n",
" </tr>\n",
" <tr>\n",
" <th>GDX</th>\n",
" <td>-0.128228</td>\n",
" <td>gold_miners</td>\n",
" </tr>\n",
" <tr>\n",
" <th>AMLP</th>\n",
" <td>-0.066770</td>\n",
" <td>mlp</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Trump</th>\n",
" <td>-0.023810</td>\n",
" <td>trump_odds</td>\n",
" </tr>\n",
" <tr>\n",
" <th>IBB</th>\n",
" <td>-0.005279</td>\n",
" <td>biotech</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLRE</th>\n",
" <td>-0.002495</td>\n",
" <td>real_estate</td>\n",
" </tr>\n",
" <tr>\n",
" <th>VNQ</th>\n",
" <td>-0.001599</td>\n",
" <td>reits</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLV</th>\n",
" <td>0.015165</td>\n",
" <td>health_care</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLP</th>\n",
" <td>0.041184</td>\n",
" <td>consumer_staples</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLK</th>\n",
" <td>0.042506</td>\n",
" <td>technology</td>\n",
" </tr>\n",
" <tr>\n",
" <th>KIE</th>\n",
" <td>0.042985</td>\n",
" <td>insurance</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLF</th>\n",
" <td>0.043680</td>\n",
" <td>financials</td>\n",
" </tr>\n",
" <tr>\n",
" <th>SPY</th>\n",
" <td>0.045378</td>\n",
" <td>sp500</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XME</th>\n",
" <td>0.047299</td>\n",
" <td>metals_mining</td>\n",
" </tr>\n",
" <tr>\n",
" <th>MOO</th>\n",
" <td>0.049674</td>\n",
" <td>agriculture</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLC</th>\n",
" <td>0.064709</td>\n",
" <td>communications</td>\n",
" </tr>\n",
" <tr>\n",
" <th>SMH</th>\n",
" <td>0.071075</td>\n",
" <td>semi_conductors</td>\n",
" </tr>\n",
" <tr>\n",
" <th>FDN</th>\n",
" <td>0.072813</td>\n",
" <td>internet</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLB</th>\n",
" <td>0.073853</td>\n",
" <td>materials</td>\n",
" </tr>\n",
" <tr>\n",
" <th>ITB</th>\n",
" <td>0.076528</td>\n",
" <td>homebuilders</td>\n",
" </tr>\n",
" <tr>\n",
" <th>IGV</th>\n",
" <td>0.084100</td>\n",
" <td>software</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Biden</th>\n",
" <td>0.084746</td>\n",
" <td>biden_odds</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XRT</th>\n",
" <td>0.087332</td>\n",
" <td>retail</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLU</th>\n",
" <td>0.087592</td>\n",
" <td>utilities</td>\n",
" </tr>\n",
" <tr>\n",
" <th>PHO</th>\n",
" <td>0.093256</td>\n",
" <td>water_resources</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLY</th>\n",
" <td>0.099150</td>\n",
" <td>consumer_discretionary</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XLI</th>\n",
" <td>0.107441</td>\n",
" <td>industrials</td>\n",
" </tr>\n",
" <tr>\n",
" <th>KRE</th>\n",
" <td>0.126144</td>\n",
" <td>regional_banks</td>\n",
" </tr>\n",
" <tr>\n",
" <th>PBW</th>\n",
" <td>0.311538</td>\n",
" <td>clean_energy</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" three_months_to_election_performance name\n",
"OIH -0.255269 oil_services\n",
"XLE -0.174280 energy\n",
"XOP -0.161826 oil_and_gas_ep\n",
"GDX -0.128228 gold_miners\n",
"AMLP -0.066770 mlp\n",
"Trump -0.023810 trump_odds\n",
"IBB -0.005279 biotech\n",
"XLRE -0.002495 real_estate\n",
"VNQ -0.001599 reits\n",
"XLV 0.015165 health_care\n",
"XLP 0.041184 consumer_staples\n",
"XLK 0.042506 technology\n",
"KIE 0.042985 insurance\n",
"XLF 0.043680 financials\n",
"SPY 0.045378 sp500\n",
"XME 0.047299 metals_mining\n",
"MOO 0.049674 agriculture\n",
"XLC 0.064709 communications\n",
"SMH 0.071075 semi_conductors\n",
"FDN 0.072813 internet\n",
"XLB 0.073853 materials\n",
"ITB 0.076528 homebuilders\n",
"IGV 0.084100 software\n",
"Biden 0.084746 biden_odds\n",
"XRT 0.087332 retail\n",
"XLU 0.087592 utilities\n",
"PHO 0.093256 water_resources\n",
"XLY 0.099150 consumer_discretionary\n",
"XLI 0.107441 industrials\n",
"KRE 0.126144 regional_banks\n",
"PBW 0.311538 clean_energy"
]
},
"execution_count": 126,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"three_month_rule_performance"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"As of Friday 10/23/2020 the S&P 500 was a little over 4.5% positive from the beginning of 3 months to the election (8/5/2020). However, as I am writing this, the S&P 500 is down a little over 2%, which is about halfway to 0% performance. If you believe the betting odds and think Biden is going to win, and also believe in the 3-month rule, then you should expected a greater than 2.5% loss for the S&P 500 over the next week and a half!\n",
"\n",
"If you believe the odds are worthless, but still believe in the 3-month rule, depending on who you believe will win, the market could be flat (Trump win), go down (Biden win), or go up a lot (Everyone wins)!"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [],
"source": []
}
],
"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.6.8"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment