View Javadoc
1   package org.oxerr.peatio.rest.dto;
2   
3   import java.math.BigDecimal;
4   import java.util.Date;
5   
6   import com.fasterxml.jackson.annotation.JsonFormat;
7   import com.fasterxml.jackson.annotation.JsonProperty;
8   
9   public class Order extends BaseObject {
10  
11  	private final long id;
12  	private final String side;
13  	private final String ordType;
14  	private final BigDecimal price;
15  	private final BigDecimal avgPrice;
16  	private final String state;
17  	private final String market;
18  	private final Date createdAt;
19  	private final BigDecimal volume;
20  	private final BigDecimal remainingVolume;
21  	private final BigDecimal executedVolume;
22  	private final Integer tradesCount;
23  
24  	/**
25  	 *
26  	 * @param id unique order ID.
27  	 * @param side Buy/Sell.
28  	 * @param ordType the order type.
29  	 * @param price order price.
30  	 * @param avgPrice average execution price.
31  	 * @param state wait, done or cancel.
32  	 * 'wait' represents the order is active, it may be a new order or partial complete order;
33  	 * 'done' means the order has been fulfilled completely;
34  	 * 'cancel' means the order has been cancelled.
35  	 * @param market which market the order belongs to.
36  	 * @param createdAt order created time.
37  	 * @param volume volume to buy/sell.
38  	 * @param remainingVolume remaining volume is always less than or equal to volume.
39  	 * @param executedVolume volume = remaingVolume + executedVolume.
40  	 * @param tradesCount the number of executions.
41  	 */
42  	public Order(
43  			@JsonProperty("id") long id,
44  			@JsonProperty("side") String side,
45  			@JsonProperty("ord_type") String ordType,
46  			@JsonProperty("price") BigDecimal price,
47  			@JsonProperty("avg_price") BigDecimal avgPrice,
48  			@JsonProperty("state") String state,
49  			@JsonProperty("market") String market,
50  			@JsonProperty("created_at")
51  			@JsonFormat(pattern="yyyy-MM-dd'T'HH:mm:ssXXX") Date createdAt,
52  			@JsonProperty("volume") BigDecimal volume,
53  			@JsonProperty("remaining_volume") BigDecimal remainingVolume,
54  			@JsonProperty("executed_volume") BigDecimal executedVolume,
55  			@JsonProperty("trades_count") Integer tradesCount) {
56  		this.id = id;
57  		this.side = side;
58  		this.ordType = ordType;
59  		this.price = price;
60  		this.avgPrice = avgPrice;
61  		this.state = state;
62  		this.market = market;
63  		this.createdAt = createdAt;
64  		this.volume = volume;
65  		this.remainingVolume = remainingVolume;
66  		this.executedVolume = executedVolume;
67  		this.tradesCount = tradesCount;
68  	}
69  
70  	public long getId() {
71  		return id;
72  	}
73  
74  	public String getSide() {
75  		return side;
76  	}
77  
78  	public String getOrdType() {
79  		return ordType;
80  	}
81  
82  	public BigDecimal getPrice() {
83  		return price;
84  	}
85  
86  	public BigDecimal getAvgPrice() {
87  		return avgPrice;
88  	}
89  
90  	public String getState() {
91  		return state;
92  	}
93  
94  	public String getMarket() {
95  		return market;
96  	}
97  
98  	public Date getCreatedAt() {
99  		return createdAt;
100 	}
101 
102 	public BigDecimal getVolume() {
103 		return volume;
104 	}
105 
106 	public BigDecimal getRemainingVolume() {
107 		return remainingVolume;
108 	}
109 
110 	public BigDecimal getExecutedVolume() {
111 		return executedVolume;
112 	}
113 
114 	public Integer getTradesCount() {
115 		return tradesCount;
116 	}
117 
118 }