I was wondering how someone would apply a for loop to a function that scrapes options prices?
from wallstreet import Stock, Call, Put
import pandas as pd
g = Call('CQP', d=17, m=7, y=2020, strike=40)
df = g.price
print(df)
0.2
I was hoping I could create a For Loop that iterates through this spread sheet: https://docs.google.com/spreadsheets/d/1NeejZFvExsnHeH-XLIgMU8gAf8iRQYD6-5pAiTSvkKY/edit?usp=sharing
So far I have something like:
from wallstreet import Stock, Call, Put
import pandas as pd
df = pd.read_excel('C:/Users/User/Downloads/Options List.xlsx', sheet_name='Sheet1')
tickers_list = df['Ticker'].tolist()
options = pd.DataFrame(rows=tickers_list)
for ticker in tickers_list:
options[ticker] = Call(Ticker, d=Day, m=Month, y=Year, strike=Strike).prices
print(options)
I know that this is wrong but for the life of me, I cant make sense of how to run multiple variables though this thing.