Skip to main content

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

FieldTypeRequiredDescription
tradingAccountIdstringYesTrading account ID

Result

Returns a portfolio object.

Portfolio Object

FieldTypeDescription
tradingAccountIdstringTrading account identifier
venuestringExchange venue
positionsarrayOpen positions
balancesarrayAsset balances
summaryobjectPortfolio summary
updatedAtintegerLast update timestamp (ms)

Position Entry

FieldTypeDescription
positionIdstringPosition identifier
securitySymbolstringSecurity symbol
instrumentIdstringAssociated instrument
securityTypestringSecurity type
statusstringPosition status (OPEN, CLOSED)
quantitystringPosition quantity
entryPricestringEntry price
currentPricestringCurrent market price
unrealizedPnlstringUnrealized profit/loss
realizedPnlstringRealized profit/loss
createdAtintegerPosition open timestamp (ms)
closedAtintegerPosition close timestamp (ms)

Balance Entry

FieldTypeDescription
symbolstringAsset symbol
availablestringAvailable balance
lockedstringLocked in orders
totalstringTotal 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