POSTget_aggregate_price

XRP Ledger Mainnethttps://xrpl-mainnet.nodit.io/

Aggregates the prices from multiple Price Oracles and returns the mean, median and trimmed mean. Specify trim to obtain statistics with outliers excluded.

Request Body
methodstringrequired
base_assetstringrequired

The currency code of the asset being priced.

quote_assetstringrequired

The currency code used to quote the base asset price.

oraclesobject[]required

The Oracles to aggregate. Pass between 1 and 200 of them.

accountstringrequired

The address of the account that owns the Oracle.

oracle_document_idintegerrequired

The number that identifies the Oracle within the account.

triminteger

The percentage of outliers to remove. Pass a value between 1 and 25. Providing this value adds trimmed_set to the response.

trim_thresholdinteger

The cutoff time used to exclude older prices from the aggregation, in seconds. Pass 0 to apply no time-based filter.

Responses
meanstring

The arithmetic mean.

sizeinteger

The number of data points used to compute the mean.

standard_deviationstring

The standard deviation of the price distribution.

meanstring

The arithmetic mean with outliers excluded.

sizeinteger

The number of data points with outliers excluded.

standard_deviationstring

The standard deviation of the price distribution with outliers excluded.

medianstring

The median of the prices collected.

timeinteger

The most recent update time among the Oracles used, in Unix timestamp seconds.

X-API-KEY
RequestCU150
cURL
curl -X POST "https://xrpl-mainnet.nodit.io/" \
  -H "X-API-KEY: {YOUR_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
  "method": "get_aggregate_price",
  "params": [
    {
      "base_asset": "XRP",
      "quote_asset": "USD",
      "oracles": [
        {
          "account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
          "oracle_document_id": 1
        }
      ],
      "trim": 20
    }
  ]
}'
Response
Example · 200
{
  "result": {
    "entire_set": {
      "mean": "0.00051",
      "size": 3,
      "standard_deviation": "0.0000115"
    },
    "median": "0.00051",
    "time": 1772000000,
    "trimmed_set": {
      "mean": "0.00051",
      "size": 1,
      "standard_deviation": "0"
    }
  }
}