Skip to main content

The Trade Aggregation Object

When Horizon returns information about a trade aggregation, it uses the following format:

  • ATTRIBUTEDATA TYPE

    DESCRIPTION

  • timestampstring

    Start time for this trade aggregation. Represented as milliseconds since epoch.

  • trade_countinteger

    Total number of trades aggregated.

  • base_volumestring

    Total volume of base asset.

  • counter_volumestring

    Total volume of counter asset.

  • avgstring

    Weighted average price of counter asset in terms of base asset.

  • highstring

    The highest price for this time period.

  • high_robject

    The highest price for this time period as a rational number.

    Show child attributes
  • nnumber

    The numerator.

  • dnumber

    The denominator.

  • lowstring

    The lowest price for this time period.

  • low_robject

    The lowest price for this time period as a rational number.

    Show child attributes
  • nnumber

    The numerator.

  • pnumber

    The denominator.

  • openstring

    The price as seen on first trade aggregated.

  • open_robject

    The price as seen on first trade aggregated as a rational number.

    Show child attributes
  • nnumber

    The numerator.

  • pnumber

    The denominator.

  • closestring

    The price as seen on last trade aggregated.

  • close_robject

    The price as seen on last trade aggregated as a rational number.

    Show child attributes
  • nnumber

    The numerator.

  • pnumber

    The denominator.

  • Example
    {
    "_links": {
    "self": {
    "href": "https://horizon-testnet.stellar.org/trade_aggregations?base_asset_type=native\u0026counter_asset_code=NGNT\u0026counter_asset_issuer=GAWODAROMJ33V5YDFY3NPYTHVYQG7MJXVJ2ND3AOGIHYRWINES6ACCPD\u0026counter_asset_type=credit_alphanum4\u0026limit=200\u0026order=asc\u0026resolution=3600000\u0026start_time=1582156800000\u0026end_time=1582178400000"
    },
    "next": {
    "href": "https://horizon-testnet.stellar.org/trade_aggregations?base_asset_type=native\u0026counter_asset_code=NGNT\u0026counter_asset_issuer=GAWODAROMJ33V5YDFY3NPYTHVYQG7MJXVJ2ND3AOGIHYRWINES6ACCPD\u0026counter_asset_type=credit_alphanum4\u0026end_time=1582178400000\u0026limit=200\u0026order=asc\u0026resolution=3600000\u0026start_time=1582178400000"
    },
    "prev": {
    "href": ""
    }
    },
    "_embedded": {
    "records": [
    {
    "timestamp": 1582156800000,
    "trade_count": 9,
    "base_volume": "3487.4699458",
    "counter_volume": "88675.3982178",
    "avg": "25.4268566",
    "high": "25.7603393",
    "high_r": {
    "N": 257603393,
    "D": 10000000
    },
    "low": "25.3804530",
    "low_r": {
    "N": 25380453,
    "D": 1000000
    },
    "open": "25.3990186",
    "open_r": {
    "N": 2500000,
    "D": 98429
    },
    "close": "25.7090558",
    "close_r": {
    "N": 1250000,
    "D": 48621
    }
    },
    {
    "timestamp": 1582160400000,
    "trade_count": 1,
    "base_volume": "0.1058787",
    "counter_volume": "2.7155348",
    "avg": "25.6476024",
    "high": "25.6476019",
    "high_r": {
    "N": 100000,
    "D": 3899
    },
    "low": "25.6476019",
    "low_r": {
    "N": 100000,
    "D": 3899
    },
    "open": "25.6476019",
    "open_r": {
    "N": 100000,
    "D": 3899
    },
    "close": "25.6476019",
    "close_r": {
    "N": 100000,
    "D": 3899
    }
    },
    {
    "timestamp": 1582164000000,
    "trade_count": 15,
    "base_volume": "3992.1321821",
    "counter_volume": "99702.0620798",
    "avg": "24.9746395",
    "high": "25.6764460",
    "high_r": {
    "N": 5000000,
    "D": 194731
    },
    "low": "24.9291379",
    "low_r": {
    "N": 249291379,
    "D": 10000000
    },
    "open": "25.6764460",
    "open_r": {
    "N": 5000000,
    "D": 194731
    },
    "close": "25.0055050",
    "close_r": {
    "N": 5001101,
    "D": 200000
    }
    },
    {
    "timestamp": 1582167600000,
    "trade_count": 4,
    "base_volume": "278.4950271",
    "counter_volume": "7047.6740325",
    "avg": "25.3062832",
    "high": "25.3844475",
    "high_r": {
    "N": 5000000,
    "D": 196971
    },
    "low": "25.2923181",
    "low_r": {
    "N": 252923181,
    "D": 10000000
    },
    "open": "25.2923181",
    "open_r": {
    "N": 252923181,
    "D": 10000000
    },
    "close": "25.3844475",
    "close_r": {
    "N": 5000000,
    "D": 196971
    }
    },
    {
    "timestamp": 1582174800000,
    "trade_count": 1,
    "base_volume": "9.9379734",
    "counter_volume": "252.7685174",
    "avg": "25.4346140",
    "high": "25.4346140",
    "high_r": {
    "N": 254346140,
    "D": 10000000
    },
    "low": "25.4346140",
    "low_r": {
    "N": 254346140,
    "D": 10000000
    },
    "open": "25.4346140",
    "open_r": {
    "N": 254346140,
    "D": 10000000
    },
    "close": "25.4346140",
    "close_r": {
    "N": 254346140,
    "D": 10000000
    }
    }
    ]
    }
    }