gruelbox / orko

Trade on and script multiple crypto exchanges from a single user interface on desktop and mobile. In development.
GNU Affero General Public License v3.0
179 stars 63 forks source link

Move order book management to client side #119

Open badgerwithagun opened 5 years ago

badgerwithagun commented 5 years ago

At the moment, a complete order book snapshot is maintained by xchange-stream or fetched directly using XChange, then sent down the web socket every time something changes. Where we have streaming order books (binance, bitfinex, coinbase pro, possibly Bitmex) we should let the assembly be managed by the JS client so we only send changes down the wire.

The problem here is that all the different exchanges manage their updates using different protocols. For example, with Binance we have repeated resync attempts to manage, with API calls, when something gets out of sync. This can totally be done in JS (and in fact, having all those resync attempts running from the client rather than the server helps us in terms of rate limits) but probably means managing those things using ccxt instead of XChange... which is itself something I've been pondering for a while.

badgerwithagun commented 5 years ago

Should add a PR to xchange-stream to gain direct access to the change stream.