Class GainDTO
- java.lang.Object
-
- tech.cassandre.trading.bot.dto.util.GainDTO
-
public final class GainDTO extends Object
Gain.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GainDTO.GainDTOBuilder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static GainDTO.GainDTOBuilder
builder()
boolean
equals(Object o)
CurrencyAmountDTO
getAmount()
Gain made (amount).List<CurrencyAmountDTO>
getClosingOrderFees()
Closing order fees (list coming from trade fees).CurrencyAmountDTO
getFees()
Deprecated.CurrencyAmountDTO
getNetAmount()
Deprecated.List<CurrencyAmountDTO>
getOpeningOrderFees()
Opening order fees (list coming from trade fees).Map<CurrencyDTO,CurrencyAmountDTO>
getOrdersFees()
Returns the sum of fees from opening and closing orders.double
getPercentage()
Gain made (percentage).int
hashCode()
boolean
isInferiorTo(@NonNull GainDTO other)
Returns true if the current gain is inferior to the gain passed as a parameter.boolean
isSuperiorTo(@NonNull GainDTO other)
Returns true if the current gain is superior to the gain passed as a parameter.String
toString()
-
-
-
Field Detail
-
ZERO
public static final GainDTO ZERO
Zero constant.
-
-
Method Detail
-
getNetAmount
@Deprecated public CurrencyAmountDTO getNetAmount()
Deprecated.Getter netAmount. This method cannot be used as fees are not necessary the same currency as value.- Returns:
- netAmount
-
getFees
@Deprecated public final CurrencyAmountDTO getFees()
Deprecated.Getter fees. This method should not be used anymore as a bug was found in issue 850. A gain is linked to a position and a position has an opening order and a closing order. the opening order trades and the closing order trades may have different currencies! So it's not possible to return only a CurrencyAmountDTO! Only a HashMap of currency and amount.- Returns:
- fees
-
getOrdersFees
public final Map<CurrencyDTO,CurrencyAmountDTO> getOrdersFees()
Returns the sum of fees from opening and closing orders.- Returns:
- fees
-
isInferiorTo
public boolean isInferiorTo(@NonNull @NonNull GainDTO other)
Returns true if the current gain is inferior to the gain passed as a parameter.- Parameters:
other
- other gain- Returns:
- true if this gain is inferior to the gain passed as a parameter
-
isSuperiorTo
public boolean isSuperiorTo(@NonNull @NonNull GainDTO other)
Returns true if the current gain is superior to the gain passed as a parameter.- Parameters:
other
- other gain- Returns:
- true if this gain is superior to the gain passed as a parameter
-
builder
public static GainDTO.GainDTOBuilder builder()
-
getPercentage
public double getPercentage()
Gain made (percentage).
-
getAmount
public CurrencyAmountDTO getAmount()
Gain made (amount).
-
getOpeningOrderFees
public List<CurrencyAmountDTO> getOpeningOrderFees()
Opening order fees (list coming from trade fees).
-
getClosingOrderFees
public List<CurrencyAmountDTO> getClosingOrderFees()
Closing order fees (list coming from trade fees).
-
-