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

local variable 'df' referenced before assignment #19

Closed
yellow1912 opened this issue Sep 24, 2023 · 1 comment
Closed

local variable 'df' referenced before assignment #19

yellow1912 opened this issue Sep 24, 2023 · 1 comment

Comments

@yellow1912
Copy link

Below is the trace

File "/usr/local/lib/python3.10/dist-packages/tessa/symbol/symbol.py", line 90, in price_latest
    return price_latest(**self._create_price_args())
  File "/usr/local/lib/python3.10/dist-packages/tessa/price/price.py", line 91, in price_latest
    df, currency = price_history(query, source, currency_preference)
  File "/usr/local/lib/python3.10/dist-packages/tessa/price/price.py", line 40, in price_history
    df, effective_currency = src.get_price_history_bruteforcefully(
  File "/usr/local/lib/python3.10/dist-packages/tessa/sources/sources.py", line 43, in get_price_history_bruteforcefully
    res = self.get_price_history(query, currency_preference)
  File "/usr/local/lib/python3.10/dist-packages/tessa/price/yahoo.py", line 28, in get_price_history
    df = df.copy()

I was trying to get MSFT price like this:

s1 = Symbol("MSFT")
print(s1.price_latest())

Looking at the code, I think you may have to throw an exception if you cannot get the ticker price for any reason

@ymyke ymyke closed this as completed in 2462be6 Oct 16, 2023
@ymyke
Copy link
Owner

ymyke commented Oct 16, 2023

Thanks for reporting! Fixed in latest release v0.8.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants