/compute/capital-gains
Base URLhttps://api.babylon.app/v1
POST /compute/capital-gains
Compute the realised captial gains over the segement ledger(s).
Query parameters
segmentLedger— The ID of the Babylon segment to analyze.accountType(optional) — One or more account types to include or exclude. Accepts a comma-separated list (e.g.ISA,SIPP,RA). Valid values are:ISA,SIPP,RA,TFSA,GIA.gainSince(Optional) — Compute the gains since the date in the value. Trades before are rebased to the value at or around this gainSince field. This helps capital gains calculation in a new tax jurisdiction.reportingCurrency(optional) — ISO 4217 code (GBP,USD,ZAR, etc.) for reporting; defaults to ledger currencies.format(optional) — Usecsvfor CSV output, otherwise JSON.columns(optional) — Comma-separated list to select and order fields in the response.
Example request
POST /compute/capital-gains
{
segmentLedger: "MyGBSegment",
reportingCurrency: "ZAR"
}
Example response — 200
{
"capital-gains": {
"accountAlias": ["Vanguard-ISA", "HL-GIA"],
"accountType": ["ISA", "GIA"],
"bourse": ["LSE", "LSE"],
"symbol": ["VUSA", "PNL"],
"isin": ["IE00B3XXRP09", "GB0007790798"],
"type": ["ETF", "Equity"],
"description": [
"Vanguard S&P 500 UCITS ETF",
"Personal Assets Trust plc"
],
"tradeDate": ["2024-06-15", "2024-09-10"],
"settleDate": ["2024-06-19", "2024-09-12"],
"capitalGain": [1520.75, 845.50],
"currency": ["GBP", "GBP"],
"capitalGainInReporting": [36984.22, 20555.40],
"reportingCurrency": ["ZAR", "ZAR"]
}
}
Example request (CSV)
POST /compute/capital-gains
{
segmentLedger: "MyGBSegment"
format: "csv"
}
Example response (CSV)
accountAlias,accountType,bourse,symbol,isin,type,description,tradeDate,settleDate,capitalGain,currency,capitalGainInReporting,reportingCurrency
Vanguard-ISA,ISA,LSE,VUSA,IE00B3XXRP09,ETF,"Vanguard S&P 500 UCITS ETF",2024-06-15,2024-06-19,1520.75,GBP,36984.22,ZAR
HL-GIA,GIA,LSE,PNL,GB0007790798,Equity,"Personal Assets Trust plc",2024-09-10,2024-09-12,845.50,GBP,20555.40,ZAR
GET /compute/capital-gains
Same as post method. POST is preferred.