post https://api-lib.bambu.life/api/portfolioBuilder/v2/portfolioPerformance
This API generates unrebalanced and rebalanced daily portfolio values based on user’s input of daily funds' prices and weights on each fund. This API also calculates the annualised return, risk and Sharpe ratio of the portfolio.
Request Body
Name | Datatype | Description | Mandatory | Sample Value | List of possible values | No. of decimal places | Notes |
---|---|---|---|---|---|---|---|
priceRecords | Array of dictionaries | Record of daily funds' prices | Y | ||||
divAdjClose | Float | Daily dividend adjusted prices of funds | Y | 37.06 | 2 | ||
symbol | String | Symbols of funds | Y | “QQQ” | NA | ||
date | String | Date of price data | Y | "2008-08-22" | NA | ||
portfolioWeights | Array of dictionaries | Y | |||||
symbol | String | Symbols of funds | Y | “QQQ” | NA | ||
weight | Float | Weights on respective fund in the portfolio | Y | 0.5 | >=0, <=1 | 4 | All weights must sum to 1 |
rebalancingStrategy | Dictionary | N | Remove this dictionary to obtain only unrebalanced portfolio values | ||||
calendar | Dictionary | N | |||||
select | Boolean | To rebalance portfolio based on a frequency selected | N | true | true, false | NA | Only one of calendar and percentageOfPortfolio can be true |
type | String | Rebalancing frequency | N | “yearly” | “yearly“, “quarterly“ or “monthly“ | NA | |
percentageOfPortfolio | Dictionary | N | |||||
select | Boolean | To rebalance portfolio based on percentage change of weights of funds in the portfolio | N | false | true, false | NA | Only one of calendar and percentageOfPortfolio can be true |
value | Float | Percentage of entire portfolio | N | 0.200 | 4 | ||
showRebalancingDates | Boolean | To show dates when portfolio rebalancing occur | N | true | true, false | NA | |
riskFreeRate | Float | Risk free rate for calculation of Sharpe ratio | N | 0.05 | >-1, <1 | 4 |
Response Body
Name | Datatype | Description | Sample value | No. of decimals | Notes |
---|---|---|---|---|---|
portfolioGraph | Array of dictionaries | Daily unrebalanced portfolio values | |||
date | String | Date | "2007-01-05" | NA | |
value | Float | Unrebalanced portfolio value on each date | 100.0 | 2 | |
portfolioSummary | Dictionary | Summary of unrebalanced portfolio | |||
annualizedReturn | Float | Annualized return of unrebalanced portfolio | 0.01222238 | 8 | |
annualizedStdDev | Float | Annualized standard deviation of unrebalanced portfolio returns | 0.22169221 | 8 | |
sharpeRatio | Float | Sharpe ratio of the portfolio | 0.166094 | 6 | |
rebalancedPortfolioGraph | Array of dictionaries | ||||
rebalancedPortfolioSummary | Dictionary | Daily rebalanced portfolio values | |||
date | String | Date | "2010-01-27" | NA | |
value | Float | Rebalanced portfolio value on each date | 100.0 | 2 | |
rebalancedPortfolioSummary | Dictionary | Summary of rebalanced portfolio | |||
annualizedReturn | Float | Annualized return of rebalanced portfolio | 0.01222238 | 8 | |
annualizedStdDev | Float | Annualized standard deviation of rebalanced portfolio returns | 0.22169221 | 8 | |
sharpeRatio | Float | Sharpe ratio of the rebalanced portfolio | 0.166094 | 6 | |
rebalancingDates | Array | Dates when portfolio rebalancing occur | [“2010-04-01", "2010-05-06", …] | NA |