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
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 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
Parameter | Type | Required | Description |
---|---|---|---|
pair | string | Yes | The trading pair (e.g., BTCUSDT) |
slot | string | No | The price slot (default: "default") |
limitTime | integer | No | The 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
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 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>");