Get portfolio analytics
curl --request GET \
--url https://api.paperdrill.dev/v1/portfolio/analytics \
--header 'x-api-key: <api-key>'const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.paperdrill.dev/v1/portfolio/analytics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.paperdrill.dev/v1/portfolio/analytics"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text){
"quoteAsset": "<string>",
"asOf": "2023-11-07T05:31:56Z",
"source": "live",
"partial": true,
"equity": "125.50",
"cash": "125.50",
"positionsValue": "125.50",
"costBasis": "125.50",
"realizedPnl": "+3.40",
"unrealizedPnl": "+3.40",
"netContributions": "125.50",
"totalPnl": "+3.40",
"totalPnlPercent": "+3.40",
"allocation": [
{
"asset": "<string>",
"symbol": "<string>",
"value": "125.50",
"percent": "125.50"
}
],
"cashAllocationPercent": "125.50",
"performance": [
{
"asset": "<string>",
"symbol": "<string>",
"costBasis": "125.50",
"realizedPnl": "+3.40",
"unrealizedPnl": "+3.40",
"totalPnl": "+3.40",
"totalPnlPercent": "+3.40",
"tradeCount": 123,
"open": true
}
],
"bestAsset": {
"asset": "<string>",
"symbol": "<string>",
"costBasis": "125.50",
"realizedPnl": "+3.40",
"unrealizedPnl": "+3.40",
"totalPnl": "+3.40",
"totalPnlPercent": "+3.40",
"tradeCount": 123,
"open": true
},
"worstAsset": {
"asset": "<string>",
"symbol": "<string>",
"costBasis": "125.50",
"realizedPnl": "+3.40",
"unrealizedPnl": "+3.40",
"totalPnl": "+3.40",
"totalPnlPercent": "+3.40",
"tradeCount": 123,
"open": true
},
"trading": {
"events": 123,
"buys": 123,
"sells": 123,
"winningSells": 123,
"losingSells": 123,
"winRate": "125.50",
"realizedPnl": "+3.40",
"firstTradeAt": "2023-11-07T05:31:56Z",
"lastTradeAt": "2023-11-07T05:31:56Z"
},
"change24h": {
"from": "2023-11-07T05:31:56Z",
"change": "+3.40",
"changePercent": "+3.40"
}
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "Request validation failed",
"details": [
{
"field": "qty",
"message": "invalid decimal format"
}
]
},
"requestId": "f4c0baf4-b8d2-4c9a-a17b-c8656c4a7b0e"
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "Request validation failed",
"details": [
{
"field": "qty",
"message": "invalid decimal format"
}
]
},
"requestId": "f4c0baf4-b8d2-4c9a-a17b-c8656c4a7b0e"
}Account
Get portfolio analytics
Returns allocation, per-asset performance, trading statistics, and the
24-hour change in total PnL. Contribution changes are excluded from the
24-hour figure so deposits and withdrawals do not look like performance.
Requires the ACCOUNT_READ scope.
GET
/
portfolio
/
analytics
Get portfolio analytics
curl --request GET \
--url https://api.paperdrill.dev/v1/portfolio/analytics \
--header 'x-api-key: <api-key>'const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.paperdrill.dev/v1/portfolio/analytics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.paperdrill.dev/v1/portfolio/analytics"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text){
"quoteAsset": "<string>",
"asOf": "2023-11-07T05:31:56Z",
"source": "live",
"partial": true,
"equity": "125.50",
"cash": "125.50",
"positionsValue": "125.50",
"costBasis": "125.50",
"realizedPnl": "+3.40",
"unrealizedPnl": "+3.40",
"netContributions": "125.50",
"totalPnl": "+3.40",
"totalPnlPercent": "+3.40",
"allocation": [
{
"asset": "<string>",
"symbol": "<string>",
"value": "125.50",
"percent": "125.50"
}
],
"cashAllocationPercent": "125.50",
"performance": [
{
"asset": "<string>",
"symbol": "<string>",
"costBasis": "125.50",
"realizedPnl": "+3.40",
"unrealizedPnl": "+3.40",
"totalPnl": "+3.40",
"totalPnlPercent": "+3.40",
"tradeCount": 123,
"open": true
}
],
"bestAsset": {
"asset": "<string>",
"symbol": "<string>",
"costBasis": "125.50",
"realizedPnl": "+3.40",
"unrealizedPnl": "+3.40",
"totalPnl": "+3.40",
"totalPnlPercent": "+3.40",
"tradeCount": 123,
"open": true
},
"worstAsset": {
"asset": "<string>",
"symbol": "<string>",
"costBasis": "125.50",
"realizedPnl": "+3.40",
"unrealizedPnl": "+3.40",
"totalPnl": "+3.40",
"totalPnlPercent": "+3.40",
"tradeCount": 123,
"open": true
},
"trading": {
"events": 123,
"buys": 123,
"sells": 123,
"winningSells": 123,
"losingSells": 123,
"winRate": "125.50",
"realizedPnl": "+3.40",
"firstTradeAt": "2023-11-07T05:31:56Z",
"lastTradeAt": "2023-11-07T05:31:56Z"
},
"change24h": {
"from": "2023-11-07T05:31:56Z",
"change": "+3.40",
"changePercent": "+3.40"
}
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "Request validation failed",
"details": [
{
"field": "qty",
"message": "invalid decimal format"
}
]
},
"requestId": "f4c0baf4-b8d2-4c9a-a17b-c8656c4a7b0e"
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "Request validation failed",
"details": [
{
"field": "qty",
"message": "invalid decimal format"
}
]
},
"requestId": "f4c0baf4-b8d2-4c9a-a17b-c8656c4a7b0e"
}Response
Portfolio analytics returned successfully.