gocryptotrader
gocryptotrader copied to clipboard
Kraken: Subscription improvements
- Move UpdateTradablePairs to a test This should not happen in TestMain just because it's a requirement for most tests. It should just be a non-parallel early test. That allows unit tests to run quickly without calling it, and allows proper clear failures
- Separate auth and non-auth ws tests
- Move SeedAssets from Setup to Start Having SeedAssets in Setup is cruel and unusual because it calls the API. Most other interactive data seeding happens in Start. This made it so that fixing and creating unit tests for Kraken was painfully slow, particularly on flaky internet.
- Use Websocket subscriptionChannels instead of local slice
- Remove ChannelID - Deprecated in docs I went both ways on this N+ times. ChannelID is great, but the bottom line is that it's deprecated, and not available in auth channels. By moving away from it we futureproof, and there's no downside really. Note that with or without
- Simplify ping handlers and hardcodes message
- Add Depth as configurable orderbook channel param
- Simplify auth/non-auth channel updates
Type of change
- [x] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [x] Improvement (non-functional improvements)
How has this been tested
- [x] go test ./... -race
- [x] golangci-lint run
Rebased against master. Fixes for races and Unsub loops added.
Rebased on master and pulled in the latest changes from the bitfinex PR's websockets improvements.
Note: There's a failure on Bitfinex here which is fixed in it's own PR.
@shazbert This is ready for review; Please remove the label.
Rebased on master already.
Just some errors running instance:
Ah damn it.
When I rebased on your checkSubscriptions() recently I introduced an earlier EnsureKeyed.
That breaks the "don't double up" check in Kraken's own ensureKeyed
, which in hindsight wasn't very robust.
Okay. On it.
@shazbert Thanks for that.
Fixed 20d8288
I'm done fiddling this PR again. I know I circled back to fix the cancelOrder handling on this. @shazbert Commits 52f1d68..7cdf6e9 are the new ones; Sorry to add to this after your review.
Thanks for letting me know, will check them out
Codecov Report
Attention: 235 lines
in your changes are missing coverage. Please review.
Comparison is base (
59916a7
) 43.32% compared to head (71f3cf5
) 43.32%. Report is 4 commits behind head on master.
:exclamation: Current head 71f3cf5 differs from pull request most recent head a28851a. Consider uploading reports for the commit a28851a to get more accurate results
Additional details and impacted files
@@ Coverage Diff @@
## master #1358 +/- ##
==========================================
- Coverage 43.32% 43.32% -0.01%
==========================================
Files 366 366
Lines 146950 146995 +45
==========================================
+ Hits 63672 63679 +7
- Misses 75464 75475 +11
- Partials 7814 7841 +27
Files | Coverage Ξ | |
---|---|---|
common/common.go | 94.05% <100.00%> (+1.13%) |
:arrow_up: |
exchanges/stream/websocket.go | 82.75% <100.00%> (ΓΈ) |
|
exchanges/bitfinex/bitfinex_wrapper.go | 37.22% <0.00%> (+0.28%) |
:arrow_up: |
exchanges/kraken/kraken_wrapper.go | 37.36% <31.81%> (-1.73%) |
:arrow_down: |
exchanges/kraken/kraken_websocket.go | 46.75% <51.76%> (+14.85%) |
:arrow_up: |
@gloriousCode Thank you π Changes made. Let me know if you're happy and I'll fixup down before Adrian's review
@gloriousCode Build issue fixed; Ready for you
Structure currently means 1 req per channel/pair for Kraken, so we could better handle failures.
That's not performant enough by a long way with --enableallpairs
.
Currently re-structuring slightly Pair
π Pairs
natively in Subscription
.
Will re-open this fresh. It's too cluttered and different to just force push and pretend nothing happened.