January 2020
Intermediate to advanced
530 pages
11h 11m
English
The setOrderbook method is invoked to set event streams, one for each trading asset pair. The event streams are triggered every time a new order is submitted to the orderbook.
Start writing the setOrderbook method by capturing the this instance in the local app parameter, like this:
setOrderbook = () => {let app = this;
The orderbookHandler method is an internal method invoked any time there is a new message on the orderbook event streams. The method checks the asset code of the base asset and counter asset of the new offer to determine which orderbook needs to be updated. The state variables holding the bids and asks are updated accordingly, as follows:
var orderbookHandler = function (orderbookResponse) { if (orderbookResponse.base.asset_code ...Read now
Unlock full access