public class TradesRequestBuilder extends RequestBuilder
RequestBuilder.Order
Constructor and Description |
---|
TradesRequestBuilder(okhttp3.OkHttpClient httpClient,
okhttp3.HttpUrl serverURI) |
Modifier and Type | Method and Description |
---|---|
TradesRequestBuilder |
baseAsset(Asset asset) |
TradesRequestBuilder |
counterAsset(Asset asset) |
TradesRequestBuilder |
cursor(java.lang.String token)
Sets
cursor parameter on the request. |
Page<TradeResponse> |
execute()
Build and execute request.
|
static Page<TradeResponse> |
execute(okhttp3.OkHttpClient httpClient,
okhttp3.HttpUrl uri)
|
TradesRequestBuilder |
forAccount(@NonNull java.lang.String account)
Builds request to
GET /accounts/{account}/trades |
TradesRequestBuilder |
forLiquidityPool(java.lang.String liquidityPoolId)
Builds request to
GET /liquidity_pools/{poolID}/trades |
TradesRequestBuilder |
forTradeType(@NonNull java.lang.String tradeType)
Returns all trades that of a specific type.
|
TradesRequestBuilder |
limit(int number)
Sets
limit parameter on the request. |
TradesRequestBuilder |
offerId(java.lang.Long offerId) |
SSEStream<TradeResponse> |
stream(EventListener<TradeResponse> listener)
An overloaded version of
stream(EventListener, long) with default reconnect timeout. |
SSEStream<TradeResponse> |
stream(EventListener<TradeResponse> listener,
long reconnectTimeout)
Allows to stream SSE events from horizon.
|
order, setAssetParameter, setAssetsParameter
public TradesRequestBuilder(okhttp3.OkHttpClient httpClient, okhttp3.HttpUrl serverURI)
public TradesRequestBuilder baseAsset(Asset asset)
public TradesRequestBuilder counterAsset(Asset asset)
public TradesRequestBuilder forAccount(@NonNull @NonNull java.lang.String account)
GET /accounts/{account}/trades
account
- Account for which to get tradespublic TradesRequestBuilder forLiquidityPool(java.lang.String liquidityPoolId)
GET /liquidity_pools/{poolID}/trades
liquidityPoolId
- Liquidity pool for which to get tradespublic TradesRequestBuilder forTradeType(@NonNull @NonNull java.lang.String tradeType)
tradeType
- typeTradesRequestBuilder
instancepublic static Page<TradeResponse> execute(okhttp3.OkHttpClient httpClient, okhttp3.HttpUrl uri)
httpClient
- OkHttpClient
to use to send the request.uri
- HttpUrl
URI to send the request to.Page
of TradeResponse
NetworkException
- All the exceptions below are subclasses of
NetworkErrorBadRequestException
- if the request fails due to a bad request
(4xx)BadResponseException
- if the request fails due to a bad
response from the server (5xx)TooManyRequestsException
- if the request fails due to too many requests sent to the
serverRequestTimeoutException
- When Horizon returns a Timeout
or connection timeout occurredUnknownResponseException
- if the server returns an unknown
status codeConnectionErrorException
- When the request cannot be executed
due to cancellation or connectivity problems, etc.public Page<TradeResponse> execute()
Page
of TradeResponse
NetworkException
- All the exceptions below are subclasses of
NetworkErrorBadRequestException
- if the request fails due to a bad request
(4xx)BadResponseException
- if the request fails due to a bad
response from the server (5xx)TooManyRequestsException
- if the request fails due to too many requests sent to the
serverRequestTimeoutException
- When Horizon returns a Timeout
or connection timeout occurredUnknownResponseException
- if the server returns an unknown
status codeConnectionErrorException
- When the request cannot be executed
due to cancellation or connectivity problems, etc.public TradesRequestBuilder offerId(java.lang.Long offerId)
public TradesRequestBuilder cursor(java.lang.String token)
RequestBuilder
cursor
parameter on the request. A cursor is a value that points to a
specific location in a collection of resources. The cursor attribute itself is an opaque value
meaning that users should not try to parse it.cursor
in class RequestBuilder
token
- A cursor is a value that points to a specific location in a collection of
resources.public TradesRequestBuilder limit(int number)
RequestBuilder
limit
parameter on the request. It defines maximum number of records to
return. For range and default values check documentation of the endpoint requested.limit
in class RequestBuilder
number
- maxium number of records to returnpublic SSEStream<TradeResponse> stream(EventListener<TradeResponse> listener, long reconnectTimeout)
listener
- EventListener
implementation with TradeResponse
typereconnectTimeout
- Custom stream connection timeout in msclose()
connection when not needed anymorepublic SSEStream<TradeResponse> stream(EventListener<TradeResponse> listener)
stream(EventListener, long)
with default reconnect timeout.