Package org.knowm.xchange.ripple.service
Class RippleTradeService
- java.lang.Object
-
- org.knowm.xchange.service.BaseExchangeService
-
- org.knowm.xchange.ripple.service.RippleBaseService
-
- org.knowm.xchange.ripple.service.RippleTradeServiceRaw
-
- org.knowm.xchange.ripple.service.RippleTradeService
-
- All Implemented Interfaces:
BaseService
,TradeService
public class RippleTradeService extends RippleTradeServiceRaw implements TradeService
-
-
Field Summary
-
Fields inherited from class org.knowm.xchange.ripple.service.RippleBaseService
rippleAuthenticated, ripplePublic
-
Fields inherited from class org.knowm.xchange.service.BaseExchangeService
exchange
-
-
Constructor Summary
Constructors Constructor Description RippleTradeService(RippleExchange exchange)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
cancelOrder(String orderId)
cancels order with matching orderId (conveniance method, typical just delegate to cancelOrder(CancelOrderByIdParams))boolean
cancelOrder(CancelOrderParams orderParams)
cancels order with matching orderParamsOpenOrdersParams
createOpenOrdersParams()
CreateOpenOrdersParams
object specific to this exchange.RippleTradeHistoryParams
createTradeHistoryParams()
CreateTradeHistoryParams
object specific to this exchange.OpenOrders
getOpenOrders()
The additional data map of an order will be populated withRippleExchange.DATA_BASE_COUNTERPARTY
if the base currency is not XRP, similarly if the counter currency is not XRP thenRippleExchange.DATA_COUNTER_COUNTERPARTY
will be populated.OpenOrders
getOpenOrders(OpenOrdersParams params)
Gets the open ordersUserTrades
getTradeHistory(TradeHistoryParams params)
Ripple trade history is a request intensive process.String
placeLimitOrder(LimitOrder order)
Place a limit order-
Methods inherited from class org.knowm.xchange.ripple.service.RippleTradeServiceRaw
cancelOrder, clearOrderDetailsStore, getExpectedBaseTransferFee, getExpectedCounterTransferFee, getExpectedTransferFee, getNotifications, getOpenAccountOrders, getTrade, getTradesForAccount, getTransactionFee, placeOrder
-
Methods inherited from class org.knowm.xchange.service.BaseExchangeService
verifyOrder, verifyOrder, verifyOrder
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.knowm.xchange.service.trade.TradeService
changeOrder, getOrder, getOrder, placeMarketOrder, placeStopOrder, verifyOrder, verifyOrder
-
-
-
-
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 withRippleExchange.DATA_BASE_COUNTERPARTY
if the base currency is not XRP, similarly if the counter currency is not XRP thenRippleExchange.DATA_COUNTER_COUNTERPARTY
will be populated.- Specified by:
getOpenOrders
in interfaceTradeService
- 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
-
getOpenOrders
public OpenOrders getOpenOrders(OpenOrdersParams params) throws IOException
Description copied from interface:TradeService
Gets the open orders- Specified by:
getOpenOrders
in interfaceTradeService
- Parameters:
params
- The parameters describing the filter. Note thatOpenOrdersParams
is an empty interface. Exchanges should implement its own params object. Params should be create withTradeService.createOpenOrdersParams()
.- 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 orderIf your orders amount or limit price does to meet the restrictions dictated by
CurrencyPairMetaData
then the exchange will reject your order. UseOrderValuesHelper
to validate and / or adjust those values while you'r building an order.- Specified by:
placeLimitOrder
in interfaceTradeService
- 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 interfaceTradeService
- 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 interfaceTradeService
- 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:- RippleTradeHistoryHashLimit set the to the last known trade, this query will then terminate once it has been found.
- RippleTradeHistoryCount set the to restrict the number of trades to return, the
default is
RippleTradeHistoryCount.DEFAULT_TRADE_COUNT_LIMIT
. - RippleTradeHistoryCount set the to restrict the number of API calls that will be
made during a single trade history query, the default is
RippleTradeHistoryCount.DEFAULT_API_CALL_COUNT
. - TradeHistoryParamsTimeSpan set the
TradeHistoryParamsTimeSpan.setStartTime(java.util.Date)
to limit the number of trades searched for to those done since the given start time. TradeHistoryParamsTimeSpan
- Specified by:
getTradeHistory
in interfaceTradeService
- 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
-
createTradeHistoryParams
public RippleTradeHistoryParams createTradeHistoryParams()
Description copied from interface:TradeService
CreateTradeHistoryParams
object specific to this exchange. Object created by this method may be used to discover supported and requiredTradeService.getTradeHistory(TradeHistoryParams)
parameters and should be passed only to the method in the same class as the createTradeHistoryParams that created the object.- Specified by:
createTradeHistoryParams
in interfaceTradeService
-
createOpenOrdersParams
public OpenOrdersParams createOpenOrdersParams()
Description copied from interface:TradeService
CreateOpenOrdersParams
object specific to this exchange. Object created by this method may be used to discover supported and requiredTradeService.getOpenOrders(OpenOrdersParams)
parameters and should be passed only to the method in the same class as the createOpenOrdersParams that created the object.- Specified by:
createOpenOrdersParams
in interfaceTradeService
-
-