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

Failed to handle prices more than 1000 #24

Closed
tycheng opened this issue Apr 15, 2018 · 1 comment
Closed

Failed to handle prices more than 1000 #24

tycheng opened this issue Apr 15, 2018 · 1 comment

Comments

@tycheng
Copy link

tycheng commented Apr 15, 2018

ita.get_quote("GOOG")

The code simply uses float() to do type cast, without handling the corner cases where values
greater than 3 digits uses comma as separator.

Traceback (most recent call last):
File "./launcher.py", line 53, in
main(parse_args())
File "./launcher.py", line 48, in main
app.run()
File "/home/tcheng/Repositories/spice/spice/watcher.py", line 31, in run
self.check_stock_prices()
File "/home/tcheng/Repositories/spice/spice/watcher.py", line 56, in check_stock_prices
print(ita.get_quote("GOOG"))
File "/home/tcheng/Repositories/spice/venv/lib/python3.6/site-packages/InvestopediaApi/ita.py", line 261, in get_quote
return float(quote)
ValueError: could not convert string to float: '1,029.27'

@josiahdahl
Copy link
Contributor

There's a PR open for this - #20. Hopefully it'll get merged soon.

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

3 participants