Skip to content

Instantly share code, notes, and snippets.

@zoq

zoq/data.py Secret

Created May 9, 2021 18:28
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 zoq/8a4976c2bb4a1d82a0e09cb535ffc063 to your computer and use it in GitHub Desktop.
Save zoq/8a4976c2bb4a1d82a0e09cb535ffc063 to your computer and use it in GitHub Desktop.
data.py
import numpy as np
import pandas as pd
from pandas_datareader import data
test = data.DataReader(['TSLA', 'FB', 'SPY', 'VWO'], 'yahoo', start='2017/01/01', end='2021/03/30')
print(test.head())
test = test['Adj Close']
returns = np.log(test/test.shift(1))
returns.to_csv('test.csv')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment