Convert currency.
This endpoint allows you to convert a specific amount of a currency to another currency.
Description
The ExchangeRatesAPI.convert()
method is used to communicate with this endpoint as seen below:
ExchangeRatesAPI.convert(base, target, Optional[date, base_amount])
Query Parameters
Below are the query parameters for this method:
The base currency to be converted. It must be a currency code supported by AbstractAPI.
The target currency to convert a base currency into. Only one target currency is permitted per request.
An historical date that the response must refer to. This parameter should be used if you want to get past exchange rates records. If blank, the response will be based on live rates. The acceptable date format is: YYYY-MM-DD, e.g 2005-02-30
A specific amount of the base currency to be converted.
Usage
Below is a code snippet to query the ExchangeRatesAPI.convert()
method:
Below is the response object:
Response Fields
The base currency used for the request
The target currency that the base currency is converted into
The date the rates were pulled from.
The specific amount of base currency that was converted.
The base amount equivalent of the base currency in the target currency.
The exchange rate used to convert the base amount from the base currency to the target currency.
The status code of the response.
Using optional parameters
Below is a code snippet that uses the optional parameters:
Below is the response object: