Skip to main content

Get Portfolio History

Overview

The Get Portfolio History API allows you to retrieve historical portfolio data for a specific business within a specified date range. This provides insights into how the portfolio composition and value have changed over time.

Resource Access

  • HTTP Method: GET
  • Endpoint: /v1/businesses/{business_id}/portfolio_history
  • Authentication: Bearer token required

Path Parameters

ParameterTypeRequiredDescription
business_idstring (UUID)YesUnique identifier for the business

Query Parameters

ParameterTypeRequiredDescription
start_datestring (date)YesStart date for the history query (YYYY-MM-DD format)
end_datestring (date)YesEnd date for the history query (YYYY-MM-DD format)

Request Headers

HeaderValueRequiredDescription
Acceptapplication/jsonYesContent type for the response
AuthorizationBearer {access_token}YesBearer token for authentication

Response

Success Response (200 OK)

{
"business_id": "urn:uuid:9b397b0d-69bc-b09f-9d82-0e02637042fc",
"start_date": "2022-01-01",
"end_date": "2023-02-01",
"history": [
{
"date": "2022-01-01",
"portfolio": {
"id": "urn:uuid:portfolio-123",
"products": [
{
"product": "managed_money_market",
"percentage": 50,
"value": 50000.00
},
{
"product": "managed_treasuries",
"percentage": 50,
"value": 50000.00
}
],
"total_value": 100000.00
}
},
{
"date": "2022-06-01",
"portfolio": {
"id": "urn:uuid:portfolio-123",
"products": [
{
"product": "managed_money_market",
"percentage": 45,
"value": 47250.00
},
{
"product": "managed_treasuries",
"percentage": 45,
"value": 47250.00
},
{
"product": "managed_income",
"percentage": 10,
"value": 10500.00
}
],
"total_value": 105000.00
}
}
]
}

Response Fields

FieldTypeDescription
business_idstring (UUID)Business identifier
start_datestring (date)Query start date
end_datestring (date)Query end date
historyarrayArray of portfolio snapshots

History Item Fields

FieldTypeDescription
datestring (date)Date of the portfolio snapshot
portfolio.idstring (UUID)Portfolio identifier
portfolio.productsarrayProduct allocations for this date
portfolio.total_valuenumberTotal portfolio value

Product Allocation Fields

FieldTypeDescription
productstringProduct type (managed_money_market, managed_treasuries, managed_income)
percentagenumberPercentage allocation
valuenumberMonetary value of this allocation

Error Responses

  • 400 Bad Request: Invalid date format or date range
  • 401 Unauthorized: Invalid or missing authentication token
  • 404 Not Found: Business not found or no portfolio history available

Code Examples

cURL

curl -X GET \
'https://api.example.com/v1/businesses/urn:uuid:9b397b0d-69bc-b09f-9d82-0e02637042fc/portfolio_history?start_date=2022-01-01&end_date=2023-02-01' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN'

Python

import requests

url = "https://api.example.com/v1/businesses/urn:uuid:9b397b0d-69bc-b09f-9d82-0e02637042fc/portfolio_history"
headers = {
"Accept": "application/json",
"Authorization": "Bearer YOUR_ACCESS_TOKEN"
}
params = {
"start_date": "2022-01-01",
"end_date": "2023-02-01"
}

response = requests.get(url, headers=headers, params=params)
print(response.json())

JavaScript (Node.js)

const axios = require('axios');

const url = 'https://api.example.com/v1/businesses/urn:uuid:9b397b0d-69bc-b09f-9d82-0e02637042fc/portfolio_history';
const headers = {
'Accept': 'application/json',
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
};
const params = {
start_date: '2022-01-01',
end_date: '2023-02-01'
};

axios.get(url, { headers, params })
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error.response.data);
});

Usage Notes

  • Date parameters must be in YYYY-MM-DD format
  • The start_date should be before or equal to the end_date
  • History data is returned in chronological order
  • If no portfolio history exists for the specified date range, an empty history array will be returned
  • The API returns portfolio snapshots at regular intervals within the date range

Interactive API Explorer