mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-07 07:26:48 +00:00
exchanges/websocket: Implement subscription configuration (#1394)
* Websockets: Move Subscription to its own package This allows the small type to be imported from both `config` and from `stream` without an import cycle, so we don't have to repeat ourselves * Subs: Renamed Currency to Pair This was being mis-used through much of the code, and since we're already touching everything, we might as well fix it * Websockets: Add Subscription configuration * Binance: Add subscription configuration * Kucoin: Subscription configuration * Simplify GenerateDefaultSubs * Improve TestGenSubs coverage * Test Candle Sub generation * Support Candle intervals * Full responsibility for formatting Channel name on GenerateDefaultSubs OR consumer of Subscribe * Simplify generatePayloads as a result * Fix test coverage of asset types in processMarketSnapshot * Exchanges: Abstract ParallelChanOp * Tests: Generic ws mock instances * Kucoin: Fix intermittent conflict in test currs Use isolated test instance for `TestGetOpenInterest`. `TestGetOpenInterest` would occassionally change pairs before GenerateDefault Subs.
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
{"type":"message","topic":"/market/snapshot:BTC","subject":"trade.snapshot","data":{"sequence":1698740324504,"data":{"averagePrice":0.00001164,"baseCurrency":"XMR","board":0,"buy":0.00001252,"changePrice":0.00000104800000000000,"changeRate":0.0914,"close":0.000012508,"datetime":1698740324415,"high":0.00001402100000000000,"lastTradedPrice":0.000012508,"low":0.00001129200000000000,"makerCoefficient":2.000000,"makerFeeRate":0.001,"marginTrade":false,"mark":0,"market":"BTC","marketChange1h":{"changeRate":0,"high":0,"low":0,"open":0,"vol":0,"volValue":0},"marketChange24h":{"changePrice":0.00000104800000000000,"changeRate":0.0914,"high":0.00001402100000000000,"low":0.00001129200000000000,"open":0.00001146000000000000,"vol":28474.47280000000000000000,"volValue":0.37038038297340000000},"marketChange4h":{"changePrice":0.00000009600000000000,"changeRate":0.0077,"high":0.00001308400000000000,"low":0.00001241200000000000,"open":0.00001241200000000000,"vol":7090.00000000000000000000,"volValue":0.08885800028840000000},"markets":["BTC"],"open":0.00001146000000000000,"quoteCurrency":"BTC","sell":0.000013191,"sort":100,"symbol":"XMR-BTC","symbolCode":"XMR-BTC","takerCoefficient":2.000000,"takerFeeRate":0.001,"trading":true,"vol":28474.47280000000000000000,"volValue":0.37038038297340000000}}}
|
||||
{"type":"message","topic":"/market/snapshot:BTC","subject":"trade.snapshot","data":{"sequence":1698740324488,"data":{"averagePrice":0.00000037,"baseCurrency":"ETH","board":0,"buy":0.0000003641,"changePrice":0.00000004770000000000,"changeRate":0.1394,"close":0.0000003897,"datetime":1698740324483,"high":0.00000039450000000000,"lastTradedPrice":0.0000003897,"low":0.00000034200000000000,"makerCoefficient":2.000000,"makerFeeRate":0.001,"marginTrade":false,"mark":0,"market":"BTC","marketChange1h":{"changeRate":0,"high":0,"low":0,"open":0,"vol":0,"volValue":0},"marketChange24h":{"changePrice":0.00000004770000000000,"changeRate":0.1394,"high":0.00000039450000000000,"low":0.00000034200000000000,"open":0.00000034200000000000,"vol":316078.69700000000000000000,"volValue":0.11768519138877000000},"marketChange4h":{"changePrice":0.00000003290000000000,"changeRate":0.0922,"high":0.00000038970000000000,"low":0.00000035680000000000,"open":0.00000035680000000000,"vol":2309.46880000000000000000,"volValue":0.00089999999136000000},"markets":["BTC"],"open":0.00000034200000000000,"quoteCurrency":"BTC","sell":0.0000004022,"sort":100,"symbol":"ETH-BTC","symbolCode":"ETH-BTC","takerCoefficient":2.000000,"takerFeeRate":0.001,"trading":true,"vol":316078.69700000000000000000,"volValue":0.11768519138877000000}}}
|
||||
{"type":"message","topic":"/market/snapshot:BTC","subject":"trade.snapshot","data":{"sequence":1698740324508,"data":{"averagePrice":0.00007307,"baseCurrency":"BTC","board":0,"buy":0.00008388,"changePrice":0.00001166000000000000,"changeRate":0.1630,"close":0.00008318,"datetime":1698740324437,"high":0.00008486000000000000,"lastTradedPrice":0.00008318,"low":0.00007152000000000000,"makerCoefficient":1.000000,"makerFeeRate":0.001,"marginTrade":false,"mark":0,"market":"USDT","marketChange1h":{"changePrice":-0.00000116000000000000,"changeRate":-0.0137,"high":0.00008434000000000000,"low":0.00008318000000000000,"open":0.00008434000000000000,"vol":189.33430000000000000000,"volValue":0.01578748292300000000},"marketChange24h":{"changePrice":0.00001166000000000000,"changeRate":0.1630,"high":0.00008486000000000000,"low":0.00007152000000000000,"open":0.00007152000000000000,"vol":17062.45450000000000000000,"volValue":1.33076678861000000000},"marketChange4h":{"changePrice":0.00000143000000000000,"changeRate":0.0174,"high":0.00008486000000000000,"low":0.00008175000000000000,"open":0.00008175000000000000,"vol":1752.55690000000000000000,"volValue":0.14543003812900000000},"markets":["BTC"],"open":0.00007152000000000000,"quoteCurrency":"USDT","sell":0.00008421,"sort":100,"symbol":"BTC-USDT","symbolCode":"BTC-USDT","takerCoefficient":1.000000,"takerFeeRate":0.001,"trading":true,"vol":17062.45450000000000000000,"volValue":1.33076678861000000000}}}
|
||||
{"type":"message","topic":"/market/snapshot:BTC","subject":"trade.snapshot","data":{"sequence":"459320318","data":{"averagePrice":0.00442293,"baseCurrency":"XMR","board":1,"buy":0.004411,"changePrice":0.00000000000000000000,"changeRate":0.0000,"close":0.004415,"datetime":1700555342007,"high":0.00444500000000000000,"lastTradedPrice":0.004415,"low":0.00419100000000000000,"makerCoefficient":1.000000,"makerFeeRate":0.001,"marginTrade":true,"mark":0,"market":"BTC","marketChange1h":{"changePrice":-0.00000200000000000000,"changeRate":-0.0004,"high":0.00443600000000000000,"low":0.00441300000000000000,"open":0.00441700000000000000,"vol":505.11910000000000000000,"volValue":2.23457327520000000000},"marketChange24h":{"changePrice":0.00000000000000000000,"changeRate":0.0000,"high":0.00444500000000000000,"low":0.00419100000000000000,"open":0.00441500000000000000,"vol":13097.33570000000000000000,"volValue":57.44552981000000000000},"marketChange4h":{"changePrice":0.00001100000000000000,"changeRate":0.0024,"high":0.00443600000000000000,"low":0.00439300000000000000,"open":0.00440400000000000000,"vol":2124.84330000000000000000,"volValue":9.37472351370000000000},"markets":["BTC"],"open":0.00441500000000000000,"quoteCurrency":"BTC","sell":0.004415,"sort":100,"symbol":"XMR-BTC","symbolCode":"XMR-BTC","takerCoefficient":1.000000,"takerFeeRate":0.001,"trading":true,"vol":13097.33570000000000000000,"volValue":57.44552981000000000000}}}
|
||||
{"type":"message","topic":"/market/snapshot:BTC","subject":"trade.snapshot","data":{"sequence":"692562428","data":{"averagePrice":0.05414932,"baseCurrency":"ETH","board":1,"buy":0.053778,"changePrice":-0.00045800000000000000,"changeRate":-0.0084,"close":0.053778,"datetime":1700555340197,"high":0.05484600000000000000,"lastTradedPrice":0.053778,"low":0.05364000000000000000,"makerCoefficient":1.000000,"makerFeeRate":0.001,"marginTrade":true,"mark":0,"market":"BTC","marketChange1h":{"changePrice":-0.00008000000000000000,"changeRate":-0.0014,"high":0.05387400000000000000,"low":0.05371000000000000000,"open":0.05385800000000000000,"vol":63.72190510000000000000,"volValue":3.42879155215990000000},"marketChange24h":{"changePrice":-0.00045800000000000000,"changeRate":-0.0084,"high":0.05484600000000000000,"low":0.05364000000000000000,"open":0.05423600000000000000,"vol":2958.31391160000000000000,"volValue":160.78476727842130000000},"marketChange4h":{"changePrice":-0.00002700000000000000,"changeRate":-0.0005,"high":0.05399000000000000000,"low":0.05371000000000000000,"open":0.05380500000000000000,"vol":166.22099950000000000000,"volValue":8.95534024043750000000},"markets":["BTC","Shanghai-Upgrade"],"open":0.05423600000000000000,"quoteCurrency":"BTC","sell":0.053779,"sort":100,"symbol":"ETH-BTC","symbolCode":"ETH-BTC","takerCoefficient":1.000000,"takerFeeRate":0.001,"trading":true,"vol":2958.31391160000000000000,"volValue":160.78476727842130000000}}}
|
||||
{"type":"message","topic":"/market/snapshot:BTC","subject":"trade.snapshot","data":{"sequence":"9860735911","data":{"averagePrice":37110.27939304,"baseCurrency":"BTC","board":1,"buy":37366.7,"changePrice":171.50000000000000000000,"changeRate":0.0046,"close":37366.8,"datetime":1700555342151,"high":37750.00000000000000000000,"lastTradedPrice":37366.8,"low":36700.00000000000000000000,"makerCoefficient":1.000000,"makerFeeRate":0.001,"marginTrade":true,"mark":0,"market":"USDS","marketChange1h":{"changePrice":105.60000000000000000000,"changeRate":0.0028,"high":37366.80000000000000000000,"low":37232.30000000000000000000,"open":37261.20000000000000000000,"vol":52.88854739000000000000,"volValue":1972678.83173137400000000000},"marketChange24h":{"changePrice":171.50000000000000000000,"changeRate":0.0046,"high":37750.00000000000000000000,"low":36700.00000000000000000000,"open":37195.30000000000000000000,"vol":2900.37846402000000000000,"volValue":108210331.34015163900000000000},"marketChange4h":{"changePrice":-94.70000000000000000000,"changeRate":-0.0025,"high":37476.40000000000000000000,"low":37232.30000000000000000000,"open":37461.50000000000000000000,"vol":263.14059486000000000000,"volValue":9829529.74388805200000000000},"markets":["USDS"],"open":37195.30000000000000000000,"quoteCurrency":"USDT","sell":37366.8,"sort":100,"symbol":"BTC-USDT","symbolCode":"BTC-USDT","takerCoefficient":1.000000,"takerFeeRate":0.001,"trading":true,"vol":2900.37846402000000000000,"volValue":108210331.34015163900000000000}}}
|
||||
|
||||
Reference in New Issue
Block a user