September 2018
Intermediate to advanced
398 pages
9h 43m
English
The JSON payload that we receive when we subscribe to live transactions is slightly different from the one we had in the REST endpoint for fetching batch transactions.
We are going to need to deserialize it to a case class before we can transform it to the same Transaction case class that we used in the previous chapter. For this, first create a new case class, coinyser.WebsocketTransaction in src/main/scala:
package coinysercase class WebsocketTransaction(amount: Double, buy_order_id: Long, sell_order_id: Long, amount_str: String, price_str: String, timestamp: String, price: Double, `type`: Int, id: Int)
The names and types of the attributes correspond to the JSON attributes.
After that, we can write a unit ...
Read now
Unlock full access