Comments (10)
Hi @tommifi!
The functionality you are proposing is not done yet, since the retrieval function just admits one stock symbol per request, which means that just one str
can be sent as stock
parameter. Anyways, the improvement you are proposing will be evaluated, and if aproved, it will be available in next releases via allowing stock
parameter to be a list
of stock symbols in order to retrieve more than one stock pandas.DataFrame
of historical data.
Currently, here is the solution to retrieve more than one stock historical data pandas.DataFrame
and add them into a list
of stock historical data objects:
import investpy
stocks = ['AAPL', 'GOOG']
dfs = list()
for stock in stocks:
df = investpy.get_stock_historical_data(stock=stock,
country='united states',
from_date='01/01/2010',
to_date='01/01/2019')
dfs.append(df)
Hope this helped you! Stay tunned for future updates on this issue!
from investpy.
Hi @tommifi!
Just let you know that this issue will not be worked on for now, since currently using a for loop
seems to be enough. Anyways, if you think that this issue is a relevant feature to include in investpy just let me know and I will re-open the issue whenever I have time to include it.
Thank you for the support! β
from investpy.
Hi Alvaro,
Could you please write the complete code from
-
extracting multiple stocks historical data (AAPL, GOOG)
-
structure the data under
Column
'AAPL','Date','Open','High','Low','Close','Volume','Currency',GOOG','Date','Open','High','Low','Close','Volume','Currency' -
export to CSV or Excel
I'm very new to programming. Appreciate your kind guidance and support along my learning journey.
Thanks in advance!
from investpy.
Sure @freddie3399! I'll try to prepare a sample Python code for you to do that π€
from investpy.
Can I also see that python code sample??
from investpy.
Sure! I'll try to share it with you later today as I'm currently working and I need to create that script from scratch! ππ»
from investpy.
Sure! I'll try to share it with you later today as I'm currently working and I need to create that script from scratch! ππ»
Hi Alvaro! Were you able to write the code? I'm looking forward to hearing from you!
from investpy.
Hi @gahoccode, sorry I forgot to share that code, I'll try to prepare a simple code to achieve that so that you can use it! π€
Anyway, could you please share with me what do you exactly want? Is it something like:
- [AAPL,GOOG]
- Retrive latest stock information
- Append both DFs
- Save DF as Excel File
from investpy.
Hi @gahoccode, sorry I forgot to share that code, I'll try to prepare a simple code to achieve that so that you can use it! π€
Anyway, could you please share with me what do you exactly want? Is it something like:
- [AAPL,GOOG] - Retrive latest stock information - Append both DFs - Save DF as Excel File
So just as what @freddie3399 said, I'd like to see how you
1.extracting multiple stocks historical data (AAPL, GOOG)
2.structure the data under
Column
'AAPL','Date','Open','High','Low','Close','Volume','Currency',GOOG','Date','Open','High','Low','Close','Volume','Currency'
- export to CSV or Excel
I tried to pull 2 stocks by applying the code you gave but the result turns out not quite what I expected. It seems that it only pulls either pull only 1 of the 2 or include prices in one column. I'd like to separate price by stock column. Trying to do a percent change calculation for multiple stocks in a table. Thanks!
from investpy.
Hi @gahoccode, sorry I forgot to share that code, I'll try to prepare a simple code to achieve that so that you can use it! π€
Anyway, could you please share with me what do you exactly want? Is it something like:
- [AAPL,GOOG] - Retrive latest stock information - Append both DFs - Save DF as Excel File
Hello there Alvaro,
I too had the same query.
I tried your earlier vode of for loop but it shows run time error 520.
I am not sure you are aware but there is a similar library nsepy which I used for Indian markets it distinguishes stocks very diligently under different columns and we can append the list with ease
from investpy.
Related Issues (20)
- bond data issue HOT 11
- I got a way to access investing without cloudflare u can try it with requests library HOT 16
- π€π» Use `investiny` while we fix `investpy`! HOT 34
- ConnectionError: ERR#0015: error 403, try again later. HOT 1
- New way to get technical analysis from investing.com HOT 2
- Expecting value: line 1 column 1 (char 0) HOT 15
- JSON error trying to obtain data from investpy HOT 5
- error message when trying to get eco calendar
- Example from the docs fails
- 403 with USDEUR Data HOT 1
- ConnectionError: ERR#0015: error 403, try again later. HOT 6
- stocks missing and duplicated
- ERR#0004: data retrieval error while scraping HOT 1
- Add API to Get Data for Macro Indices
- time_zone problème HOT 2
- Is it possible to use investpy on 4h dataframe?
- ConnectionError: ERR#0015: error 403, try again later. HOT 5
- investpy.stocks.get_stocks_list, error: ERR#0004
- Scraperlink api webdevzilla HOT 4
- OSS-Fuzz Integration
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from investpy.