question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug L3 orderbook kucoin

See original GitHub issue

L3 orderbook gets out of sync really fast with Kucoin

@bmancini55 I have tried your L3 prototype OB and I have also built one myself, but both of them lose quite a lot of information it seems. I think it gets out of sync at least around every minute (so the sequenceId gets out of sync). To recreate the bug, just run your code and you should have an “out of sync, expected ${ob.sequenceId + 1}, got ${update.sequenceId}” error fast. Here is the exact code: const ccxws = require("ccxws"); const KucoinOrderBook = require("ccxws/src/orderbooks/KucoinOrderBook"); let market = {id: "BTC-USDT", base: "BTC", quote: "USDT"}; let updates = []; let ob; const client = new ccxws.Kucoin(); client.subscribeLevel3Updates(market); client.on("l3snapshot", snapshot => { ob = new KucoinOrderBook(snapshot, updates); }); client.on("l3update", update => { // enqueue updates until snapshot arrives if (!ob) { updates.push(update); return; } // validate the sequence and exit if we are out of sync if (ob.sequenceId + 1 !== update.sequenceId) { console.log(out of sync, expected ${ob.sequenceId + 1}, got ${update.sequenceId}); process.exit(1); } // apply update ob.update(update); });

The only thing I found about it as of right now, was someone who used python : https://github.com/Kucoin/kucoin-api-docs/issues/44#issuecomment-477105864

EDIT: Running on Node v14.7 on Windows 10

Really random guess, could be a fault in WS package and this could be the fix? https://github.com/websockets/ws/commit/e1349c047d7f1c120ca606364e35d5c4c627c599 Tried it myself didn’t work unfortunately

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bmancini55commented, Aug 24, 2020

Released in https://github.com/altangent/ccxws/releases/tag/v0.37.2. Also added a few minor fixes to the L3 order book.

0reactions
WoutervDijkcommented, Aug 24, 2020

Nice work thanks @bmancini55

Read more comments on GitHub >

github_iconTop Results From Across the Web

Announcement Regarding the Adjustment of Spot Level2 ...
To provide our valued users a better trading experience, KuCoin will adjust the Spot Level2/Level3 REST Interface of “Get Full Order Book” ...
Read more >
Open Orders Did Not Go Through - KuCoin
If an order has remained open for an extended period, it may be that the price you entered is not consistent with the...
Read more >
Announcement Regarding the Adjustment of Request Rate ...
In order to further improve the quality of service, KuCoin will adjust the request rate limit of Spot and Futures level3 full order...
Read more >
Trading 101: What is an Order book? - KuCoin
An order book is an electronic list containing buy and sell orders of a given investment vehicle. The book's arrangement is made according ......
Read more >
Deprecate the KuCoin Spot/Futures API
Dear KuCoin Users, · 6:00:00, 04/28/2022 (UTC) · The following endpoints will be deprecated for the Spot API: · GET /api/v3/market/orderbook/level3.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found