CalcX Investment Calculator API

API Overview

In today’s dynamic financial landscape, making informed investment decisions is crucial. To assist developers in creating robust investment applications, we are excited to introduce the CalcX Investment Calculator API. This comprehensive API empowers users to effortlessly calculate various investment metrics, such as simple interest, compound interest, return on investment (ROI), capital gains tax, and annual percentage yield (APY). By harnessing the power of the Investment API, developers can unlock new levels of precision and accuracy in their investment calculations, enabling them to make well-informed decisions and optimize their investment strategies.

The API uses currency rates provided by the European Central Bank (ECB) for currency conversion. The API also supports a wide range of programming languages, including but not limited to: C, Clojure, C#, GO, Java, JavaScript, Kotlin, Node.js, Objective-C, OCaml, PHP, PowerShell, Python, R, RapidQL, Ruby, Shell, and Swift.

Supported Currencies:

NOK (Norwegian Krone), EUR (Euro), HKD (Hong Kong Dollar), CZK (Czech Koruna), THB (Thai Baht), CHF (Swiss Franc), USD (United States Dollar), ISK (Icelandic Króna), GBP (British Pound Sterling), JPY (Japanese Yen), BGN (Bulgarian Lev), CNY (Chinese Yuan), IDR (Indonesian Rupiah), TRY (Turkish Lira), NZD (New Zealand Dollar), SGD (Singapore Dollar), DKK (Danish Krone), AUD (Australian Dollar), BRL (Brazilian Real), ILS (Israeli New Shekel), SEK (Swedish Krona), CAD (Canadian Dollar), HUF (Hungarian Forint), ZAR (South African Rand), MYR (Malaysian Ringgit), KRW (South Korean Won), MXN (Mexican Peso), INR (Indian Rupee), PHP (Philippine Peso), PLN (Polish Złoty) and RON (Romanian Leu).

Status Codes:

200: Successful calculation and response.

400: Invalid request or missing required parameters.

500: Internal server error.

Error Handling

If an error occurs during the calculation or processing of the request, the API will respond with an error message and an appropriate status code.

Calculate Investment

These endpoints allow you to calculate various investment metrics such as simple interest, compound interest, investment returns, return on investment (ROI), capital gains tax, and annual percentage yield (APY). It also supports currency conversion for the calculated results.

Parameters

ParameterTypeRequiredDescription
principaldecimalYesThe principal amount of the investment.
ratedecimalYesThe interest rate of the investment.
timeintYesThe time period of the investment in months.
compoundingstringOptionalThe compounding frequency. Default value is yearly. Valid options are yearly, semi-annually, quarterly, and monthly.
formatstringOptionalIf to format the response. Default value is yes. Valid options are yes and no.
in_currencystringOptionalThe currency of the principal amount and investment returns. Default value is USD. See the list of supported currencies above.
to_currencystringOptionalThe currency to which the results should be converted. Default value is USD. See the list of supported currencies above.

/calculate

HTTP Request Example:
GET /calculate?principal=50000.00&rate=6.5&time=36&in_currency=USD&to_currency=USD&compounding=yearly&format=yes HTTP/1.1 
X-Rapidapi-Key: SIGN-UP-FOR-KEY
X-Rapidapi-Host: calcx-investment-api.p.rapidapi.com
Host: calcx-investment-api.p.rapidapi.com

/calculate/post

HTTP Request Example:
POST /calculate/post HTTP/1.1 
Content-Type: application/json
X-Rapidapi-Key: SIGN-UP-FOR-KEY
X-Rapidapi-Host: calcx-investment-api.p.rapidapi.com
Host: calcx-investment-api.p.rapidapi.com
Content-Length: 163
{
"principal": 50000,
"rate": 6.5,
"time": 12,
"compounding": "quarterly",
"format": "yes",
"in_currency": "USD",
"to_currency": "USD"
}
Format Response YES:
{ 
"apy": "6.50%",
"cg_tax": "$161.87",
"compound_interest": "$10397.48",
"compounding_freq": "yearly",
"investment_returns": "$60397.48",
"principal": "$50000.00",
"principal_in": "USD",
"rate": "6.50%",
"results_in": "USD",
"roi": "$20.79",
"simple_interest": "$9750.00",
"time_months": "36 M",
"time_years": "3.00 Y"
}


Format Response NO:
{ 
"apy": "6.50",
"cg_tax": "161.87",
"compound_interest": "10397.48",
"compounding_freq": "yearly",
"investment_returns": "60397.48",
"principal": "50000.00",
"principal_in": "USD",
"rate": "6.50",
"results_in": "USD",
"roi": "20.79",
"simple_interest": "9750.00",
"time_months": "36",
"time_years": "3.00"
}

/calculate/batch

HTTP Request Example:
POST /calculate/batch HTTP/1.1 
Content-Type: application/json
X-Rapidapi-Key: SIGN-UP-FOR-KEY
X-Rapidapi-Host: calcx-investment-api.p.rapidapi.com
Host: calcx-investment-api.p.rapidapi.com
Content-Length: 301

[
    {
        "principal": 1000,
        "rate": 5,
        "time": 12,
        "to_currency": "EUR",
        "in_currency": "USD",
        "compounding": "monthly",
        "format": "yes"
    },
    {
        "principal": 5000,
        "rate": 7,
        "time": 24,
        "format": "no"
    }
]
Response:
[ 
{
"apy": "5.12%",
"cg_tax": "€0.27",
"compound_interest": "€46.94",
"compounding_freq": "monthly",
"investment_returns": "€964.46",
"principal": "$1000",
"principal_in": "USD",
"rate": "5.00%",
"results_in": "EUR",
"roi": "€4.69",
"simple_interest": "€45.88",
"time_months": "12 M",
"time_years": "1.00 Y"
},
{
"apy": 7,
"cg_tax": 6.12,
"compound_interest": 724.5,
"compounding": "yearly",
"investment_returns": 5724.5,
"principal": 5000,
"principal_in": "USD",
"rate": 7,
"results_in": "USD",
"roi": 14.49,
"simple_interest": 700,
"time_months": 24,
"time_years": 2
}
]

Endpoint Response

The response will be a JSON object containing the results for each investment calculation in the same order as they were provided in the request. Each result will have the following properties:

PropertyTypeDescription
principalstringThe principal amount of the investment.
ratestringThe interest rate of the investment.
time_yearsstringThe time duration of the investment in years.
time_monthsnumberThe time duration of the investment in months.
compounding_freqstringThe compounding frequency used.
simple_intereststringThe simple interest earned.
compound_intereststringThe compound interest earned.
investment_returnsstringThe total investment returns.
roistringThe return on investment (ROI) in percentage.
cg_taxstringThe capital gains tax amount.
apystringThe annual percentage yield (APY) in percentage.
results_instringThe currency in which the results are returned.
principal_instringThe currency of the principal amount.

API Support

If you have any questions or issues with our API, please don’t hesitate to contact us!