Skip to main content

List Trade Aggregations

GET 

https://horizon-testnet.stellar.org/trade_aggregations

This endpoint displays trade data based on filters set in the arguments.

This is done by dividing a given time range into segments and aggregating statistics, for a given asset pair (base, counter) over each of these segments.

The duration of the segments is specified with the resolution parameter. The start and end of the time range are given by startTime and endTime respectively, which are both rounded to the nearest multiple of resolution since epoch.

The individual segments are also aligned with multiples of resolution since epoch. If you want to change this alignment, the segments can be offset by specifying the offset parameter.

Request

Query Parameters

    start_time long

    The lower time boundary represented as milliseconds since epoch.

    end_time long

    The upper time boundary represented as milliseconds since epoch.

    resolution long

    The segment duration represented as milliseconds. Supported values are 1 minute (60000), 5 minutes (300000), 15 minutes (900000), 1 hour (3600000), 1 day (86400000) and 1 week (604800000).

    offset long

    Segments can be offset using this parameter. Expressed in milliseconds. Can only be used if the resolution is greater than 1 hour. Value must be in whole hours, less than the provided resolution, and less than 24 hours.

    base_asset_type stringrequired

    Possible values: [native, credit_alphanum4, credit_alphanum12]

    The type for the base asset. Either native, credit_alphanum4, or credit_alphanum12.

    base_asset_issuer string

    The Stellar address of the base asset’s issuer. Required if the base_asset_type is not native.

    base_asset_code string

    The code for the base asset. Required if the base_asset_type is not native.

    counter_asset_type stringrequired

    Possible values: [native, credit_alphanum4, credit_alphanum12]

    The type for the counter asset. Either native, credit_alphanum4, or credit_alphanum12.

    counter_asset_issuer string

    The Stellar address of the counter asset’s issuer. Required if the counter_asset_type is not native.

    counter_asset_code string

    The code for the counter asset. Required if the counter_asset_type is not native.

    order string

    Possible values: [asc, desc]

    A designation of the order in which records should appear. Options include asc (ascending) or desc (descending). If this argument isn’t set, it defaults to asc.

    limit integer

    The maximum number of records returned. The limit can range from 1 to 200 - an upper limit that is hardcoded in Horizon for performance reasons. If this argument isn’t designated, it defaults to 10.

Responses

Success

Schema
    _embedded object
    records object[]
  • Array [
  • timestampstring
    trade_countstring
    base_volumestring
    counter_volumestring
    avgstring
    highstring
    high_r object
    nstring
    dstring
    lowstring
    low_r object
    nstring
    dstring
    openstring
    open_r object
    nstring
    dstring
    closestring
    close_r object
    nstring
    dstring
  • ]
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://horizon-testnet.stellar.org/trade_aggregations");
request.Headers.Add("Accept", "application/json");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
Request Collapse all
Base URL
https://horizon-testnet.stellar.org
Parameters
— queryrequired
— queryrequired
— query
— query
— query
— query
— query
— query
— query
— query
— query
— query
ResponseClear

Click the Send API Request button above and see the response here!

Did you find this page helpful?