Package org.knowm.xchange.dto.marketdata
Class Trade
- java.lang.Object
-
- org.knowm.xchange.dto.marketdata.Trade
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
UserTrade
public class Trade extends Object implements Serializable
Data object representing a Trade- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Trade.Builder
-
Field Summary
Fields Modifier and Type Field Description protected String
id
The trade idprotected Instrument
instrument
The instrumentprotected String
makerOrderId
protected BigDecimal
originalAmount
Amount that was tradedprotected BigDecimal
price
The priceprotected String
takerOrderId
protected Date
timestamp
The timestamp of the trade according to the exchange's server, null if not providedprotected Order.OrderType
type
Did this trade result from the execution of a bid or a ask?
-
Constructor Summary
Constructors Constructor Description Trade(Order.OrderType type, BigDecimal originalAmount, Instrument instrument, BigDecimal price, Date timestamp, String id, String makerOrderId, String takerOrderId)
This constructor is called to create a public Trade object inMarketDataService.getTrades(org.knowm.xchange.currency.CurrencyPair, Object...)
implementations) since it's missing the orderId and fee parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
equals(Object o)
CurrencyPair
getCurrencyPair()
Deprecated.CurrencyPair is a subtype of Instrument - this method will throw an exception if the order was for a derivativeString
getId()
Instrument
getInstrument()
String
getMakerOrderId()
BigDecimal
getOriginalAmount()
BigDecimal
getPrice()
String
getTakerOrderId()
Date
getTimestamp()
Order.OrderType
getType()
int
hashCode()
String
toString()
-
-
-
Field Detail
-
type
protected final Order.OrderType type
Did this trade result from the execution of a bid or a ask?
-
originalAmount
protected final BigDecimal originalAmount
Amount that was traded
-
instrument
protected final Instrument instrument
The instrument
-
price
protected final BigDecimal price
The price
-
timestamp
protected final Date timestamp
The timestamp of the trade according to the exchange's server, null if not provided
-
id
protected final String id
The trade id
-
makerOrderId
protected final String makerOrderId
-
takerOrderId
protected final String takerOrderId
-
-
Constructor Detail
-
Trade
public Trade(Order.OrderType type, BigDecimal originalAmount, Instrument instrument, BigDecimal price, Date timestamp, String id, String makerOrderId, String takerOrderId)
This constructor is called to create a public Trade object inMarketDataService.getTrades(org.knowm.xchange.currency.CurrencyPair, Object...)
implementations) since it's missing the orderId and fee parameters.- Parameters:
type
- The trade type (BID side or ASK side)originalAmount
- The depth of this tradeprice
- The price (either the bid or the ask)timestamp
- The timestamp of the trade according to the exchange's server, null if not providedid
- The id of the trademakerOrderId
- The orderId of the maker in the tradetakerOrderId
- The orderId of the taker in the trade
-
-
Method Detail
-
getType
public Order.OrderType getType()
-
getOriginalAmount
public BigDecimal getOriginalAmount()
-
getInstrument
public Instrument getInstrument()
-
getCurrencyPair
@Deprecated public CurrencyPair getCurrencyPair()
Deprecated.CurrencyPair is a subtype of Instrument - this method will throw an exception if the order was for a derivativeuse
getInstrument()
instead
-
getPrice
public BigDecimal getPrice()
-
getTimestamp
public Date getTimestamp()
-
getId
public String getId()
-
getMakerOrderId
public String getMakerOrderId()
-
getTakerOrderId
public String getTakerOrderId()
-
-