mathpaquette / IQFeed.CSharpApiClient

IQFeed.CSharpApiClient is fastest and the most well-designed C# DTN IQFeed socket API connector available
MIT License
120 stars 43 forks source link

PeriodVolume doesn't fit in 32 bit integer of IntervalMessage #122

Closed samushenkov closed 3 years ago

samushenkov commented 3 years ago

Hey there.

Some 4-hour candles for C (CITIGROUP) have period volume that doesn't fit in 32 bit integer field of IntervalMessage. This causes other various problems depending on used API method.

mathpaquette commented 3 years ago

@samushenkov could you please include requests you used?

samushenkov commented 3 years ago

I am not sure about exact time period, so try something like this:

var dateFrom = new DateTime(2000, 01, 01, 0, 0, 0);
var dateTo = new DateTime(2021, 04, 22, 0, 0, 0);

var interval = 3600 * 4;

var maxDatapoints = 50000;

var candles = await lookupClient.Historical.GetHistoryIntervalTimeframeAsync("C", interval, dateFrom, dateTo, maxDatapoints: maxDatapoints, dataDirection: DataDirection.Newest, labelAtBeginning: LabelAtBeginning.Beginning);
mathpaquette commented 3 years ago

@samushenkov are you getting InvalidData or app crash ?

samushenkov commented 3 years ago

It depends on used api method.

Without request id: GetHistoryIntervalTimeframeAsync throws InvalidData exception. And the next subsequent request to the same SocketClient returns candles from the first request.

With request id: Calling GetHistoryIntervalTimeframeAsync will end in app crash. It is not possible to handle exception.

mathpaquette commented 3 years ago

got it thanks.

mathpaquette commented 3 years ago

@samushenkov super helpful all your issues/comments

samushenkov commented 3 years ago

Thanks

mathpaquette commented 3 years ago

@samushenkov please have a look to my PR.

mathpaquette commented 3 years ago

@samushenkov can you confirm its fine now.

samushenkov commented 3 years ago

Hey @mathpaquette, thank you for your work! I will check when have a free minute.

mathpaquette commented 3 years ago

@samushenkov please dont forget to star us :)