Portfolios
A portfolio represents the assets, cash and performance of an investorAccount. We can use the portfolio to inform the user on the current state of their investments. The GiroPro API offers endpoints for retrieving the portfolio of an investorAccount as well as for its constituent parts.
Retrieving the portfolio
GET /PortfolioGetByInvestorAccountId/
The /PortfolioGetByInvestorAccountId/ endpoint returns the portfolio for the provided labelId and investorAccountId.
const url = 'https://api.dev.giropro.pengine.com/PENGINE/Aggregator/AssetAggregator/PortfolioGetByInvestorAccountId/<labelId>/<investorAccountId>';
const options = {
method: 'GET',
headers: {
accept: 'application/json',
authorization: 'bearer <token>'
}
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));
This endpoint returns a PengineResult containing a PortfolioAggregatedItem:
{
"success": true,
"httpStatusCode": 200,
"errors": [],
"totalCount": 0,
"items": [
{
"return_type": "PortfolioAggregatedItem",
"portfolioValue": 175806.34,
"invested": 156836.34,
"unrealizedResult": 18970.00,
"totalValue": 175806.34,
"id": "a5fecff1-1312-41c5-bf58-6b6be55fbb41",
"labelId": "357a12a1-a12a-12ab-a123-a12a1a1ab357",
"investorAccountId": "4563a12a1-a12a-12ab-a123-a12a1a1ab456",
"selectedAssetMixId": "997ae99d-8c1e-42d9-9bc4-d368781c2238",
"performancePortfolioItems": [
{
"labelId": "00000000-0000-0000-0000-000000000000",
"investorAccountId": "00000000-0000-0000-0000-000000000000",
"performancePercentage": 0.068248864,
"performanceCalculationMethod": "IRR",
"assets": [
// list of assetIds and their individual performance by IRR
]
},
{
"labelId": "00000000-0000-0000-0000-000000000000",
"investorAccountId": "00000000-0000-0000-0000-000000000000",
"performancePercentage": 0.068248864,
"performanceCalculationMethod": "TWR",
"assets": [
// list of assetIds and their individual performance by TWR
]
}
],
"cash": {
// cashItem for this investorAccount
},
"assets": [
// list of assetItems for this investorAccount
}
]
}
When to use
The /PortfolioGetByInvestorAccountId/ endpoint returns a basic overview of the state of an investorAccount. This is useful in situations where a summary of an account would be used.