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.TypeDeserializer;
8   
9   import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
10  import com.fasterxml.jackson.annotation.JsonProperty;
11  import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
12  
13  @JsonIgnoreProperties(value = "date")
14  public class Trade extends BaseObject {
15  
16  	private static final long serialVersionUID = 2015020401L;
17  
18  	private final Instant date;
19  
20  	private final BigDecimal price;
21  
22  	private final BigDecimal amount;
23  
24  	private final long tid;
25  
26  	private final Type type;
27  
28  	public Trade(
29  		@JsonProperty("date_ms")
30  		@JsonDeserialize(using = EpochMilliDeserializer.class)
31  		final Instant date,
32  		@JsonProperty("price") final BigDecimal price,
33  		@JsonProperty("amount") final BigDecimal amount,
34  		@JsonProperty("tid") final long tid,
35  		@JsonProperty("type")
36  		@JsonDeserialize(using = TypeDeserializer.class)
37  		final Type type) {
38  		this.date = date;
39  		this.price = price;
40  		this.amount = amount;
41  		this.tid = tid;
42  		this.type = type;
43  	}
44  
45  	/**
46  	 * Returns the transaction time.
47  	 *
48  	 * @return the transaction time.
49  	 */
50  	public Instant getDate() {
51  		return date;
52  	}
53  
54  	/**
55  	 * Returns the transaction price.
56  	 *
57  	 * @return the transaction price.
58  	 */
59  	public BigDecimal getPrice() {
60  		return price;
61  	}
62  
63  	/**
64  	 * Returns the quantity in BTC (or LTC).
65  	 *
66  	 * @return the quantity in BTC (or LTC).
67  	 */
68  	public BigDecimal getAmount() {
69  		return amount;
70  	}
71  
72  	/**
73  	 * Returns the transaction ID.
74  	 *
75  	 * @return the transaction ID.
76  	 */
77  	public long getTid() {
78  		return tid;
79  	}
80  
81  	/**
82  	 * Returns the type.
83  	 *
84  	 * @return buy/sell.
85  	 */
86  	public Type getType() {
87  		return type;
88  	}
89  
90  }