alvarobartt / investpy

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

Get or Search Stock by ISIN and S/N #352

Closed sirinath closed 3 years ago

sirinath commented 3 years ago

Can the ability to use ISIN and S/N for stocks added:

Type: Equity
Market: Sri Lanka
ISIN: LK0039N00004 
S/N: CTEA-N-0000

https://www.investing.com/equities/ceylon-tea-services-company-profile

I am more interested in the S/N this is close to the actual CSE ticker which is CTEA.N0000.

alvarobartt commented 3 years ago

Hi again @sirinath, as I told you previously you can use investpy.search_quotes() to do so, rather than waiting for me to implement the input type selection as mentioned some time ago in https://github.com/alvarobartt/investpy/issues/147 (as it was requested by a lot of users!)

:pushpin: Make sure that you are using the latest investpy version! investpy v1.0.6

Here's an example of how to use investpy.search_quotes() to retrieve the stock you mentioned above:

>>> import investpy

>>> search_result = investpy.search_quotes(text='LK0039N00004', products=['stocks'], countries=['Sri Lanka'], n_results=1)
>>> print(search_result)
{"id_": 41796, "name": "Ceylon Tea Services PLC", "symbol": "CTEA", "country": "sri lanka", "tag": "/equities/ceylon-tea-services", "pair_type": "stocks", "exchange": "Colombo"}

>>> recent_data = search_result.retrieve_recent_data()
>>> historical_data = search_result.retrieve_historical_data(from_date='01/01/2020', to_date='01/01/2021')
>>> information = search_result.retrieve_information()

To further explore the functionality of investpy.search_quotes() please check [Wiki - investpy.search_quotes()](https://github.com/alvarobartt/investpy/wiki/investpy.search_quotes())