karlwancl / YahooFinanceApi

A handy Yahoo! Finance api wrapper, based on .NET Standard 2.0

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

YahooFinanceApi not compatible with CsvHelper V15

cshawky opened this issue · comments

Hi
I have just started using this package, but came unstuck today because I had installed CsvHelper 15.0 with exception on

    var history = await Yahoo.GetHistoricalAsync(symbol, new DateTime(2020, 1, 1), new DateTime(2020, 7, 1), Period.Daily);

The exception was:

**Exception: Method not found: 'Void CsvHelper.CsvReader..ctor(System.IO.TextReader)'.
  Line: YahooFinanceApi
  StackTrace:    at YahooFinanceApi.Yahoo.<GetTicksAsync>d__5`1.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
   at YahooFinanceApi.Yahoo.GetTicksAsync[ITick](String symbol, Nullable`1 startTime, Nullable`1 endTime, Period period, ShowOption showOption, Func`2 instanceFunction, CancellationToken token)
   at YahooFinanceApi.Yahoo.<GetHistoricalAsync>d__2.MoveNext()

I have downgraded the project now to CsvHelper 7.1.1 and the all to GetHistoricalAsync works.

The code changes (comment out code) I made in order to downgrade from CsvHelper 15.0 online documented examples were:

    using (var csv = new CsvReader(reader /*, CultureInfo.InvariantCulture*/))
    AutoMap(/*CultureInfo.InvariantCulture*/);

I hope the above clues assist in quickly updating YahooFinanceApi to support the latest CsvHelper package.
In the meantime, is there a better way forward?

Thanks