xemwebe / yahoo_finance_api

Simple wrapper to yahoo! finance API to retrieve latest quotes and end-of-day quote histories
Apache License 2.0
64 stars 29 forks source link

u32 not sufficient for volume #4

Closed rroels closed 3 years ago

rroels commented 3 years ago

First of all, thanks a lot for the great library, it's been a great help.

However, I'm running into an issue with certain tickers that have a daily volume that's too big for a u32. This results in the following Err():

thread 'main' panicked at 'called Result::unwrap() on an Err value: DeserializeFailed("invalid value: integer 35867318894, expected u32")'

To reproduce:

let provider = yahoo::YahooConnector::new(); let response = tokio_test::block_on(provider.get_quote_range("BTC-USD", "1d", "5d")).unwrap(); let quotes = response.quotes().unwrap();

Yes, I'm aware that BTC is not a typical "stock", but I still hope that I can use this library for BTC, since I'm already using it for other tickers anyway. There's also a chance that this issue can occur with normal stocks too.

Thanks again for the great work.

xemwebe commented 3 years ago

I agree, the library should also work for BTC. I have upgrade the volume to u64, which should be sufficient for a while. I have also added a unit test for BTC, it's always good to have extreme cases covered by tests.

Since the library has reached a more or less stable state, I have decided to upgrade the version number to 1.0.0.