vcurrency
API wrapper (written in V) for https://api.exchangeratesapi.io/
Installation
Use:
v install mehtaarn000.vcurrency
Functions
The
get_data
options (type map)
symbols (type array of strings)
get_data
start_date
end_date
base
The
symbols
Example usage
Get raw JSON from the API (not reccommended):
module main
import mehtaarn000.vcurrency
fn main() {
data := vcurrency.get_data(map{"start_date" : "2021-02-25", "end_date" : "2021-02-26", "base" : "INR"}, ["USD", "CNY"])
// To get the response
println(data.json)
// To parse the json data
println(data.json["rates"])
// To get the generated url
println(data.url)
}
Use the
convert
convert
base
amount
symbols
map[string]f64
module main
import mehtaarn000.vcurrency
fn main() {
data := vcurrency.convert("USD", 100, ["EUR", "INR"])
println(data)
}
Or, Use the
convert_on_date
convert_on_date
base
date
amount
symbols
map[string]f64
module main
import mehtaarn000.vcurrency
fn main() {
data := vcurrency.convert_on_date("USD", "2020-01-05", 100, ["EUR", "INR", "CZK"])
println(data)
}