query.portfolio.get
Get a specific portfolio.
Method
query.portfolio.get
Description
Returns detailed portfolio information for a specific trading account, including all balances, positions, and summary statistics.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
tradingAccountId | string | Yes | Trading account ID |
Result
Returns a portfolio object.
Portfolio Object
| Field | Type | Description |
|---|---|---|
tradingAccountId | string | Trading account identifier |
venue | string | Exchange venue |
positions | array | Open positions |
balances | array | Asset balances |
summary | object | Portfolio summary |
updatedAt | integer | Last update timestamp (ms) |
Position Entry
| Field | Type | Description |
|---|---|---|
positionId | string | Position identifier |
securitySymbol | string | Security symbol |
instrumentId | string | Associated instrument |
securityType | string | Security type |
status | string | Position status (OPEN, CLOSED) |
quantity | string | Position quantity |
entryPrice | string | Entry price |
currentPrice | string | Current market price |
unrealizedPnl | string | Unrealized profit/loss |
realizedPnl | string | Realized profit/loss |
createdAt | integer | Position open timestamp (ms) |
closedAt | integer | Position close timestamp (ms) |
Balance Entry
| Field | Type | Description |
|---|---|---|
symbol | string | Asset symbol |
available | string | Available balance |
locked | string | Locked in orders |
total | string | Total balance |
Usage
result = await client.rpc("query.portfolio.get", {
"tradingAccountId": "550e8400-e29b-41d4-a716-446655440000"
})
Example Response
{
"tradingAccountId": "550e8400-e29b-41d4-a716-446655440000",
"venue": "BINANCE",
"positions": [
{
"positionId": "pos-001",
"securitySymbol": "BTC",
"instrumentId": "BINANCE:BTC/USDT",
"securityType": "CRYPTO",
"status": "OPEN",
"quantity": "1.5",
"entryPrice": "45000.00",
"currentPrice": "50000.00",
"unrealizedPnl": "7500.00",
"realizedPnl": "0",
"createdAt": 1702952635110
}
],
"balances": [
{"symbol": "BTC", "available": "1.5", "locked": "0", "total": "1.5"},
{"symbol": "USDT", "available": "10000.00", "locked": "5000.00", "total": "15000.00"},
{"symbol": "ETH", "available": "5.0", "locked": "0", "total": "5.0"}
],
"summary": {
"totalValue": "90000.00",
"unrealizedPnl": "7500.00",
"realizedPnl": "2500.00"
},
"updatedAt": 1703052635110
}
Notes
- Subscribe to the trading account channel for real-time portfolio updates
- Unrealized P&L is calculated using current market prices
- Locked balances represent funds reserved for open orders