get https://symbol-prices-api.mybroker.dev/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
andapi-key
Before Using the API! 🚨
Before making any API requests, it's critical to understand how the
slot
andapi-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
andapi-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
Parameter | Type | Required | Description |
---|---|---|---|
pair | string | Yes | The 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
Field | Type | Description |
---|---|---|
id | string | Unique identifier for the price data |
slot | string | Slot name (e.g., "default") |
pair | string | Trading pair (e.g., BTCUSDT) |
type | string | Asset type (e.g., "crypto") |
time | integer | Timestamp in milliseconds |
volume | number | Trading volume (0 if unavailable) |
openPrice | number | Opening price of the asset |
closePrice | number | Closing price of the asset |
highPrice | number | Highest price recorded |
lowPrice | number | Lowest price recorded |
createdAt | string | Record creation timestamp (ISO 8601) |
updatedAt | string | Record update timestamp (ISO 8601) |
Possible Errors
Status Code | Message | Description |
---|---|---|
401 | Unauthorized | API Key is missing or invalid |
404 | Not Found | Trading pair not found |
500 | Internal Server Error | Unexpected 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>");