1 package org.oxerr.okcoin.websocket.dto;
2
3 import java.time.Instant;
4
5 import javax.json.JsonObject;
6 import javax.json.JsonValue;
7
8 import org.oxerr.okcoin.rest.dto.Status;
9 import org.oxerr.okcoin.rest.dto.Type;
10
11 public class Order extends org.oxerr.okcoin.rest.dto.Order {
12
13 private static final long serialVersionUID = 2015030701L;
14
15 public Order(JsonValue jsonValue) {
16 this((JsonObject) jsonValue);
17 }
18
19 public Order(JsonObject jsonObject) {
20 super(
21 jsonObject.getJsonNumber("order_id").longValue(),
22 Status.of(jsonObject.getInt("status")),
23 jsonObject.getString("symbol"),
24 Type.of(jsonObject.getString("type")),
25 jsonObject.getJsonNumber("price").bigDecimalValue(),
26 jsonObject.getJsonNumber("amount").bigDecimalValue(),
27 jsonObject.getJsonNumber("deal_amount").bigDecimalValue(),
28 jsonObject.getJsonNumber("avg_price").bigDecimalValue(),
29 Instant.ofEpochMilli(jsonObject.getJsonNumber("create_date").longValue())
30 );
31 }
32
33 }