API Reference

Get Current Symbol Price

Get Current Symbol Price

This endpoint allows users to retrieve the latest price data for a specific trading pair.

🚨

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

Method: GET
URL: /symbol-price/default/{pair} Authentication: Required (API Key) Description: Returns the latest price data for the specified trading pair.

Path Parameters

ParameterTypeRequiredDescription
pairstringYesThe trading pair (e.g., BTCUSDT)

Request Example

curl --request GET \
     --url https://symbol-prices-api.mybroker.dev/symbol-price/default/BTCUSDT \
     --header 'api-key: <your_api_key_here>'

Success Response (200)

{
  "id": "01JNPDK6VJPTHG7JBT1M9E4J66",
  "slot": "default",
  "pair": "BTCUSDT",
  "type": "crypto",
  "time": 1741287954000,
  "volume": 0,
  "openPrice": 88232.89,
  "closePrice": 88234.63,
  "highPrice": 88234.63,
  "lowPrice": 88225.87,
  "createdAt": "2025-03-06T19:05:55.313Z",
  "updatedAt": "2025-03-06T19:05:55.313Z"
}

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 symbol price using curl:

curl -X GET "https://symbol-prices-api.mybroker.dev/symbol-price/default/BTCUSDT" \
  -H "api-key: <your_api_key_here>"

Using TypeScript with fetch:

async function fetchSymbolPrice(apiKey: string): Promise<void> {
  try {
    const response = await fetch("https://symbol-prices-api.mybroker.dev/symbol-price/default/BTCUSDT", {
      method: "GET",
      headers: {
        "api-key": apiKey
      }
    });
    
    if (!response.ok) {
      throw new Error(`HTTP error! Status: ${response.status}`);
    }
    
    const data = await response.json();
    console.log("Symbol Price:", data);
  } catch (error) {
    console.error("Error fetching symbol price:", error);
  }
}

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