API Reference

Get Last Symbol Price by Time

Get Last Symbol Price by Time

This endpoint allows users to retrieve the most recent price data for a specific trading pair within a given time limit.

🚨

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 Last Symbol Price

Method: GET
URL: /symbol-price/last Authentication: Required (API Key) Description: Returns the latest price data for the specified trading pair within the provided time limit.

Query Parameters

ParameterTypeRequiredDescription
pairstringYesThe trading pair (e.g., BTCUSDT)
slotstringNoThe price slot (default: "default")
limitTimeintegerNoThe maximum time limit in milliseconds

Request Example

curl --request GET \
     --url 'https://symbol-prices-api.mybroker.dev/symbol-price/last?pair=BTCUSDT&slot=default&limitTime=1738927401000' \
     --header 'Content-Type: application/json' \
     --header 'api-key: <your_api_key_here>'

Success Response (200)

If the requested time is in the future:

OK

If the requested time is in the past or present:

{
  "id": "01JNPEBH712140ZZ64QBTHA7V5",
  "slot": "default",
  "pair": "BTCUSDT",
  "type": "crypto",
  "time": 1741288751000,
  "volume": 0,
  "openPrice": 88182.83,
  "closePrice": 88169.33,
  "highPrice": 88203.14,
  "lowPrice": 88169.33,
  "createdAt": "2025-03-06T19:19:12.352Z",
  "updatedAt": "2025-03-06T19:19:12.352Z"
}

Response Fields

FieldTypeDescription
idstringUnique identifier for the price data
slotstringSlot name (e.g., "default")
pairstringTrading pair (e.g., BTCUSDT)
typestringAsset type (e.g., "crypto")
timeintegerTimestamp in milliseconds
volumenumberTrading volume (0 if unavailable)
openPricenumberOpening price of the asset
closePricenumberClosing price of the asset
highPricenumberHighest price recorded
lowPricenumberLowest price recorded
createdAtstringRecord creation timestamp (ISO 8601)
updatedAtstringRecord update timestamp (ISO 8601)

Possible Errors

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

Usage Example

To fetch the last symbol price using curl:

curl -X GET "https://symbol-prices-api.mybroker.dev/symbol-price/last?pair=BTCUSDT&slot=default&limitTime=1738927401000" \
  -H "Content-Type: application/json" \
  -H "api-key: <your_api_key_here>"

Using TypeScript with fetch:

async function fetchLastSymbolPrice(apiKey: string): Promise<void> {
  try {
    const response = await fetch("https://symbol-prices-api.mybroker.dev/symbol-price/last?pair=BTCUSDT&slot=default&limitTime=1738927401000", {
      method: "GET",
      headers: {
        "Content-Type": "application/json",
        "api-key": apiKey
      }
    });
    
    if (!response.ok) {
      throw new Error(`HTTP error! Status: ${response.status}`);
    }
    
    const data = await response.text();
    console.log("Last Symbol Price Response:", data);
  } catch (error) {
    console.error("Error fetching last symbol price:", error);
  }
}

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