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
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 Details
-
type
Did this trade result from the execution of a bid or a ask? -
originalAmount
Amount that was traded -
instrument
The instrument -
price
The price -
timestamp
The timestamp of the trade according to the exchange's server, null if not provided -
id
The trade id -
makerOrderId
-
takerOrderId
-
-
Constructor Details
-
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 Details
-
getType
-
getOriginalAmount
-
getInstrument
-
getCurrencyPair
Deprecated.CurrencyPair is a subtype of Instrument - this method will throw an exception if the order was for a derivativeuse
getInstrument()
instead -
getPrice
-
getTimestamp
-
getId
-
getMakerOrderId
-
getTakerOrderId
-
equals
-
hashCode
public int hashCode() -
toString
-