Removed
v1.2.0 - 2025-01-10
14 days ago by ReadMe CLI
⚠️ Removed - WebSocket Method
Deprecated get_last_trades_by_instrument WebSocket Method
get_last_trades_by_instrument WebSocket MethodThe get_last_trades_by_instrument WebSocket method has been removed. This method was previously used to retrieve historical trade data through the WebSocket connection.
Migration Guide
Use the REST API endpoint instead:
// Before (WebSocket)
ws.send(
JSON.stringify({
type: 'get_last_trades_by_instrument',
instrument_name: 'BTC_USDC-29AUG25-106000-C',
start_timestamp: 1677721600000,
end_timestamp: 1677808000000,
}),
);
// After (REST API)
const response = await fetch(
`/last_trades_by_instrument?instrument_name=${instrumentName}&start_timestamp=${startTimestamp}&end_timestamp=${endTimestamp}`,
{
headers: {
'x-apikey': API_KEY,
'Content-Type': 'application/json',
},
},
);
const trades = await response.json();Benefits
- Better Performance: REST API is optimized for historical data queries
- Caching: REST responses can be cached by CDNs and browsers
- Simpler Integration: No need to maintain WebSocket connection for historical data
- Standard HTTP: Use familiar HTTP methods and status codes for error handling
📚 Enhanced - Order Submission Documentation
Improved Code Examples and Field Clarifications
Enhanced the order submission documentation with clearer examples and important field requirements:
- Signature Requirements: Clearly documented that both
signatureandsignature_deadlineare required when not using one-click sessions - Separate Examples: Added distinct examples for options and perpetual orders showing the correct field usage
- Field Clarifications:
- Options orders use
contractsfield - Perpetual orders use
amountfield - The
takerfield is optional and defaults to zero address (any taker)
- Options orders use
New Code Examples
// Options Order Example
const optionsOrder = {
instrument_name: 'BTC_USDC-29AUG25-106000-C',
type: 'good_til_cancelled',
contracts: 1.5, // For options
direction: 'buy',
price: 2500,
// ... other fields
};
// Perpetuals Order Example
const perpsOrder = {
instrument_name: 'BTC_USDC-PERPETUAL',
type: 'good_til_cancelled',
amount: 10000, // For perpetuals
direction: 'buy',
price: 45000,
// ... other fields
};🔧 Enhanced - Error Response Documentation
Detailed Validation Error Structure
Order rejection responses now include detailed validation error information when the rejection reason is "invalid request":
{
"rejected_orders": [
{
"order_id": "abc123",
"reason": "invalid request",
"error": [
{
"instancePath": "/orders/0/contracts",
"schemaPath": "#/properties/contracts/minimum",
"keyword": "minimum",
"params": { "limit": 0 },
"message": "must be >= 0"
}
]
}
]
}Benefits
- Precise Error Location:
instancePathshows exactly which field failed validation - Clear Error Messages: Human-readable messages explain what went wrong
- Faster Debugging: Developers can quickly identify and fix validation issues
