View Source Stellar.Horizon.TradeAggregations (Elixir Stellar SDK v0.22.0)

Exposes functions to interact with TradeAggregations in Horizon.

You can:

  • List trade aggregation data based on filters set in the arguments

Horizon API reference: https://developers.stellar.org/api/aggregations/trade-aggregations/

Summary

Functions

List trade aggregation data based on filters set in the arguments.

Types

Functions

Link to this function

list_trade_aggregations(server, args \\ [])

View Source
@spec list_trade_aggregations(server :: server(), args :: args()) :: response()

List trade aggregation data based on filters set in the arguments.

## Parameters

* `server`: The Horizon server to query.
* `base_asset`: `:native` or `[code: "base_asset_code", issuer: "base_asset_issuer"]`
* `counter_asset`: `:native` or `[code: "counter_asset_code", issuer: "counter_asset_issuer"]`
* `resolution`: The segment duration represented as milliseconds.

## Options

* `start_time`: The lower time boundary represented as milliseconds since epoch.
* `end_time`: The upper time boundary represented as milliseconds since epoch.
* `offset`: Segments can be offset using this parameter. Expressed in milliseconds.
* `order`: A designation of the order in which records should appear.
* `limit`: The maximum number of records returned.

## Examples

  iex> TradeAggregations.list_trade_aggregations(
    Stellar.Horizon.Server.testnet(),
     base_asset: :native,
     counter_asset: :native,
     resolution: "60000"
    )
  {:ok, %Collection{records: [%TradeAggregation{}, ...]}}

  iex> TradeAggregations.list_trade_aggregations(
    Stellar.Horizon.Server.testnet(),
     base_asset: :native,
     counter_asset: [
       code: "EURT",
       issuer: "GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S"
     ],
     resolution: "3600000",
     start_time: "1582156800000",
     end_time: "1582178400000"
    )
  {:ok, %Collection{records: [%TradeAggregation{}, ...]}}