View Javadoc
1   package org.oxerr.okcoin.rest.dto;
2   
3   import java.math.BigDecimal;
4   import java.time.Instant;
5   
6   import org.oxerr.okcoin.rest.dto.deserializer.EpochMilliDeserializer;
7   import org.oxerr.okcoin.rest.dto.deserializer.StatusDeserializer;
8   import org.oxerr.okcoin.rest.dto.deserializer.TypeDeserializer;
9   
10  import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
11  import com.fasterxml.jackson.annotation.JsonProperty;
12  import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
13  
14  @JsonIgnoreProperties(value = "orders_id")
15  public class Order extends BaseObject {
16  
17  	private static final long serialVersionUID = 20140614L;
18  
19  	private final long orderId;
20  
21  	private final Status status;
22  
23  	private final String symbol;
24  
25  	private final Type type;
26  
27  	/**
28  	 * The limit price or the amount of quoting currency amount
29  	 * for buy_market order.
30  	 *
31  	 * Note, price of buy_market is the quoting currency amount,
32  	 * price of sell_market is 0.
33  	 */
34  	private final BigDecimal price;
35  
36  	/**
37  	 * The amount of the base symbol.
38  	 *
39  	 * Note, amount of buy_market is 0.
40  	 */
41  	private final BigDecimal amount;
42  
43  	private final BigDecimal dealAmount;
44  
45  	private final BigDecimal avgPrice;
46  
47  	private final Instant createDate;
48  
49  	public Order(
50  		@JsonProperty("order_id") final long orderId,
51  		@JsonProperty("status")
52  		@JsonDeserialize(using = StatusDeserializer.class)
53  		final Status status,
54  		@JsonProperty("symbol") final String symbol,
55  		@JsonProperty("type")
56  		@JsonDeserialize(using = TypeDeserializer.class)
57  		final Type type,
58  		@JsonProperty("price") final BigDecimal price,
59  		@JsonProperty("amount") final BigDecimal amount,
60  		@JsonProperty("deal_amount") final BigDecimal dealAmount,
61  		@JsonProperty("avg_price") final BigDecimal avgPrice,
62  		@JsonProperty("create_date")
63  		@JsonDeserialize(using = EpochMilliDeserializer.class)
64  		final Instant createDate) {
65  		this.orderId = orderId;
66  		this.status = status;
67  		this.symbol = symbol;
68  		this.type = type;
69  		this.price = price;
70  		this.amount = amount;
71  		this.dealAmount = dealAmount;
72  		this.avgPrice = avgPrice;
73  		this.createDate = createDate;
74  	}
75  
76  	public long getOrderId() {
77  		return orderId;
78  	}
79  
80  	public Status getStatus() {
81  		return status;
82  	}
83  
84  	public String getSymbol() {
85  		return symbol;
86  	}
87  
88  	public Type getType() {
89  		return type;
90  	}
91  
92  	public BigDecimal getPrice() {
93  		return price;
94  	}
95  
96  	public BigDecimal getAmount() {
97  		return amount;
98  	}
99  
100 	public BigDecimal getDealAmount() {
101 		return dealAmount;
102 	}
103 
104 	public BigDecimal getAvgPrice() {
105 		return avgPrice;
106 	}
107 
108 	public Instant getCreateDate() {
109 		return createDate;
110 	}
111 
112 }