thrasher-corp / gocryptotrader

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

Coinut: Fix websocket not parsing instruments, improve nonce matching and error handling #1495

Closed gbjk closed 4 months ago

gbjk commented 4 months ago

WsConnect is calling GetInstruments, and when that fails, erroring out and not subscribing to anything.

The response to get instruments is an object {}, which skips the IncomingWithData check in wsReadData for arrays []. The check in wsHandleData depended on client_ord_id, but I figure so long as there's a nonce which matches, we can palm it off.

This results simutaneously in having to move the login handler back to it's waiting nonce-parser, and also simplifying/deduping it.

Type of change

How has this been tested

codecov[bot] commented 4 months ago

Codecov Report

Attention: Patch coverage is 2.94118% with 33 lines in your changes are missing coverage. Please review.

Project coverage is 35.87%. Comparing base (d679a76) to head (bb9cd14).

:exclamation: Current head bb9cd14 differs from pull request most recent head 0c0c3ec. Consider uploading reports for the commit 0c0c3ec to get more accurate results

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/thrasher-corp/gocryptotrader/pull/1495/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/1495?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 #1495 +/- ## ========================================== - Coverage 35.89% 35.87% -0.02% ========================================== Files 411 411 Lines 177595 177558 -37 ========================================== - Hits 63752 63706 -46 - Misses 106058 106071 +13 + Partials 7785 7781 -4 ``` | [Files](https://app.codecov.io/gh/thrasher-corp/gocryptotrader/pull/1495?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/coinut/coinut\_websocket.go](https://app.codecov.io/gh/thrasher-corp/gocryptotrader/pull/1495?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thrasher-corp#diff-ZXhjaGFuZ2VzL2NvaW51dC9jb2ludXRfd2Vic29ja2V0Lmdv) | `25.79% <2.94%> (+0.79%)` | :arrow_up: | ... and [13 files with indirect coverage changes](https://app.codecov.io/gh/thrasher-corp/gocryptotrader/pull/1495/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thrasher-corp)