Compare investment scenarios
Compare multiple investment scenarios with different interest rates.
1 min read
post/investment-comparison
Request example
curl --request POST \
--url https://simplycpf.com/api/cpf/investment-comparison \
--header 'Content-Type: application/json' \
--data-raw '{
"principal": 100000,
"years": 10,
"scenarios": [
{
"name": "CPF OA",
"rate": 2.5
},
{
"name": "CPF SA",
"rate": 4
},
{
"name": "Market",
"rate": 7
}
]
}'import requests
url = "https://simplycpf.com/api/cpf/investment-comparison"
headers = {
"Content-Type": "application/json",
}
payload = {
"principal": 100000,
"years": 10,
"scenarios": [
{
"name": "CPF OA",
"rate": 2.5
},
{
"name": "CPF SA",
"rate": 4
},
{
"name": "Market",
"rate": 7
}
]
}
response = requests.request("POST", url, headers=headers, json=payload)
print(response.text)const response = await fetch('https://simplycpf.com/api/cpf/investment-comparison', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
"principal": 100000,
"years": 10,
"scenarios": [
{
"name": "CPF OA",
"rate": 2.5
},
{
"name": "CPF SA",
"rate": 4
},
{
"name": "Market",
"rate": 7
}
]
})
});
const data = await response.json();
console.log(data);<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://simplycpf.com/api/cpf/investment-comparison',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => '{
"principal": 100000,
"years": 10,
"scenarios": [
{
"name": "CPF OA",
"rate": 2.5
},
{
"name": "CPF SA",
"rate": 4
},
{
"name": "Market",
"rate": 7
}
]
}',
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
url := "https://simplycpf.com/api/cpf/investment-comparison"
payload := strings.NewReader("{\n \"principal\": 100000,\n \"years\": 10,\n \"scenarios\": [\n {\n \"name\": \"CPF OA\",\n \"rate\": 2.5\n },\n {\n \"name\": \"CPF SA\",\n \"rate\": 4\n },\n {\n \"name\": \"Market\",\n \"rate\": 7\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://simplycpf.com/api/cpf/investment-comparison"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"principal\": 100000,\n \"years\": 10,\n \"scenarios\": [\n {\n \"name\": \"CPF OA\",\n \"rate\": 2.5\n },\n {\n \"name\": \"CPF SA\",\n \"rate\": 4\n },\n {\n \"name\": \"Market\",\n \"rate\": 7\n }\n ]\n}"))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());require 'uri'
require 'net/http'
url = URI('https://simplycpf.com/api/cpf/investment-comparison')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = url.scheme == 'https'
request = Net::HTTP::Post.new(url)
request['Content-Type'] = 'application/json'
request.body = '{
"principal": 100000,
"years": 10,
"scenarios": [
{
"name": "CPF OA",
"rate": 2.5
},
{
"name": "CPF SA",
"rate": 4
},
{
"name": "Market",
"rate": 7
}
]
}'
response = http.request(request)
puts response.read_bodyResponse
{
"input": {
"principal": 1,
"years": 1
},
"results": [
{
"name": "<string>",
"rate": 1,
"finalValue": 1,
"totalGrowth": 1,
"growthPercentage": 1
}
]
}{
"error": "<string>"
}{
"error": "Rate limit exceeded"
}post/investment-comparison
Body
application/jsonResponses
application/json
Investment comparison results
Error message
Error message