Dear users,
I am quite new to Python coding, and recently I have found a way to download stock data into Python.
Since I am downloading multiple stocks at once, I want to change the output of what Python gives me as a return of this string.
The string I am using is:
The output i Receive is
I would like the output to be changed in a way that infront of every row, it will say the ticker simbol. (which in this case is AAPL)
So an example would be:
Kind regards,
Hoogoo
I am quite new to Python coding, and recently I have found a way to download stock data into Python.
Since I am downloading multiple stocks at once, I want to change the output of what Python gives me as a return of this string.
The string I am using is:
import requests url = "https://query1.finance.yahoo.com/v7/finance/download/AAPL?period1=1514761200&period2=1517439600&interval=1d&events=history&crumb=Nr.jC4aJCc7" response = requests.post(url) print (response.text)If i copy this string multiple times and change the ticker symbol, i will receive data from multiple stocks.
The output i Receive is
Output:Date,Open,High,Low,Close,Adj Close,Volume
2018-01-02,170.160004,172.300003,169.259995,172.259995,169.712067,25555900
2018-01-03,172.529999,174.550003,171.960007,172.229996,169.682510,29517900
2018-01-04,172.539993,173.470001,172.080002,173.029999,170.470703,22434600
2018-01-05,173.440002,175.369995,173.050003,175.000000,172.411560,23660000
(I get more rows, but for argument sake this is enough)I would like the output to be changed in a way that infront of every row, it will say the ticker simbol. (which in this case is AAPL)
So an example would be:
Output:Ticker,Date,Open,High,Low,Close,Adj Close,Volume
AAPL,2018-01-02,170.160004,172.300003,169.259995,172.259995,169.712067,25555900
Is there anyone who can help me with this issue?Kind regards,
Hoogoo