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

feat(lookup): add lookup request rate limiter #91

Closed mathpaquette closed 3 years ago

mathpaquette commented 3 years ago

90

BunkerCoder commented 3 years ago

@mathpaquette - I have been trying to keep up with your commits and keep testing. I hijacked ConcurrentHistoricalExample because my failing client is modeled after it. Unless I made mistakes, I'm seeing performance continuing to increase when setting RequestsPerSecond to values > 50. Performance does contract below 50. Checkout https://github.com/BunkerCoder/IQFeed.CSharpApiClient/tree/ratelimiter-tests and experiment with the test parameters. I'll continue to look for mistakes, but wanted to flag this early.

mathpaquette commented 3 years ago

@mathpaquette - I have been trying to keep up with your commits and keep testing. I hijacked ConcurrentHistoricalExample because my failing client is modeled after it. Unless I made mistakes, I'm seeing performance continuing to increase when setting RequestsPerSecond to values > 50. Performance does contract below 50. Checkout https://github.com/BunkerCoder/IQFeed.CSharpApiClient/tree/ratelimiter-tests and experiment with the test parameters. I'll continue to look for mistakes, but wanted to flag this early.

@BunkerCoder yes.. I know, this is because IQFeed turned off the rate limit for now so you still can go over 50+ requests per second but this wont be the case after January 12th if I remember. Just completed my tests on my end. Mostly ready to merge. Ill wait 1 or 2 days if someone notice anything critical. Thanks.

BunkerCoder commented 3 years ago

@mathpaquette Sorry...not thinking it through all the way before opening my mouth = MISTAKE. It would be nice to have a test server... I'll install 2.6.0.509 and continue testing my client.

mathpaquette commented 3 years ago

@mathpaquette Sorry...not thinking it through all the way before opening my mouth = MISTAKE. It would be nice to have a test server... I'll install 2.6.0.509 and continue testing my client.

You can look at my unit test too. It makes it easier to understand how does that work by changing values. The tolerance is very small so it means that we gonna stay close as possible to the limit. I feel that my solution is pretty clever by keeping the modulo of ticks as reminder for the next iteration :)

BunkerCoder commented 3 years ago

@mathpaquette Sorry...not thinking it through all the way before opening my mouth = MISTAKE. It would be nice to have a test server... I'll install 2.6.0.509 and continue testing my client.

You can look at my unit test too. It makes it easier to understand how does that work by changing values. The tolerance is very small so it means that we gonna stay close as possible to the limit. I feel that my solution is pretty clever by keeping the modulo of ticks as reminder for the next iteration :)

Yes - Super-slick/quick. Have not checked the unit tests yet, but will do.