curl --request POST \
--url https://api.iotools.cloud/v1/tool/dca-calculator \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contribution": "500",
"frequency": "12",
"years": "20",
"returnRate": "8",
"initial": "0"
}
'import requests
url = "https://api.iotools.cloud/v1/tool/dca-calculator"
payload = {
"contribution": "500",
"frequency": "12",
"years": "20",
"returnRate": "8",
"initial": "0"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
contribution: '500',
frequency: '12',
years: '20',
returnRate: '8',
initial: '0'
})
};
fetch('https://api.iotools.cloud/v1/tool/dca-calculator', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.iotools.cloud/v1/tool/dca-calculator",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'contribution' => '500',
'frequency' => '12',
'years' => '20',
'returnRate' => '8',
'initial' => '0'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.iotools.cloud/v1/tool/dca-calculator"
payload := strings.NewReader("{\n \"contribution\": \"500\",\n \"frequency\": \"12\",\n \"years\": \"20\",\n \"returnRate\": \"8\",\n \"initial\": \"0\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}HttpResponse<String> response = Unirest.post("https://api.iotools.cloud/v1/tool/dca-calculator")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"contribution\": \"500\",\n \"frequency\": \"12\",\n \"years\": \"20\",\n \"returnRate\": \"8\",\n \"initial\": \"0\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.iotools.cloud/v1/tool/dca-calculator")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"contribution\": \"500\",\n \"frequency\": \"12\",\n \"years\": \"20\",\n \"returnRate\": \"8\",\n \"initial\": \"0\"\n}"
response = http.request(request)
puts response.read_body{
"tool": "dca-calculator",
"tool_version": "1.0.1",
"outputs": {
"summary": [
{
"metric": "Final DCA Value",
"value": "$296,473.61"
},
{
"metric": "Total Invested",
"value": "$120,000.00"
},
{
"metric": "Total Gain",
"value": "$176,473.61"
},
{
"metric": "Total Gain %",
"value": "+147.06%"
},
{
"metric": "Lump Sum Equivalent (same total, invested upfront)",
"value": "$559,314.86"
},
{
"metric": "Investment Frequency",
"value": "Monthly"
}
],
"schedule": [
{
"year": "1",
"total-invested": "$6,000.00",
"dca-value": "$6,266.46",
"lump-sum-equivalent": "$6,480.00",
"dca-gain": "$266.46"
},
{
"year": "2",
"total-invested": "$12,000.00",
"dca-value": "$13,053.04",
"lump-sum-equivalent": "$13,996.80",
"dca-gain": "$1,053.04"
},
{
"year": "3",
"total-invested": "$18,000.00",
"dca-value": "$20,402.90",
"lump-sum-equivalent": "$22,674.82",
"dca-gain": "$2,402.90"
},
{
"year": "4",
"total-invested": "$24,000.00",
"dca-value": "$28,362.79",
"lump-sum-equivalent": "$32,651.74",
"dca-gain": "$4,362.79"
},
{
"year": "5",
"total-invested": "$30,000.00",
"dca-value": "$36,983.35",
"lump-sum-equivalent": "$44,079.84",
"dca-gain": "$6,983.35"
},
{
"year": "6",
"total-invested": "$36,000.00",
"dca-value": "$46,319.41",
"lump-sum-equivalent": "$57,127.48",
"dca-gain": "$10,319.41"
},
{
"year": "7",
"total-invested": "$42,000.00",
"dca-value": "$56,430.36",
"lump-sum-equivalent": "$71,980.62",
"dca-gain": "$14,430.36"
},
{
"year": "8",
"total-invested": "$48,000.00",
"dca-value": "$67,380.52",
"lump-sum-equivalent": "$88,844.65",
"dca-gain": "$19,380.52"
},
{
"year": "9",
"total-invested": "$54,000.00",
"dca-value": "$79,239.53",
"lump-sum-equivalent": "$107,946.25",
"dca-gain": "$25,239.53"
},
{
"year": "10",
"total-invested": "$60,000.00",
"dca-value": "$92,082.84",
"lump-sum-equivalent": "$129,535.50",
"dca-gain": "$32,082.84"
},
{
"year": "11",
"total-invested": "$66,000.00",
"dca-value": "$105,992.13",
"lump-sum-equivalent": "$153,888.17",
"dca-gain": "$39,992.13"
},
{
"year": "12",
"total-invested": "$72,000.00",
"dca-value": "$121,055.89",
"lump-sum-equivalent": "$181,308.25",
"dca-gain": "$49,055.89"
},
{
"year": "13",
"total-invested": "$78,000.00",
"dca-value": "$137,369.93",
"lump-sum-equivalent": "$212,130.65",
"dca-gain": "$59,369.93"
},
{
"year": "14",
"total-invested": "$84,000.00",
"dca-value": "$155,038.03",
"lump-sum-equivalent": "$246,724.26",
"dca-gain": "$71,038.03"
},
{
"year": "15",
"total-invested": "$90,000.00",
"dca-value": "$174,172.57",
"lump-sum-equivalent": "$285,495.22",
"dca-gain": "$84,172.57"
},
{
"year": "16",
"total-invested": "$96,000.00",
"dca-value": "$194,895.27",
"lump-sum-equivalent": "$328,890.49",
"dca-gain": "$98,895.27"
},
{
"year": "17",
"total-invested": "$102,000.00",
"dca-value": "$217,337.95",
"lump-sum-equivalent": "$377,401.84",
"dca-gain": "$115,337.95"
},
{
"year": "18",
"total-invested": "$108,000.00",
"dca-value": "$241,643.35",
"lump-sum-equivalent": "$431,570.11",
"dca-gain": "$133,643.35"
},
{
"year": "19",
"total-invested": "$114,000.00",
"dca-value": "$267,966.09",
"lump-sum-equivalent": "$491,989.92",
"dca-gain": "$153,966.09"
},
{
"year": "20",
"total-invested": "$120,000.00",
"dca-value": "$296,473.61",
"lump-sum-equivalent": "$559,314.86",
"dca-gain": "$176,473.61"
}
]
},
"credits_used": 3,
"credits_remaining": null
}{
"type": "https://iotools.cloud/docs/errors/validation_error",
"title": "Invalid request",
"status": 400,
"code": "validation_error",
"detail": "One or more inputs are invalid — see `fields`.",
"request_id": "e4042b29-8f1e-4c7a-9b52-6f0d1a3c7e11",
"fields": {
"inputString": "Required"
}
}{
"type": "https://iotools.cloud/docs/errors/invalid_api_key",
"title": "Invalid API key",
"status": 401,
"code": "invalid_api_key",
"detail": "Provide 'Authorization: Bearer <key>'.",
"request_id": "e4042b29-8f1e-4c7a-9b52-6f0d1a3c7e11"
}{
"type": "https://iotools.cloud/docs/errors/insufficient_credits",
"title": "Insufficient credits",
"status": 402,
"code": "insufficient_credits",
"detail": "This call costs 1 credit and 0 remain in this month's allowance.",
"request_id": "e4042b29-8f1e-4c7a-9b52-6f0d1a3c7e11",
"credits_used": 0,
"credits_remaining": 0
}{
"type": "https://iotools.cloud/docs/errors/tool_not_allowed",
"title": "Tool not available over the API",
"status": 403,
"code": "tool_not_allowed",
"detail": "\"Background Remover\" is available on iotools.cloud but has no API endpoint.",
"request_id": "e4042b29-8f1e-4c7a-9b52-6f0d1a3c7e11"
}{
"type": "https://iotools.cloud/docs/errors/tool_not_found",
"title": "Tool not found",
"status": 404,
"code": "tool_not_found",
"detail": "No tool with that slug. See GET /v1/tools/list.",
"request_id": "e4042b29-8f1e-4c7a-9b52-6f0d1a3c7e11"
}{
"type": "https://iotools.cloud/docs/errors/payload_too_large",
"title": "Payload too large",
"status": 413,
"code": "payload_too_large",
"detail": "Request body exceeds this tool's size limit.",
"request_id": "e4042b29-8f1e-4c7a-9b52-6f0d1a3c7e11"
}{
"type": "https://iotools.cloud/docs/errors/rate_limited",
"title": "Rate limit exceeded",
"status": 429,
"code": "rate_limited",
"detail": "Too many requests. Retry in 30s.",
"request_id": "e4042b29-8f1e-4c7a-9b52-6f0d1a3c7e11",
"retry_after": 30
}{
"type": "https://iotools.cloud/docs/errors/processing_error",
"title": "Tool failed to run",
"status": 500,
"code": "processing_error",
"detail": "The tool failed to run. Please try again.",
"request_id": "e4042b29-8f1e-4c7a-9b52-6f0d1a3c7e11",
"credits_used": 0
}{
"type": "https://iotools.cloud/docs/errors/tool_disabled",
"title": "Tool temporarily disabled",
"status": 503,
"code": "tool_disabled",
"detail": "This tool is temporarily unavailable. Try again shortly.",
"request_id": "e4042b29-8f1e-4c7a-9b52-6f0d1a3c7e11"
}DCA (Dollar-Cost Averaging) Calculator
Simulate a dollar-cost averaging investment strategy — periodic contributions at a chosen frequency compounding over time — and compare the result against investing the same total amount as a single lump sum.
Try DCA (Dollar-Cost Averaging) Calculator in your browser →
curl --request POST \
--url https://api.iotools.cloud/v1/tool/dca-calculator \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contribution": "500",
"frequency": "12",
"years": "20",
"returnRate": "8",
"initial": "0"
}
'import requests
url = "https://api.iotools.cloud/v1/tool/dca-calculator"
payload = {
"contribution": "500",
"frequency": "12",
"years": "20",
"returnRate": "8",
"initial": "0"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
contribution: '500',
frequency: '12',
years: '20',
returnRate: '8',
initial: '0'
})
};
fetch('https://api.iotools.cloud/v1/tool/dca-calculator', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.iotools.cloud/v1/tool/dca-calculator",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'contribution' => '500',
'frequency' => '12',
'years' => '20',
'returnRate' => '8',
'initial' => '0'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.iotools.cloud/v1/tool/dca-calculator"
payload := strings.NewReader("{\n \"contribution\": \"500\",\n \"frequency\": \"12\",\n \"years\": \"20\",\n \"returnRate\": \"8\",\n \"initial\": \"0\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}HttpResponse<String> response = Unirest.post("https://api.iotools.cloud/v1/tool/dca-calculator")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"contribution\": \"500\",\n \"frequency\": \"12\",\n \"years\": \"20\",\n \"returnRate\": \"8\",\n \"initial\": \"0\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.iotools.cloud/v1/tool/dca-calculator")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"contribution\": \"500\",\n \"frequency\": \"12\",\n \"years\": \"20\",\n \"returnRate\": \"8\",\n \"initial\": \"0\"\n}"
response = http.request(request)
puts response.read_body{
"tool": "dca-calculator",
"tool_version": "1.0.1",
"outputs": {
"summary": [
{
"metric": "Final DCA Value",
"value": "$296,473.61"
},
{
"metric": "Total Invested",
"value": "$120,000.00"
},
{
"metric": "Total Gain",
"value": "$176,473.61"
},
{
"metric": "Total Gain %",
"value": "+147.06%"
},
{
"metric": "Lump Sum Equivalent (same total, invested upfront)",
"value": "$559,314.86"
},
{
"metric": "Investment Frequency",
"value": "Monthly"
}
],
"schedule": [
{
"year": "1",
"total-invested": "$6,000.00",
"dca-value": "$6,266.46",
"lump-sum-equivalent": "$6,480.00",
"dca-gain": "$266.46"
},
{
"year": "2",
"total-invested": "$12,000.00",
"dca-value": "$13,053.04",
"lump-sum-equivalent": "$13,996.80",
"dca-gain": "$1,053.04"
},
{
"year": "3",
"total-invested": "$18,000.00",
"dca-value": "$20,402.90",
"lump-sum-equivalent": "$22,674.82",
"dca-gain": "$2,402.90"
},
{
"year": "4",
"total-invested": "$24,000.00",
"dca-value": "$28,362.79",
"lump-sum-equivalent": "$32,651.74",
"dca-gain": "$4,362.79"
},
{
"year": "5",
"total-invested": "$30,000.00",
"dca-value": "$36,983.35",
"lump-sum-equivalent": "$44,079.84",
"dca-gain": "$6,983.35"
},
{
"year": "6",
"total-invested": "$36,000.00",
"dca-value": "$46,319.41",
"lump-sum-equivalent": "$57,127.48",
"dca-gain": "$10,319.41"
},
{
"year": "7",
"total-invested": "$42,000.00",
"dca-value": "$56,430.36",
"lump-sum-equivalent": "$71,980.62",
"dca-gain": "$14,430.36"
},
{
"year": "8",
"total-invested": "$48,000.00",
"dca-value": "$67,380.52",
"lump-sum-equivalent": "$88,844.65",
"dca-gain": "$19,380.52"
},
{
"year": "9",
"total-invested": "$54,000.00",
"dca-value": "$79,239.53",
"lump-sum-equivalent": "$107,946.25",
"dca-gain": "$25,239.53"
},
{
"year": "10",
"total-invested": "$60,000.00",
"dca-value": "$92,082.84",
"lump-sum-equivalent": "$129,535.50",
"dca-gain": "$32,082.84"
},
{
"year": "11",
"total-invested": "$66,000.00",
"dca-value": "$105,992.13",
"lump-sum-equivalent": "$153,888.17",
"dca-gain": "$39,992.13"
},
{
"year": "12",
"total-invested": "$72,000.00",
"dca-value": "$121,055.89",
"lump-sum-equivalent": "$181,308.25",
"dca-gain": "$49,055.89"
},
{
"year": "13",
"total-invested": "$78,000.00",
"dca-value": "$137,369.93",
"lump-sum-equivalent": "$212,130.65",
"dca-gain": "$59,369.93"
},
{
"year": "14",
"total-invested": "$84,000.00",
"dca-value": "$155,038.03",
"lump-sum-equivalent": "$246,724.26",
"dca-gain": "$71,038.03"
},
{
"year": "15",
"total-invested": "$90,000.00",
"dca-value": "$174,172.57",
"lump-sum-equivalent": "$285,495.22",
"dca-gain": "$84,172.57"
},
{
"year": "16",
"total-invested": "$96,000.00",
"dca-value": "$194,895.27",
"lump-sum-equivalent": "$328,890.49",
"dca-gain": "$98,895.27"
},
{
"year": "17",
"total-invested": "$102,000.00",
"dca-value": "$217,337.95",
"lump-sum-equivalent": "$377,401.84",
"dca-gain": "$115,337.95"
},
{
"year": "18",
"total-invested": "$108,000.00",
"dca-value": "$241,643.35",
"lump-sum-equivalent": "$431,570.11",
"dca-gain": "$133,643.35"
},
{
"year": "19",
"total-invested": "$114,000.00",
"dca-value": "$267,966.09",
"lump-sum-equivalent": "$491,989.92",
"dca-gain": "$153,966.09"
},
{
"year": "20",
"total-invested": "$120,000.00",
"dca-value": "$296,473.61",
"lump-sum-equivalent": "$559,314.86",
"dca-gain": "$176,473.61"
}
]
},
"credits_used": 3,
"credits_remaining": null
}{
"type": "https://iotools.cloud/docs/errors/validation_error",
"title": "Invalid request",
"status": 400,
"code": "validation_error",
"detail": "One or more inputs are invalid — see `fields`.",
"request_id": "e4042b29-8f1e-4c7a-9b52-6f0d1a3c7e11",
"fields": {
"inputString": "Required"
}
}{
"type": "https://iotools.cloud/docs/errors/invalid_api_key",
"title": "Invalid API key",
"status": 401,
"code": "invalid_api_key",
"detail": "Provide 'Authorization: Bearer <key>'.",
"request_id": "e4042b29-8f1e-4c7a-9b52-6f0d1a3c7e11"
}{
"type": "https://iotools.cloud/docs/errors/insufficient_credits",
"title": "Insufficient credits",
"status": 402,
"code": "insufficient_credits",
"detail": "This call costs 1 credit and 0 remain in this month's allowance.",
"request_id": "e4042b29-8f1e-4c7a-9b52-6f0d1a3c7e11",
"credits_used": 0,
"credits_remaining": 0
}{
"type": "https://iotools.cloud/docs/errors/tool_not_allowed",
"title": "Tool not available over the API",
"status": 403,
"code": "tool_not_allowed",
"detail": "\"Background Remover\" is available on iotools.cloud but has no API endpoint.",
"request_id": "e4042b29-8f1e-4c7a-9b52-6f0d1a3c7e11"
}{
"type": "https://iotools.cloud/docs/errors/tool_not_found",
"title": "Tool not found",
"status": 404,
"code": "tool_not_found",
"detail": "No tool with that slug. See GET /v1/tools/list.",
"request_id": "e4042b29-8f1e-4c7a-9b52-6f0d1a3c7e11"
}{
"type": "https://iotools.cloud/docs/errors/payload_too_large",
"title": "Payload too large",
"status": 413,
"code": "payload_too_large",
"detail": "Request body exceeds this tool's size limit.",
"request_id": "e4042b29-8f1e-4c7a-9b52-6f0d1a3c7e11"
}{
"type": "https://iotools.cloud/docs/errors/rate_limited",
"title": "Rate limit exceeded",
"status": 429,
"code": "rate_limited",
"detail": "Too many requests. Retry in 30s.",
"request_id": "e4042b29-8f1e-4c7a-9b52-6f0d1a3c7e11",
"retry_after": 30
}{
"type": "https://iotools.cloud/docs/errors/processing_error",
"title": "Tool failed to run",
"status": 500,
"code": "processing_error",
"detail": "The tool failed to run. Please try again.",
"request_id": "e4042b29-8f1e-4c7a-9b52-6f0d1a3c7e11",
"credits_used": 0
}{
"type": "https://iotools.cloud/docs/errors/tool_disabled",
"title": "Tool temporarily disabled",
"status": 503,
"code": "tool_disabled",
"detail": "This tool is temporarily unavailable. Try again shortly.",
"request_id": "e4042b29-8f1e-4c7a-9b52-6f0d1a3c7e11"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Periodic Investment ($)
x >= 0Investment Duration (Years)
1 <= x <= 60Expected Annual Return (%)
-50 <= x <= 100Investment Frequency
52, 26, 12, 4, 1 Initial Lump Sum ($)
x >= 0Response
Tool output
Show child attributes
Show child attributes
The tool's slug, echoing the {slug} in the request path.
Output-contract version for this tool.
Credits this call consumed, after any settlement refund. 0 when metering is disabled.
Credits left in the current monthly allowance, or null when metering is disabled.
Correlation id, also sent as x-request-id.
Was this page helpful?