betfairng
betfairng copied to clipboard
Support BF request throttling
I'm submitting this pull request on behalf of Zac Sky. We have embarked on a project that covers a wide range of BF markets and requires support for BF request throttling. As such Zac has updated MarketListener to support BF request throttling when retrieving MarketBooks and added a KeepAlive method to BetfairClient.
Thanks for the pull request -- I added the KeepAlive code and bug fixes in my latest push. The weighted request code is useful but I'd like to request a few changes if you have time:
- Batching can be done in a separate method before invoking BetfairClient.ListMarketBook. Makes it a little cleaner that way.
- I'm not sure we want to "Task.WhenAll()" over the batches: this implies that we're waiting for all batch http requests to finish and return, increasing the risk of one failing or taking too long. If we do (1) and return an array of Tasks for the batches this allows the caller to decide to what do in that case.
- If we do it for ListMarketBook, we may as well do it for ListMarketCatalogue and ListMarketProfitAndLoss (https://api.developer.betfair.com/services/webapps/docs/display/1smk3cen4v3lu3yomq5qye0ni/Market+Data+Request+Limits).
I also tweaked KeepAlive in my latest push to wrap it in a BetfairServerResponse (gives you latency and error metrics).
Thanks!
great idea to get api-ng and streaming api working together. going to explore this :D any chance for putting the nuget.config and nuget.targets so that I can build the solution? Thanks!!!