Class TradeDTO
- java.lang.Object
-
- tech.cassandre.trading.bot.dto.trade.TradeDTO
-
public final class TradeDTO extends Object
DTO representing a trade. A trade is the action of buying and selling goods and services.This is how it works : - Received ticker - It means 1 Ether can be bought with 0.034797 Bitcoin currencyPair=ETH/BTC last=0.034797 (Last trade field is the price set during the last trade).
- Account before buying BTC : 0.99963006 ETH : 10
- Buying 0.004 Bitcoin (should cost 0.05748 ether). TradeDTO{currencyPair=ETH/BTC, originalAmount=0.004, price=0.034797}
- Account after buying BTC : 0.99949078 ETH : 10.004 It cost me 0.00013928 BTC (0.99949078 - 0.99963006). price * amount = 0.034797 * 0.004
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TradeDTO.TradeDTOBuilder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TradeDTO.TradeDTOBuilder
builder()
boolean
equals(Object o)
CurrencyAmountDTO
getAmount()
Amount of the trade.BigDecimal
getAmountValue()
Returns amount value.CurrencyPairDTO
getCurrencyPair()
Currency pair.CurrencyAmountDTO
getFee()
The fee that was charged by the exchange for this order.BigDecimal
getFeeValue()
Returns fee value.Long
getId()
Technical id.Order
getOrder()
The order responsible for this trade.String
getOrderId()
The order id of the order responsible for this trade.CurrencyAmountDTO
getPrice()
The price.BigDecimal
getPriceValue()
Returns price value.ZonedDateTime
getTimestamp()
The timestamp of the trade.String
getTradeId()
An identifier set by the exchange that uniquely identifies the trade.OrderTypeDTO
getType()
Order type i.e.String
getUserReference()
An identifier provided by the user on placement that uniquely identifies the order.int
hashCode()
String
toString()
-
-
-
Method Detail
-
getAmountValue
public BigDecimal getAmountValue()
Returns amount value.- Returns:
- amount value
-
getPriceValue
public BigDecimal getPriceValue()
Returns price value.- Returns:
- price value
-
getFeeValue
public BigDecimal getFeeValue()
Returns fee value.- Returns:
- fee value
-
builder
public static TradeDTO.TradeDTOBuilder builder()
-
getId
public Long getId()
Technical id.
-
getTradeId
public String getTradeId()
An identifier set by the exchange that uniquely identifies the trade.
-
getType
public OrderTypeDTO getType()
Order type i.e. bid (buy) or ask (sell).
-
getOrderId
public String getOrderId()
The order id of the order responsible for this trade.
-
getOrder
public Order getOrder()
The order responsible for this trade.
-
getCurrencyPair
public CurrencyPairDTO getCurrencyPair()
Currency pair.
-
getAmount
public CurrencyAmountDTO getAmount()
Amount of the trade.
-
getPrice
public CurrencyAmountDTO getPrice()
The price.
-
getFee
public CurrencyAmountDTO getFee()
The fee that was charged by the exchange for this order.
-
getUserReference
public String getUserReference()
An identifier provided by the user on placement that uniquely identifies the order.
-
getTimestamp
public ZonedDateTime getTimestamp()
The timestamp of the trade.
-
-