Open ymyke opened 4 years ago
Hi again @ymyke,
Currently as you can see, I was using ETF names as input so as to identify the ETFs from a concrete country, anyways, I did not know that more than one ETF from the same country
and the same stock_exchange
could have the same name
. Since the full_name
and the isin
is also the same, do you think it will be better to use the ETF symbol
and country
as input?
And ambiguous queries are not handled since they are supposed not to happen, recently I included the stock_exchange
information so as to differentiate ETFs with the same names in the same countries but from a different stock exchange, in this case investpy just takes the first match among the static data.
Thank you! Your answer here to the highlighted question is really important since as soon as you confirm me that the symbol is a better identifier than the name so to avoid ambiguous queries as the one you presented above, I will change it.
Hi
I don't understand the data model behind investing.com in detail, but from what I can judge so far, the symbol might be a better choice to look up things – especially in the ETF world.
Here's some code to illustrate:
etfs = investpy.get_etfs_dict()
stocks = investpy.get_stocks_dict()
for bucket in (etfs, stocks):
for attr in ("name", "symbol", "isin"):
print("Unambiguous coverage for {}: {:.2%}".format(
attr,
len(set([x[attr] + x["country"] for x in bucket if x[attr] ])) / len(bucket))
)
Which produces:
# ETFs:
Unambiguous coverage for name: 88.98%
Unambiguous coverage for symbol: 92.22%
Unambiguous coverage for isin: 89.65%
# Stocks:
Unambiguous coverage for name: 97.65%
Unambiguous coverage for symbol: 98.05%
Unambiguous coverage for isin: 97.70%
So I would love to get a way to lookup ETFs (and maybe also stocks, for consistency reason) via symbol.
Whether via a new function or an addition to the interface of the existing functions I did not reflect on. I guess backwards compatibility would be a plus.
Best myke.
@alvarobartt any particular reason to use names in ETF calls and not symbols?
For the sake of uniformity, it would be better to use symbols. But, I bet you have some specific reasons to use names instead. Could you share them?
Cheers!
I second the usage of symbol too, since there won't be conflict when ISIN are the same (which makes the name the same too): This would make more robust to use for ETF (and stocks/funds too).
I guess the reason names are used may be how the requst for the quotes page is made?
Hi
The package seems to be using queries that can be ambiguous. E.g.:
produces:
The names of both ETFs are identical but they are used as the index into
get_etf_historical_data
:Which produces:
Questions:
Thanks myke.