Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some assets do not have long names on YT finance #24

Closed
bolapara opened this issue Oct 23, 2021 · 4 comments
Closed

Some assets do not have long names on YT finance #24

bolapara opened this issue Oct 23, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@bolapara
Copy link
Contributor

When looking up the BTC-USD asset, I get the following traceback:

Traceback (most recent call last): File "/home/josh/.local/bin/lak", line 8, in <module> sys.exit(lak()) File "/home/josh/.local/lib/python3.8/site-packages/click/core.py", line 1128, in __call__ return self.main(*args, **kwargs) File "/home/josh/.local/lib/python3.8/site-packages/click/core.py", line 1053, in main rv = self.invoke(ctx) File "/home/josh/.local/lib/python3.8/site-packages/click/core.py", line 1659, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/josh/.local/lib/python3.8/site-packages/click/core.py", line 1690, in invoke rv.append(sub_ctx.command.invoke(sub_ctx)) File "/home/josh/.local/lib/python3.8/site-packages/click/core.py", line 1395, in invoke return ctx.invoke(self.callback, **ctx.params) File "/home/josh/.local/lib/python3.8/site-packages/click/core.py", line 754, in invoke return __callback(*args, **kwargs) File "/home/josh/.local/lib/python3.8/site-packages/lakshmi/lak.py", line 272, in assets output = portfolio.assets( File "/home/josh/.local/lib/python3.8/site-packages/lakshmi/lakshmi.py", line 636, in assets + [asset.name(), asset.adjusted_value()]) File "/home/josh/.local/lib/python3.8/site-packages/lakshmi/cache.py", line 174, in new_func value = call_func(class_obj, func) File "/home/josh/.local/lib/python3.8/site-packages/lakshmi/cache.py", line 138, in call_func return func(class_obj) File "/home/josh/.local/lib/python3.8/site-packages/lakshmi/assets.py", line 489, in name raise NotFoundError( lakshmi.assets.NotFoundError: Cannot retrieve ticker ("BTC-USD") from Yahoo Finance

I found that this asset does not actually have a longName field in the ticker object provided by YT API. There are a few other name fields so I've got a PR coming shortly to try to fall back to some other naming fields if the longName field does not exist.

@sarvjeets sarvjeets added the bug Something isn't working label Oct 23, 2021
@sarvjeets
Copy link
Owner

Thanks for catching this. Could you please add a unit test in test_assets.py for this case as well?

@sarvjeets
Copy link
Owner

Thanks for the quick fix. Please let me know if you want me to push a new release to pypi?

@bolapara
Copy link
Contributor Author

I can run with my local changes until you update. Thanks.

@sarvjeets
Copy link
Owner

These changes are now released in lakshmi v2.1.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants