curl --request GET \
--url https://api.example.com/api/v1/trade/close{
"message": [
{
"orderId": "550e8400-e29b-41d4-a716-446655440000",
"userId": "user-123",
"symbol": "btc",
"type": "buy",
"quantity": 0.5,
"leverage": 10,
"openPrice": 45000.00,
"closePrice": 46000.00,
"openTime": "2024-03-01T10:00:00.000Z",
"closeTime": "2024-03-01T11:30:00.000Z",
"profitLoss": 500.00,
"takeProfit": 47000.00,
"stopLoss": 44000.00
}
]
}
Retrieve historical closed trading orders for the authenticated user
curl --request GET \
--url https://api.example.com/api/v1/trade/close{
"message": [
{
"orderId": "550e8400-e29b-41d4-a716-446655440000",
"userId": "user-123",
"symbol": "btc",
"type": "buy",
"quantity": 0.5,
"leverage": 10,
"openPrice": 45000.00,
"closePrice": 46000.00,
"openTime": "2024-03-01T10:00:00.000Z",
"closeTime": "2024-03-01T11:30:00.000Z",
"profitLoss": 500.00,
"takeProfit": 47000.00,
"stopLoss": 44000.00
}
]
}
Retrieves a list of all closed trading orders for the authenticated user from the database. This endpoint provides access to your complete trading history including profit/loss data.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/lakshay-goyal/Exness/llms.txt
Use this file to discover all available pages before exploring further.
Authorization: Bearer <your_jwt_token>
curl -X GET "http://localhost:8000/api/v1/trade/close" \
-H "Authorization: Bearer YOUR_JWT_TOKEN"
{
"message": [
{
"orderId": "550e8400-e29b-41d4-a716-446655440000",
"userId": "user-123",
"symbol": "btc",
"type": "buy",
"quantity": 0.5,
"leverage": 10,
"openPrice": 45000.00,
"closePrice": 46000.00,
"openTime": "2024-03-01T10:00:00.000Z",
"closeTime": "2024-03-01T11:30:00.000Z",
"profitLoss": 500.00,
"takeProfit": 47000.00,
"stopLoss": 44000.00
}
]
}
{
"error": "Unauthorized"
}
{
"error": "Token expired or invalid ❌"
}
const analyzeTradingPerformance = async (token) => {
const response = await fetch('http://localhost:8000/api/v1/trade/close', {
headers: { 'Authorization': `Bearer ${token}` }
});
const { message: orders } = await response.json();
const totalPnL = orders.reduce((sum, order) => sum + order.profitLoss, 0);
const winRate = orders.filter(o => o.profitLoss > 0).length / orders.length;
const avgProfit = totalPnL / orders.length;
return { totalPnL, winRate, avgProfit, totalTrades: orders.length };
};
const exportTradingHistory = async (token) => {
const response = await fetch('http://localhost:8000/api/v1/trade/close', {
headers: { 'Authorization': `Bearer ${token}` }
});
const { message: orders } = await response.json();
// Convert to CSV
const csv = orders.map(o =>
`${o.orderId},${o.symbol},${o.type},${o.quantity},${o.openPrice},${o.closePrice},${o.profitLoss}`
).join('\n');
return csv;
};