API Reference

Get Aggregated Prices

Get Aggregated Prices

This endpoint allows users to retrieve aggregated historical price data for a specific trading pair within a defined time range.

🚨

ATTENTION: You MUST Understandslot and api-key Before Using the API! 🚨

Before making any API requests, it's critical to understand how the slot and api-key parameters work. These values ensure that your requests retrieve the correct data and are properly authenticated.

📖 Click here to read the full explanation → Understanding slot and api-key

Authentication

This endpoint requires an API KEY token. The token must be sent in the api-key header.

Example:

api-key: <your_api_key_here>

If the token is invalid or missing, the API will return:

{
  "statusCode": 401,
  "message": "Unauthorized"
}

Endpoints

Retrieve Aggregated Prices

Method: GET
URL: /aggregated-prices/prices Authentication: Required (API Key) Description: Returns aggregated price data for the specified trading pair within the given time range.

Query Parameters

ParameterTypeRequiredDescription
pairstringYesThe trading pair (e.g., BTCUSDT)
slotstringNoThe price slot (default: "default")
typestringYesThe asset type (e.g., "crypto")
intervalstringYesTime interval for aggregation (e.g., "1m")
skipintegerNoNumber of records to skip (default: 0)
limitintegerNoMaximum number of records to return (default: 1000)
startTimeintegerYesStart time in milliseconds
endTimeintegerYesEnd time in milliseconds

Request Example

curl --request GET \
     --url 'https://symbol-prices-api.mybroker.dev/aggregated-prices/prices?slot=default&pair=BTCUSDT&type=crypto&interval=1m&skip=0&limit=1000&startTime=1733054445000&endTime=1733691937954' \
     --header 'api-key: <your_api_key_here>'

Success Response (200)

[
  {
    "volume": 0,
    "openPrice": 100063.99,
    "closePrice": 100058.82,
    "highPrice": 100066.66,
    "lowPrice": 100058.82,
    "time": 1733688300000
  },
  {
    "volume": 0,
    "openPrice": 100058.82,
    "closePrice": 100084.01,
    "highPrice": 100107.99,
    "lowPrice": 100058.82,
    "time": 1733688360000
  }
]

Response Fields

FieldTypeDescription
volumenumberTrading volume
openPricenumberOpening price of the asset
closePricenumberClosing price of the asset
highPricenumberHighest price recorded
lowPricenumberLowest price recorded
timeintegerTimestamp in milliseconds

Possible Errors

Status CodeMessageDescription
401UnauthorizedAPI Key is missing or invalid
404Not FoundTrading pair not found
500Internal Server ErrorUnexpected server error

Usage Example

To fetch aggregated prices using curl:

curl -X GET "https://symbol-prices-api.mybroker.dev/aggregated-prices/prices?slot=default&pair=BTCUSDT&type=crypto&interval=1m&skip=0&limit=1000&startTime=1733054445000&endTime=1733691937954" \
  -H "api-key: <your_api_key_here>"

Using TypeScript with fetch:

async function fetchAggregatedPrices(apiKey: string): Promise<void> {
  try {
    const response = await fetch("https://symbol-prices-api.mybroker.dev/aggregated-prices/prices?slot=default&pair=BTCUSDT&type=crypto&interval=1m&skip=0&limit=1000&startTime=1733054445000&endTime=1733691937954", {
      method: "GET",
      headers: {
        "api-key": apiKey
      }
    });
    
    if (!response.ok) {
      throw new Error(`HTTP error! Status: ${response.status}`);
    }
    
    const data = await response.json();
    console.log("Aggregated Prices:", data);
  } catch (error) {
    console.error("Error fetching aggregated prices:", error);
  }
}

// Usage example:
fetchAggregatedPrices("<your_api_key_here>");
Language
Click Try It! to start a request and see the response here!