Class GainDTO


  • public final class GainDTO
    extends Object
    Gain.
    • 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
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class Object
      • getPercentage

        public double getPercentage()
        Gain made (percentage).
      • 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).