Class OrderDTO
- java.lang.Object
-
- tech.cassandre.trading.bot.dto.trade.OrderDTO
-
public final class OrderDTO extends Object
DTO representing an order. An order is a request by an investor to buy or sell.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
OrderDTO.OrderDTOBuilder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static OrderDTO.OrderDTOBuilder
builder()
boolean
equals(Object o)
CurrencyAmountDTO
getAmount()
Amount to be ordered / amount that was ordered.BigDecimal
getAmountValue()
Returns amount value.CurrencyAmountDTO
getAveragePrice()
Weighted Average price of the fills in the order.BigDecimal
getAveragePriceValue()
Returns average price value.CurrencyAmountDTO
getCumulativeAmount()
Amount to be ordered / amount that has been matched against order on the order book/filled.BigDecimal
getCumulativeAmountValue()
Returns cumulative amount.CurrencyPairDTO
getCurrencyPair()
Currency pair.Long
getId()
Technical id.String
getLeverage()
The leverage to use for margin related to this order.CurrencyAmountDTO
getLimitPrice()
Limit price.BigDecimal
getLimitPriceValue()
Returns limit price value.CurrencyAmountDTO
getMarketPrice()
Market price - The price Cassandre had when the order was created.BigDecimal
getMarketPriceValue()
Returns market price.String
getOrderId()
An identifier set by the exchange that uniquely identifies the order.OrderStatusDTO
getStatus()
Order status.StrategyDTO
getStrategy()
The strategy that created the order.ZonedDateTime
getTimestamp()
The timestamp of the order.Optional<TradeDTO>
getTrade(String tradeId)
Returns trade from its id.Set<TradeDTO>
getTrades()
All trades related to the order.OrderTypeDTO
getType()
Order type i.e.String
getUserReference()
An identifier provided by the user on placement that uniquely identifies the order.int
hashCode()
boolean
isFulfilled()
Returns true if the order has been fulfilled with trades.String
toString()
void
updateStatus(OrderStatusDTO newStatus)
Allows you to manually update order status.
-
-
-
Method Detail
-
updateStatus
public void updateStatus(OrderStatusDTO newStatus)
Allows you to manually update order status.- Parameters:
newStatus
- new status
-
getTrade
public Optional<TradeDTO> getTrade(String tradeId)
Returns trade from its id.- Parameters:
tradeId
- trade id- Returns:
- trade
-
getAmountValue
public BigDecimal getAmountValue()
Returns amount value.- Returns:
- amount value
-
getAveragePriceValue
public BigDecimal getAveragePriceValue()
Returns average price value.- Returns:
- average price value.
-
getLimitPriceValue
public BigDecimal getLimitPriceValue()
Returns limit price value.- Returns:
- limit price value
-
getMarketPriceValue
public BigDecimal getMarketPriceValue()
Returns market price.- Returns:
- market price value
-
getCumulativeAmountValue
public BigDecimal getCumulativeAmountValue()
Returns cumulative amount.- Returns:
- cumulative amount.
-
isFulfilled
public boolean isFulfilled()
Returns true if the order has been fulfilled with trades.- Returns:
- true if order completed
-
builder
public static OrderDTO.OrderDTOBuilder builder()
-
getId
public Long getId()
Technical id.
-
getOrderId
public String getOrderId()
An identifier set by the exchange that uniquely identifies the order.
-
getType
public OrderTypeDTO getType()
Order type i.e. bid (buy) or ask (sell).
-
getStrategy
public StrategyDTO getStrategy()
The strategy that created the order.
-
getCurrencyPair
public CurrencyPairDTO getCurrencyPair()
Currency pair.
-
getAmount
public CurrencyAmountDTO getAmount()
Amount to be ordered / amount that was ordered.
-
getAveragePrice
public CurrencyAmountDTO getAveragePrice()
Weighted Average price of the fills in the order.
-
getLimitPrice
public CurrencyAmountDTO getLimitPrice()
Limit price.
-
getMarketPrice
public CurrencyAmountDTO getMarketPrice()
Market price - The price Cassandre had when the order was created.
-
getLeverage
public String getLeverage()
The leverage to use for margin related to this order.
-
getStatus
public OrderStatusDTO getStatus()
Order status.
-
getCumulativeAmount
public CurrencyAmountDTO getCumulativeAmount()
Amount to be ordered / amount that has been matched against order on the order book/filled.
-
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 order.
-
-