alvarobartt / investpy

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

Missing ISIN: MY5274 Hong Leong Capital Berhad #298

Closed mrkgoh closed 3 years ago

mrkgoh commented 3 years ago

If you run : ip_df = investpy.get_stocks(country='malaysia')

The following stock is missing from the list. ISIN: MY5274 Hong Leong Capital Berhad

If you check investing.com the stock exists in https://www.investing.com/equities/hong-leong-capital-bhd

alvarobartt commented 3 years ago

Hi @mrkgoh thank you for reporting it! 👍🏻 This is a common issue as the static files are not updated, but in the meantime, you can use the investpy.search_quotes() function instead, I think that you can retrieve the results you are looking for like explained in: https://github.com/alvarobartt/investpy/wiki/investpy.search_quotes()

Hope this is useful to you!

mrkgoh commented 3 years ago

Hi @alvarobartt , thank you for your prompt response.

I have tried your suggested method and it seems that 'malaysia' as a country is not supported yet under investpy.stock_quotes(). Here is what I have tried:

import investpy search_results = investpy.search_quotes(text='hong leong', products=['stocks'], countries=['malaysia'], n_results=5)

Error I got :


ValueError Traceback (most recent call last)

in 1 import investpy 2 ----> 3 search_results = investpy.search_quotes(text='hong leong', products=['stocks'], 4 countries=['malaysia'], n_results=5) /volume1/homes/admin/venv/lib/python3.8/site-packages/investpy/search.py in search_quotes(text, products, countries, n_results) 89 if condition is False: 90 # TODO: instead of printing the possible filters, reference the docs ---> 91 raise ValueError('ERR#0129: countries filtering parameter possible values are: \"' + ', '.join(cst.COUNTRY_FILTERS.keys()) + '\".') 92 93 countries = [cst.COUNTRY_FILTERS[country] for country in countries] ValueError: ERR#0129: countries filtering parameter possible values are: "andorra, argentina, australia, austria, bahrain, bangladesh, belgium, bermuda, bosnia, botswana, brazil, bulgaria, canada, cayman islands, chile, china, colombia, costa rica, ivory coast, croatia, cyprus, czech republic, denmark, ecuador, egypt, estonia, euro zone, finland, france, germany, gibraltar, greece, hong kong, hungary, iceland, india, indonesia, iraq, ireland, israel, italy, jamaica, japan, jordan, kazakhstan, kenya, kuwait, latvia, lebanon, liechtenstein, lithuania, luxembourg, malawi, mauritius, mexico, monaco, mongolia, montenegro, morocco, namibia, netherlands, new zealand, nigeria, norway, oman, pakistan, palestine, peru, philippines, poland, portugal, qatar, romania, russia, rwanda, saudi arabia, serbia, singapore, slovakia, slovenia, south africa, south korea, spain, sri lanka, sweden, switzerland, taiwan, tanzania, thailand, tunisia, turkey, uganda, ukraine, dubai, united kingdom, united states, venezuela, vietnam, zambia, zimbabwe".
alvarobartt commented 3 years ago

Hmm, suspicious... So it seems that Malaysia is not listed among the Investing.com country filters... Let me check and get back to you with a response! :detective:

mrkgoh commented 3 years ago

@alvarobartt the module is working fine for most Malaysia stocks only a few stocks are experiencing this bug

alvarobartt commented 3 years ago

Sure, I guess that the error is just happening whenever you are using investpy.search_quotes(), right?

alvarobartt commented 3 years ago

Hi @mrkgoh, I've just updated the list of countries in https://github.com/alvarobartt/investpy/commit/26a61cafa9302ecc4eeffa6bf72fc5a0cd8c8ff8 with the script available at scripts/search_filters.ipynb!

I'm planning to include all the scripts so that any user can generate/update any of the static values, in order to improve the update frequency so that the users don't need to highly rely on investpy.search_quotes() :hugs:

alvarobartt commented 3 years ago

Feel free to install the latest version from the master branch and check that investpy.search_quotes() works as expected for all the financial products available in Malaysia!

pip install git+https://github.com/alvarobartt/investpy.git@master