LiquidityPoolTradesRequestBuilder class

Builds requests to query trades for a specific liquidity pool from Horizon.

This builder retrieves all trades executed against a specific liquidity pool. Trades represent exchanges between the two assets in the pool, showing the amounts traded, prices, and participating accounts.

This builder requires a pool ID to be specified using forPoolId. It supports pagination and ordering but does not support streaming.

Example:

// Get recent trades for a specific pool
final trades = await sdk.liquidityPoolTrades
    .forPoolId('pool_id_here')
    .order(RequestBuilderOrder.DESC)
    .limit(20)
    .execute();

for (var trade in trades.records) {
  print('Trade: ${trade.baseAmount} for ${trade.counterAmount}');
}

See also:

Inheritance

Constructors

LiquidityPoolTradesRequestBuilder(Client httpClient, Uri serverURI)
Creates a LiquidityPoolTradesRequestBuilder for querying liquidity pool trades from Horizon.

Properties

hashCode → int
The hash code for this object.
no setterinherited
httpClient ↔ Client
getter/setter pairinherited
queryParameters ↔ Map<String, String>
getter/setter pairinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
uriBuilder ↔ Uri
getter/setter pairinherited

Methods

buildUri() → Uri
Constructs the complete URI for the API request.
inherited
cursor(String token) → LiquidityPoolTradesRequestBuilder
Sets the cursor for pagination to start returning records from a specific point. Returns this builder for method chaining.
override
encodeAsset(Asset asset) → String
Encodes an asset to its string representation for API requests.
inherited
encodeAssets(List<Asset> assets) → String
Encodes a list of assets to comma-separated string for API requests.
inherited
execute() → Future<Page<TradeResponse>>
Build and execute request.
forPoolId(String poolId) → LiquidityPoolTradesRequestBuilder
Sets the liquidity pool to retrieve trades for by poolId.
limit(int number) → LiquidityPoolTradesRequestBuilder
Sets the maximum number of records to return in a single page. Returns this builder for method chaining.
override
liquidityPoolTrades(Uri uri) → Future<TradeResponse>
Requests specific uri and returns TradeResponse. This method is helpful for getting the links.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
order(RequestBuilderOrder direction) → LiquidityPoolTradesRequestBuilder
Sets the sort order for returned records (ascending or descending). Returns this builder for method chaining.
override
setSegments(List<String> segments) → RequestBuilder
Sets the URL path segments for this request.
inherited
streamEvents<T>(T fromJson(dynamic json)) → Stream<T>
Opens a stream of Server-Sent Events on the URI built by this builder and emits one T per received record, parsed with fromJson.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

requestExecute(Client httpClient, Uri uri) → Future<Page<TradeResponse>>
Requests specific uri and returns Page of TradeResponse. This method is helpful for getting the next set of results.
override