Stellar PHP SDK API Documentation

TradesPageResponse extends PageResponse

Paginated collection of trades from Horizon API

This response represents a single page of executed trades returned by Horizon's trade endpoints. Each page contains a collection of trade records representing completed exchanges on the Stellar distributed exchange (DEX), along with pagination links to navigate forward and backward through the complete result set.

Trades represent executed transactions where one asset was exchanged for another, including the accounts involved, assets traded, amounts, price, and timestamp. The response follows Horizon's standard pagination pattern with cursor-based navigation.

Returned by Horizon endpoints:

  • GET /trades - All trades on the DEX
  • GET /accounts/{account_id}/trades - Trades involving an account
  • GET /liquidity_pools/{liquidity_pool_id}/trades - Trades involving a liquidity pool
  • GET /offers/{offer_id}/trades - Trades that filled a specific offer
Tags
see
PageResponse

For pagination functionality

see
TradesResponse

For the collection of trades in this page

see
TradeResponse

For individual trade details

see
https://developers.stellar.org

Stellar developer docs Horizon Trades List API

Table of Contents

Properties

$httpClient  : Client|null
$rateLimitLimit  : int|null
$rateLimitRemaining  : int|null
$rateLimitReset  : int|null

Methods

fromJson()  : TradesPageResponse
Creates a TradesPageResponse from JSON data
getHttpClient()  : Client|null
Gets the HTTP client used for pagination requests
getLinks()  : PagingLinksResponse
Gets the pagination links for navigating between pages
getNextPage()  : TradesPageResponse|null
Fetches the next page of trades
getPreviousPage()  : TradesPageResponse|null
Fetches the previous page of trades
getRateLimitLimit()  : int|null
Returns X-RateLimit-Limit header from the response.
getRateLimitRemaining()  : int|null
Returns X-RateLimit-Remaining header from the response.
getRateLimitReset()  : int|null
Returns X-RateLimit-Reset header from the response. Seconds until a new window starts.
getTrades()  : TradesResponse
Gets the collection of trades in this page
hasNextPage()  : bool
Checks if a next page exists
hasPrevPage()  : bool
Checks if a previous page exists
setHeaders()  : void
Extracts and sets rate limiting information from HTTP response headers
setHttpClient()  : void
Sets the HTTP client for making follow-up requests
executeRequest()  : Response|null
getNextPageUrl()  : string|null
getPrevPageUrl()  : string|null
loadFromJson()  : void
Loads response data from a JSON array

Properties

$httpClient

protected Client|null $httpClient = null

$rateLimitLimit

protected int|null $rateLimitLimit = null

$rateLimitRemaining

protected int|null $rateLimitRemaining = null

$rateLimitReset

protected int|null $rateLimitReset = null

Methods

fromJson()

Creates a TradesPageResponse from JSON data

public static fromJson(array<string|int, mixed> $json) : TradesPageResponse
Parameters
$json : array<string|int, mixed>

Associative array of parsed JSON response

Return values
TradesPageResponse

The populated page response

getHttpClient()

Gets the HTTP client used for pagination requests

public getHttpClient() : Client|null
Return values
Client|null

The HTTP client instance, or null if not set

getRateLimitLimit()

Returns X-RateLimit-Limit header from the response.

public getRateLimitLimit() : int|null

This number represents the he maximum number of requests that the current client can make in one hour.

Tags
see
https://developers.stellar.org

Stellar developer docs Rate limiting documentation

Return values
int|null

getRateLimitRemaining()

Returns X-RateLimit-Remaining header from the response.

public getRateLimitRemaining() : int|null

The number of remaining requests for the current window.

Tags
see
https://developers.stellar.org

Stellar developer docs Rate limiting documentation

Return values
int|null

getRateLimitReset()

Returns X-RateLimit-Reset header from the response. Seconds until a new window starts.

public getRateLimitReset() : int|null
Tags
see
https://developers.stellar.org

Stellar developer docs Rate limiting documentation

Return values
int|null

hasNextPage()

Checks if a next page exists

public hasNextPage() : bool
Return values
bool

True if there is a next page available

hasPrevPage()

Checks if a previous page exists

public hasPrevPage() : bool
Return values
bool

True if there is a previous page available

setHeaders()

Extracts and sets rate limiting information from HTTP response headers

public setHeaders(array<string|int, mixed> $headers) : void

This method processes the X-Ratelimit-* headers from the HTTP response and stores them for client access.

Parameters
$headers : array<string|int, mixed>

Associative array of HTTP headers from the response

setHttpClient()

Sets the HTTP client for making follow-up requests

public setHttpClient([Client|null $httpClient = null ]) : void

Paginated responses contain links to next/previous pages. This HTTP client is used when following those links to fetch additional pages.

Parameters
$httpClient : Client|null = null

The Guzzle HTTP client to use for pagination

getNextPageUrl()

protected getNextPageUrl() : string|null
Return values
string|null

getPrevPageUrl()

protected getPrevPageUrl() : string|null
Return values
string|null

loadFromJson()

Loads response data from a JSON array

protected loadFromJson(array<string|int, mixed> $json) : void

This method is used internally to populate response objects from parsed JSON. Subclasses override this to extract their specific data fields.

Parameters
$json : array<string|int, mixed>

Associative array of parsed JSON data


        
On this page

Search results