I'm new with programing (main challenge) with Python and so far Python is my favorite programming language. Anyways, I would like to finish my first project using Quandl but I'm stuck need support.
I have this code, to pull Quandl stocks- however, I don't want to input my tickers on my TextEditor/Sublime either by typing or pasting in.
THE GOAL: I want to pull my ticker data from a spreadsheet, then run the .py file.
Is there a way to read cell data and input into this line of code as a string, so I get the cell data to show as ['AAPL', 'MSFT'....'FB'] or ['A1', 'A2', 'A3'.......'A10']
data = quandl.get_table('WIKI/PRICES', ticker = ['AAPL', 'MSFT', 'WMT']
TO:
data = quandl.get_table('WIKI/PRICES', ticker = **(READ TICKERS PULLED FROM EXCELSTOCKDATA.PY** ['read/write cell A1', 'read/write cell A2'....''read/write cell A10']
,
I've read some of the package docs, seen YouTube examples and can't seem to solve, so I'm reaching out for your wisdom!
Here's an example of what it would look like on python if I wanted to analyzed 10+ stocks (maybe more below not sure as I copied and pasted here) but this is absolutely crazy to type in all the info by hand into python or to copy and paste as the text is also crazy. There has to be a faster method using one line of code?
GetQuandlData.py
data = quandl.get_table(['AAPL', 'MSFT','NFLX','FB','GS','TSLA','BAC','TWTR','COF','TOL','EA','PFE','MS','C','SKX','GLD','SPY','EEM']
further background:
My secondary file on reading excel data:
readstockdata.py
df = pd.read_excel("StockTickerData.xlsx", sheet_name = 'Control')
df = tickers
I guess I'd like to do this:
data = quandl.get_table('WIKI/PRICES', ticker = **(READ TICKERS PULLED FROM EXCELSTOCKDATA.PY** ['read/write cell A1', 'read/write cell A2'....''read/write cell A10']
,
You have the right idea with pulling in the data from excel as a dataframe.
You should store the data in one column with the first line as a header (e.g. Tickers). Then read it as a dataframe with pandas like you have. After that to get your list, you can run:
tickerList = list(df['Tickers'])