gocryptotrader
gocryptotrader copied to clipboard
exchanges/request: abstract and consolidate rate limiting code to request package
PR Description
Pulled from initial draft #1151
- Allows context cancellation to occur while routine is being rate limited for any outbound REST request
- Reduces wrapper code size and bespoke implementations
- Fixes a couple of endpoints defaulting to unauth rates [BUG]
Type of change
Please delete options that are not relevant and add an x
in []
as item is complete.
- [x] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update
How has this been tested
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration and also consider improving test coverage whilst working on a certain feature or package.
- [ ] go test ./... -race
- [ ] golangci-lint run
- [ ] Test X
Checklist
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation and regenerated documentation via the documentation tool
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally and on Github Actions with my changes
- [ ] Any dependent changes have been merged and published in downstream modules
Codecov Report
Attention: Patch coverage is 95.55215%
with 29 lines
in your changes are missing coverage. Please review.
Project coverage is 35.97%. Comparing base (
c37a115
) to head (e4ca46c
). Report is 1 commits behind head on master.
:exclamation: Current head e4ca46c differs from pull request most recent head b17621b
Please upload reports for the commit b17621b to get more accurate results.
Additional details and impacted files
@@ Coverage Diff @@
## master #1477 +/- ##
==========================================
- Coverage 37.78% 35.97% -1.82%
==========================================
Files 409 409
Lines 147697 176414 +28717
==========================================
+ Hits 55807 63464 +7657
- Misses 84031 105101 +21070
+ Partials 7859 7849 -10
Files | Coverage Δ | |
---|---|---|
currency/coinmarketcap/coinmarketcap.go | 55.33% <100.00%> (-1.01%) |
:arrow_down: |
exchanges/binance/binance_cfutures.go | 33.55% <100.00%> (-5.77%) |
:arrow_down: |
exchanges/binance/binance_wrapper.go | 38.45% <100.00%> (-2.82%) |
:arrow_down: |
exchanges/binance/ratelimit.go | 96.51% <100.00%> (+31.89%) |
:arrow_up: |
exchanges/binance/type_convert.go | 56.36% <ø> (-1.29%) |
:arrow_down: |
exchanges/binanceus/binanceus_wrapper.go | 40.89% <100.00%> (-4.00%) |
:arrow_down: |
exchanges/binanceus/ratelimit.go | 84.84% <100.00%> (+36.63%) |
:arrow_up: |
exchanges/bitfinex/bitfinex_wrapper.go | 37.95% <100.00%> (-3.57%) |
:arrow_down: |
exchanges/bitfinex/ratelimit.go | 100.00% <100.00%> (+54.79%) |
:arrow_up: |
exchanges/bitflyer/bitflyer.go | 50.31% <100.00%> (-10.52%) |
:arrow_down: |
... and 47 more |