Get portfolio position
curl --request GET \
--url https://api.paperdrill.dev/v1/portfolio/positions/{asset} \
--header 'x-api-key: <api-key>'const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.paperdrill.dev/v1/portfolio/positions/{asset}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.paperdrill.dev/v1/portfolio/positions/{asset}"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text){
"asset": "<string>",
"symbol": "<string>",
"quoteAsset": "<string>",
"asOf": "2023-11-07T05:31:56Z",
"source": "live",
"partial": true,
"position": {
"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
},
"portfolio": {
"cash": "125.50",
"positionsValue": "125.50",
"equity": "125.50"
},
"trading": {
"fills": 123,
"buys": 123,
"sells": 123,
"realizedPnl": "+3.40",
"firstTradeAt": "2023-11-07T05:31:56Z",
"lastTradeAt": "2023-11-07T05:31:56Z"
}
}{
"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"
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "Request validation failed",
"details": [
{
"field": "qty",
"message": "invalid decimal format"
}
]
},
"requestId": "f4c0baf4-b8d2-4c9a-a17b-c8656c4a7b0e"
}Account
Get portfolio position
Returns one asset’s position, PnL breakdown, and trade statistics.
Requires the ACCOUNT_READ scope.
GET
/
portfolio
/
positions
/
{asset}
Get portfolio position
curl --request GET \
--url https://api.paperdrill.dev/v1/portfolio/positions/{asset} \
--header 'x-api-key: <api-key>'const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.paperdrill.dev/v1/portfolio/positions/{asset}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.paperdrill.dev/v1/portfolio/positions/{asset}"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text){
"asset": "<string>",
"symbol": "<string>",
"quoteAsset": "<string>",
"asOf": "2023-11-07T05:31:56Z",
"source": "live",
"partial": true,
"position": {
"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
},
"portfolio": {
"cash": "125.50",
"positionsValue": "125.50",
"equity": "125.50"
},
"trading": {
"fills": 123,
"buys": 123,
"sells": 123,
"realizedPnl": "+3.40",
"firstTradeAt": "2023-11-07T05:31:56Z",
"lastTradeAt": "2023-11-07T05:31:56Z"
}
}{
"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"
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "Request validation failed",
"details": [
{
"field": "qty",
"message": "invalid decimal format"
}
]
},
"requestId": "f4c0baf4-b8d2-4c9a-a17b-c8656c4a7b0e"
}Response
Position returned successfully.