karlwancl / YahooFinanceApi

A handy Yahoo! Finance api wrapper, based on .NET Standard 2.0
MIT License
154 stars 57 forks source link

Suggestions: Historical Prices #33

Closed dotnetshadow closed 5 years ago

dotnetshadow commented 5 years ago

Hi there, Great Library

Allow for historical prices to pass in multiple stocks It would be nice to be able to pass in a list of stocks for historical prices. Perhaps your api can then loop through the list and make each call (perhaps in parallel)

Invalid / NotFound Firstly I realise you kinda addressed it with #7 I think from an api point of view, and to be consistent with await Yahoo.Symbols, an error result should be sent back rather than an exception.

dshe commented 5 years ago

Thanks for the suggestion.

You can do it yourself, for example:

// start all tasks var task1 = Yahoo.GetHistoricalAsync(symbol1, ...); var task2 = Yahoo.GetHistoricalAsync(symbol2, ...); var task3 = Yahoo.GetHistoricalAsync(symbol3, ...);

// await tasks var history1 = await task1; var history2 = await task2; var history3 = await task3;

dotnetshadow commented 5 years ago

Cheers thanks for that

dshe commented 5 years ago

I suggest you try the new beta version.

dotnetshadow commented 5 years ago

Cool ill give it a try, I see you have added in the historical prices with a list of symbols, that is great. I haven't had a chance to use it yet, so if an error occurs do we get an error now? or still an exception?

dshe commented 5 years ago

If a symbol or field is invalid, null is returned instead of an exception being thrown.