Skip to content

Instantly share code, notes, and snippets.

@neurojojo
Last active February 16, 2022 22:31
Show Gist options
  • Select an option

  • Save neurojojo/a3d3b0b6dc5e42f97bbd12355915f6a6 to your computer and use it in GitHub Desktop.

Select an option

Save neurojojo/a3d3b0b6dc5e42f97bbd12355915f6a6 to your computer and use it in GitHub Desktop.
import pickle, yfinance as yf
stock_tseries_df = pd.DataFrame()
for x in ssr_database.iterrows():
try:
thisstock = yf.download( x[1].Ticker, start=x[1].Datetime.date(), end=x[1].NextDay.date(), interval = '30m' )
tmp = pd.DataFrame( [ x[1].Ticker, x[1].Datetime, x[1].NextDay, \
thisstock['Close'].values[0:13],thisstock['Close'].values[14:],\
thisstock['Volume'].values[0:13],thisstock['Volume'].values[14:]] ).transpose()
stock_tseries_df = pd.concat( [stock_tseries_df,tmp] )
with open("ssr_database_df.pickle","wb") as f:
pickle.dump(stock_tseries_df,f)
except:
break
stock_tseries_df.columns = ['Ticker','Datetime','NextDay','Close0','Close1','Volume0','Volume1']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment