Class Order

    • Constructor Detail

      • Order

        public Order​(Order.OrderType type,
                     BigDecimal originalAmount,
                     Instrument instrument,
                     String id,
                     Date timestamp)
        Parameters:
        type - Either BID (buying) or ASK (selling)
        originalAmount - The amount to trade
        currencyPair - currencyPair The identifier (e.g. BTC/USD)
        id - An id (usually provided by the exchange)
        timestamp - the absolute time for this order according to the exchange's server, null if not provided
      • Order

        public Order​(Order.OrderType type,
                     BigDecimal originalAmount,
                     Instrument instrument,
                     String id,
                     Date timestamp,
                     BigDecimal averagePrice,
                     BigDecimal cumulativeAmount,
                     BigDecimal fee,
                     Order.OrderStatus status)
        Parameters:
        type - Either BID (buying) or ASK (selling)
        originalAmount - The amount to trade
        instrument - The identifier (e.g. BTC/USD)
        id - An id (usually provided by the exchange)
        timestamp - the absolute time for this order according to the exchange's server, null if not provided
        averagePrice - the averagePrice of fill belonging to the order
        cumulativeAmount - the amount that has been filled
        fee - the fee associated with this order
        status - the status of the order at the exchange
      • Order

        public Order​(Order.OrderType type,
                     BigDecimal originalAmount,
                     Instrument instrument,
                     String id,
                     Date timestamp,
                     BigDecimal averagePrice,
                     BigDecimal cumulativeAmount,
                     BigDecimal fee,
                     Order.OrderStatus status,
                     String userReference)
        Parameters:
        type - Either BID (buying) or ASK (selling)
        originalAmount - The amount to trade
        instrument - The identifier (e.g. BTC/USD)
        id - An id (usually provided by the exchange)
        timestamp - the absolute time for this order according to the exchange's server, null if not provided
        averagePrice - the averagePrice of fill belonging to the order
        cumulativeAmount - the amount that has been filled
        fee - the fee associated with this order
        status - the status of the order at the exchange
        userReference - a reference provided by the user to identify the order
    • Method Detail

      • getFee

        public BigDecimal getFee()
        The total of the fees incurred for all transactions related to this order
        Returns:
        null if this information is not available on the order level on the given exchange in which case you will have to navigate trades which filled this order to calculate it
      • getType

        public Order.OrderType getType()
        Returns:
        The type (BID or ASK)
      • getStatus

        public Order.OrderStatus getStatus()
        Returns:
        The type (PENDING_NEW, NEW, PARTIALLY_FILLED, FILLED, PENDING_CANCEL, CANCELED, PENDING_REPLACE, REPLACED, STOPPED, REJECTED or EXPIRED)
      • getOriginalAmount

        public BigDecimal getOriginalAmount()
        The amount to trade
      • getCumulativeAmount

        public BigDecimal getCumulativeAmount()
        The amount that has been filled
      • setCumulativeAmount

        public void setCumulativeAmount​(BigDecimal cumulativeAmount)
      • getCumulativeCounterAmount

        public BigDecimal getCumulativeCounterAmount()
      • getRemainingAmount

        public BigDecimal getRemainingAmount()
        Returns:
        The remaining order amount
      • getAveragePrice

        public BigDecimal getAveragePrice()
        The average price of the fills in the order.
        Returns:
        null if this information is not available on the order level on the given exchange in which case you will have to navigate trades which filled this order to calculate it
      • setAveragePrice

        public void setAveragePrice​(BigDecimal averagePrice)
      • getCurrencyPair

        @Deprecated
        public CurrencyPair getCurrencyPair()
        Deprecated.
        CurrencyPair is a subtype of Instrument - this method will throw an exception if the order was for a derivative

        use getInstrument() instead

      • getInstrument

        public Instrument getInstrument()
        Returns:
        The instrument to be bought or sold
      • getId

        public String getId()
        Returns:
        A unique identifier (normally provided by the exchange)
      • getUserReference

        public String getUserReference()
        Returns:
        A unique identifier provided by the user on placement
      • getTimestamp

        public Date getTimestamp()
      • getLeverage

        public String getLeverage()
      • setLeverage

        public void setLeverage​(String leverage)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object