Design a site like this with WordPress.com
Get started

How to download S&P 500 data from Yahoo Finance using Python

Make sure you have the yfinance package installed first. If you don’t, you can run the following command in your Jupyter notebook:

!pip install yfinance

Input:

import pandas as pd
import numpy as np
import yfinance as yf

Input:

spy_ohlc_df = yf.download('SPY', start='1993-02-01', end='2019-12-01')

Output:

[*********************100%***********************]  1 of 1 downloaded

Input:

spy_ohlc_df.head()

Output:

spy 12-1-19

Conclusion

This is a very brief summary of how you can download stock data information for the S&P 500 from Yahoo Finance, using the Python programming language. If there is something you want to learn about, please let me know in the comments below and I can cover it in a future blog post.

Advertisement

Did the Federal Reserve Kill the Volatility Trade?

On October 11, 2019, the Federal Reserve announced they would begin buying Treasury Bills in an effort to ensure there are “ample reserves” in the banking system through the end of the year.

fed treasury oct 11

On October 11, 2019, the Volatility Index (VIX) sat at 17.4. Today on November 26, 2019 the VIX has recently closed at 11.5. As you can see from below, it appears as though this not-QE program that is “organically” growing the Federal Reserve’s balance sheet has effectively killed the long VIX trade.

fed vix chart

The case made that supports this idea is that investors are engaging in more risk on behavior, because they are basing their decisions based on the Federal Reserve’s prior balance sheet expansion programs (QE 1-3).

Because the Fed is purchasing T-bills, they have eased some of the money market pressures. Liquidity in the market has proven to be a positive catalyst to the market.

Why do I believe this?

It can’t be the trade deal.

That’s the only other source that has been moving the markets higher according to many daily stock market new reporters. And I don’t believe these markets are pushing higher on hopes of a trade deal.

I think the Fed’s easy money policies have once again eased tensions. For now.

A lesson to me

This whole scenario has taught me a valuable lesson about position sizing. I’ve learned to not be so overconfident in my predictions.

Every trade made is a small bet. Each bet will abide by the Kelly criterion.

Never go all in.

Grow your money slowly and strategically.

Live to trade another day.

Read

Barton_options on Twitter has been a great resource for me to learn more about the Federal Reserve operations and how it relates to the Treasury and the overall economy.

He recently wrote about this in a newsletter you can read here.