thrasher-corp / gocryptotrader

A cryptocurrency trading bot and framework supporting multiple exchanges written in Golang.
MIT License
2.98k stars 799 forks source link

exchanges/websocket: update websocket rate limiting to use requester rate limiting functionality. #1578

Closed shazbert closed 3 days ago

shazbert commented 1 month ago

PR Description

Type of change

Please delete options that are not relevant and add an x in [] as item is complete.

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.

Checklist

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 45.54455% with 55 lines in your changes missing coverage. Please review.

Project coverage is 38.32%. Comparing base (74f4df6) to head (74f362e). Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
exchanges/okx/okx_websocket.go 7.69% 12 Missing :warning:
exchanges/huobi/huobi_websocket.go 0.00% 6 Missing :warning:
exchanges/binanceus/binanceus_websocket.go 0.00% 4 Missing :warning:
exchanges/bitfinex/bitfinex_websocket.go 20.00% 4 Missing :warning:
exchanges/bitmex/bitmex_websocket.go 0.00% 3 Missing :warning:
exchanges/btse/btse_websocket.go 0.00% 3 Missing :warning:
exchanges/hitbtc/hitbtc_websocket.go 0.00% 3 Missing :warning:
exchanges/bitstamp/bitstamp_websocket.go 0.00% 2 Missing :warning:
exchanges/btcmarkets/btcmarkets_websocket.go 0.00% 2 Missing :warning:
exchanges/coinbasepro/coinbasepro_websocket.go 0.00% 2 Missing :warning:
... and 12 more
Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/thrasher-corp/gocryptotrader/pull/1578/graphs/tree.svg?width=650&height=150&src=pr&token=41784B23TS&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thrasher-corp)](https://app.codecov.io/gh/thrasher-corp/gocryptotrader/pull/1578?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thrasher-corp) ```diff @@ Coverage Diff @@ ## master #1578 +/- ## ========================================== + Coverage 36.46% 38.32% +1.86% ========================================== Files 414 414 Lines 179329 149175 -30154 ========================================== - Hits 65392 57172 -8220 + Misses 106046 84123 -21923 + Partials 7891 7880 -11 ``` | [Files with missing lines](https://app.codecov.io/gh/thrasher-corp/gocryptotrader/pull/1578?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thrasher-corp) | Coverage Δ | | |---|---|---| | [exchanges/binance/binance\_wrapper.go](https://app.codecov.io/gh/thrasher-corp/gocryptotrader/pull/1578?src=pr&el=tree&filepath=exchanges%2Fbinance%2Fbinance_wrapper.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thrasher-corp#diff-ZXhjaGFuZ2VzL2JpbmFuY2UvYmluYW5jZV93cmFwcGVyLmdv) | `41.30% <100.00%> (+2.89%)` | :arrow_up: | | [exchanges/binanceus/binanceus\_types.go](https://app.codecov.io/gh/thrasher-corp/gocryptotrader/pull/1578?src=pr&el=tree&filepath=exchanges%2Fbinanceus%2Fbinanceus_types.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thrasher-corp#diff-ZXhjaGFuZ2VzL2JpbmFuY2V1cy9iaW5hbmNldXNfdHlwZXMuZ28=) | `100.00% <ø> (ø)` | | | [exchanges/binanceus/binanceus\_wrapper.go](https://app.codecov.io/gh/thrasher-corp/gocryptotrader/pull/1578?src=pr&el=tree&filepath=exchanges%2Fbinanceus%2Fbinanceus_wrapper.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thrasher-corp#diff-ZXhjaGFuZ2VzL2JpbmFuY2V1cy9iaW5hbmNldXNfd3JhcHBlci5nbw==) | `44.89% <100.00%> (+3.99%)` | :arrow_up: | | [exchanges/bithumb/bithumb\_wrapper.go](https://app.codecov.io/gh/thrasher-corp/gocryptotrader/pull/1578?src=pr&el=tree&filepath=exchanges%2Fbithumb%2Fbithumb_wrapper.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thrasher-corp#diff-ZXhjaGFuZ2VzL2JpdGh1bWIvYml0aHVtYl93cmFwcGVyLmdv) | `33.08% <100.00%> (+3.40%)` | :arrow_up: | | [exchanges/bybit/ratelimit.go](https://app.codecov.io/gh/thrasher-corp/gocryptotrader/pull/1578?src=pr&el=tree&filepath=exchanges%2Fbybit%2Fratelimit.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thrasher-corp#diff-ZXhjaGFuZ2VzL2J5Yml0L3JhdGVsaW1pdC5nbw==) | `100.00% <100.00%> (ø)` | | | [exchanges/coinut/coinut.go](https://app.codecov.io/gh/thrasher-corp/gocryptotrader/pull/1578?src=pr&el=tree&filepath=exchanges%2Fcoinut%2Fcoinut.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thrasher-corp#diff-ZXhjaGFuZ2VzL2NvaW51dC9jb2ludXQuZ28=) | `53.57% <ø> (+1.93%)` | :arrow_up: | | [exchanges/coinut/coinut\_wrapper.go](https://app.codecov.io/gh/thrasher-corp/gocryptotrader/pull/1578?src=pr&el=tree&filepath=exchanges%2Fcoinut%2Fcoinut_wrapper.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thrasher-corp#diff-ZXhjaGFuZ2VzL2NvaW51dC9jb2ludXRfd3JhcHBlci5nbw==) | `27.77% <100.00%> (+2.92%)` | :arrow_up: | | [exchanges/gateio/gateio\_websocket.go](https://app.codecov.io/gh/thrasher-corp/gocryptotrader/pull/1578?src=pr&el=tree&filepath=exchanges%2Fgateio%2Fgateio_websocket.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thrasher-corp#diff-ZXhjaGFuZ2VzL2dhdGVpby9nYXRlaW9fd2Vic29ja2V0Lmdv) | `52.79% <ø> (+2.72%)` | :arrow_up: | | [exchanges/gateio/gateio\_wrapper.go](https://app.codecov.io/gh/thrasher-corp/gocryptotrader/pull/1578?src=pr&el=tree&filepath=exchanges%2Fgateio%2Fgateio_wrapper.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thrasher-corp#diff-ZXhjaGFuZ2VzL2dhdGVpby9nYXRlaW9fd3JhcHBlci5nbw==) | `43.19% <100.00%> (+3.47%)` | :arrow_up: | | [exchanges/hitbtc/hitbtc\_wrapper.go](https://app.codecov.io/gh/thrasher-corp/gocryptotrader/pull/1578?src=pr&el=tree&filepath=exchanges%2Fhitbtc%2Fhitbtc_wrapper.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thrasher-corp#diff-ZXhjaGFuZ2VzL2hpdGJ0Yy9oaXRidGNfd3JhcHBlci5nbw==) | `50.00% <100.00%> (+4.62%)` | :arrow_up: | | ... and [28 more](https://app.codecov.io/gh/thrasher-corp/gocryptotrader/pull/1578?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thrasher-corp) | | ... and [355 files with indirect coverage changes](https://app.codecov.io/gh/thrasher-corp/gocryptotrader/pull/1578/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thrasher-corp)
shazbert commented 2 weeks ago

@gloriousCode I consolidated some code here that you might need to look over since your last review.