Get portfolio performance
curl --request GET \
--url https://api.paperdrill.dev/v1/portfolio \
--header 'x-api-key: <api-key>'const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.paperdrill.dev/v1/portfolio', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.paperdrill.dev/v1/portfolio"
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,
"cash": "125.50",
"positionsValue": "125.50",
"equity": "125.50",
"costBasis": "125.50",
"realizedPnl": "+3.40",
"unrealizedPnl": "+3.40",
"netContributions": "125.50",
"totalPnl": "+3.40",
"totalPnlPercent": "+3.40",
"baselineEquity": "125.50",
"baselineAt": "2023-11-07T05:31:56Z",
"pnl": "+3.40",
"pnlPercent": "+3.40",
"positions": [
{
"asset": "<string>",
"symbol": "<string>",
"qty": "125.50",
"available": "125.50",
"locked": "125.50",
"total": "125.50",
"costBasis": "125.50",
"averageCost": "125.50",
"markPrice": "125.50",
"value": "125.50",
"realizedPnl": "+3.40",
"unrealizedPnl": "+3.40",
"unrealizedPnlPercent": "+3.40",
"allocationPercent": "125.50",
"lastBuyPrice": "125.50",
"lastBuyQty": "125.50",
"lastBuyAt": "2023-11-07T05:31:56Z",
"lastSellPrice": "125.50",
"lastSellQty": "125.50",
"lastSellAt": "2023-11-07T05:31:56Z",
"tradeCount": 123,
"partial": true
}
]
}{
"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 performance
Returns live cash, valued positions, weighted-average cost basis, and
realised and unrealised PnL. Requires the ACCOUNT_READ scope.
Positions are projected from fills by the worker. source reports
whether the response came from the live snapshot (live), the Postgres
projection (projection), or an engine fallback (engine). When
partial is true, at least one funded asset could not be priced and is
excluded from equity.
GET
/
portfolio
Get portfolio performance
curl --request GET \
--url https://api.paperdrill.dev/v1/portfolio \
--header 'x-api-key: <api-key>'const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.paperdrill.dev/v1/portfolio', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.paperdrill.dev/v1/portfolio"
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,
"cash": "125.50",
"positionsValue": "125.50",
"equity": "125.50",
"costBasis": "125.50",
"realizedPnl": "+3.40",
"unrealizedPnl": "+3.40",
"netContributions": "125.50",
"totalPnl": "+3.40",
"totalPnlPercent": "+3.40",
"baselineEquity": "125.50",
"baselineAt": "2023-11-07T05:31:56Z",
"pnl": "+3.40",
"pnlPercent": "+3.40",
"positions": [
{
"asset": "<string>",
"symbol": "<string>",
"qty": "125.50",
"available": "125.50",
"locked": "125.50",
"total": "125.50",
"costBasis": "125.50",
"averageCost": "125.50",
"markPrice": "125.50",
"value": "125.50",
"realizedPnl": "+3.40",
"unrealizedPnl": "+3.40",
"unrealizedPnlPercent": "+3.40",
"allocationPercent": "125.50",
"lastBuyPrice": "125.50",
"lastBuyQty": "125.50",
"lastBuyAt": "2023-11-07T05:31:56Z",
"lastSellPrice": "125.50",
"lastSellQty": "125.50",
"lastSellAt": "2023-11-07T05:31:56Z",
"tradeCount": 123,
"partial": true
}
]
}{
"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 returned successfully.