alvarobartt / investpy

Financial Data Extraction from Investing.com with Python
https://investpy.readthedocs.io/
MIT License
1.59k stars 375 forks source link

Added support for etf extraction by symbol #427

Closed ehcalabres closed 12 months ago

ehcalabres commented 2 years ago

Added support for etf extraction by symbol

As requested on this issue #425, a new feature has been added to the etf information extraction functionalty. Now it's possible to obtain the desired information by either indicating the etf name or symbol.

In order to differentiate wether it is the symbol or the name, a new is_symbol parameter has been added to the functions of etf extraction such get_etf_recent_data(), get_etf_historical_data() and get_etf_information().

As result, the way you can extract the information with name remains unchanged:

import investpy

# Getting etf information by name
data = investpy.get_etf_recent_data('bbva accion dj eurostoxx 50', 'spain')

But if you want to retrieve the information by symbol the resulting method should look like this:

import investpy

# Getting etf information by symbol
data = investpy.get_etf_recent_data('bbvae', 'spain', is_symbol=True)

Note that the is_symbol parameter is optional and its default value is set to False in order to maintain how the previous were used.

All tests for this new functionality has been added to the tests scripts and has been passed without errors.

eyalk11 commented 2 years ago

Ah, yeh , maybe https://github.com/alvarobartt/investpy/pull/453 overlaps.