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

  • Method Details

    • 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
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • builder

      public static TradeDTO.TradeDTOBuilder builder()
    • getUid

      public Long getUid()
      Technical id.
    • getTradeId

      public String getTradeId()
      An identifier set by the exchange that uniquely identifies the trade.
    • getType

      public OrderTypeDTO getType()
      Trade 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 object 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.
    • toString

      public String toString()
      Overrides:
      toString in class Object