Class RippleTradeService

    • Constructor Detail

      • RippleTradeService

        public RippleTradeService​(RippleExchange exchange)
    • Method Detail

      • getOpenOrders

        public OpenOrders getOpenOrders()
                                 throws IOException
        The additional data map of an order will be populated with RippleExchange.DATA_BASE_COUNTERPARTY if the base currency is not XRP, similarly if the counter currency is not XRP then RippleExchange.DATA_COUNTER_COUNTERPARTY will be populated.
        Specified by:
        getOpenOrders in interface TradeService
        Returns:
        the open orders, null if some sort of error occurred. Implementers should log the error.
        Throws:
        IOException - - Indication that a networking error occurred while fetching JSON data
      • placeLimitOrder

        public String placeLimitOrder​(LimitOrder order)
                               throws IOException
        Description copied from interface: TradeService
        Place a limit order

        If your orders amount or limit price does to meet the restrictions dictated by CurrencyPairMetaData then the exchange will reject your order. Use OrderValuesHelper to validate and / or adjust those values while you'r building an order.

        Specified by:
        placeLimitOrder in interface TradeService
        Parameters:
        order - this should be a RippleLimitOrder object with the base and counter counterparties populated for any currency other than XRP.
        Returns:
        the order ID
        Throws:
        IOException - - Indication that a networking error occurred while fetching JSON data
        See Also:
        OrderValuesHelper
      • cancelOrder

        public boolean cancelOrder​(String orderId)
                            throws IOException
        Description copied from interface: TradeService
        cancels order with matching orderId (conveniance method, typical just delegate to cancelOrder(CancelOrderByIdParams))
        Specified by:
        cancelOrder in interface TradeService
        Returns:
        true if order was successfully cancelled, false otherwise.
        Throws:
        IOException - - Indication that a networking error occurred while fetching JSON data
      • cancelOrder

        public boolean cancelOrder​(CancelOrderParams orderParams)
                            throws IOException
        Description copied from interface: TradeService
        cancels order with matching orderParams
        Specified by:
        cancelOrder in interface TradeService
        Returns:
        true if order was successfully cancelled, false otherwise.
        Throws:
        IOException - - Indication that a networking error occurred while fetching JSON data
      • getTradeHistory

        public UserTrades getTradeHistory​(TradeHistoryParams params)
                                   throws IOException
        Ripple trade history is a request intensive process. The REST API does not provide a simple single trade history query. Trades are retrieved by querying account notifications and for those of type order details of the hash are then queried. These order detail queries could be order entry, cancel or execution, it is not possible to tell from the notification. Therefore if an account is entering many orders but executing few of them, this trade history query will result in many API calls without returning any trade history. In order to reduce the time and resources used in these repeated calls In order to reduce the number of API calls a number of different methods can be used:
        Specified by:
        getTradeHistory in interface TradeService
        Parameters:
        params - Can optionally implement , , , , TradeHistoryParamPaging, , TradeHistoryParamsTimeSpan. All other TradeHistoryParams types will be ignored.
        Returns:
        UserTrades as returned by the exchange API
        Throws:
        IOException - - Indication that a networking error occurred while fetching JSON data
        See Also:
        TradeService.createTradeHistoryParams(), TradeHistoryParamsAll