{"id":20917784,"url":"https://github.com/kitloong/go-currency-converter-api","last_synced_at":"2025-06-13T11:07:37.608Z","repository":{"id":65917238,"uuid":"602083860","full_name":"kitloong/go-currency-converter-api","owner":"kitloong","description":"A GoLang wrapper of Currency Converter API, easily query conversion between difference currencies and check historical rate with a given date range.","archived":false,"fork":false,"pushed_at":"2023-02-23T15:38:50.000Z","size":28,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"2.x","last_synced_at":"2025-06-13T11:06:53.942Z","etag":null,"topics":["currency","currency-api","currency-converter","currency-exchange-rates"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kitloong.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-15T13:15:09.000Z","updated_at":"2024-07-05T03:12:40.000Z","dependencies_parsed_at":"2023-05-15T03:15:33.405Z","dependency_job_id":null,"html_url":"https://github.com/kitloong/go-currency-converter-api","commit_stats":{"total_commits":10,"total_committers":1,"mean_commits":10.0,"dds":0.0,"last_synced_commit":"3a01d608a4ae2db2bf85d163cf0cf12950c7bc3d"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/kitloong/go-currency-converter-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitloong%2Fgo-currency-converter-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitloong%2Fgo-currency-converter-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitloong%2Fgo-currency-converter-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitloong%2Fgo-currency-converter-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kitloong","download_url":"https://codeload.github.com/kitloong/go-currency-converter-api/tar.gz/refs/heads/2.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitloong%2Fgo-currency-converter-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259634348,"owners_count":22887697,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["currency","currency-api","currency-converter","currency-exchange-rates"],"created_at":"2024-11-18T16:35:49.588Z","updated_at":"2025-06-13T11:07:37.576Z","avatar_url":"https://github.com/kitloong.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Currency Converter API\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/kitloong/go-currency-converter-api/v2.svg)](https://pkg.go.dev/github.com/kitloong/go-currency-converter-api/v2)\n[![Go Report Card](https://goreportcard.com/badge/github.com/kitloong/go-currency-converter-api/v2)](https://goreportcard.com/report/github.com/kitloong/go-currency-converter-api/v2)\n![Run tests](https://github.com/kitloong/go-currency-converter-api/workflows/Run%20tests/badge.svg?branch=2.x)\n[![MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)\n\nA GoLang wrapper of [Currency Converter API](https://www.currencyconverterapi.com).\n\nYou can use [Currency Converter API](https://www.currencyconverterapi.com) to easily query conversion between difference\ncurrencies and check historical rate with a given date range.\n\n## Installation\n\nUse go get\n\n```bash\ngo get github.com/kitloong/go-currency-converter-api/v2\n```\n\nThen import\n\n```go\nimport \"github.com/kitloong/go-currency-converter-api/v2\"\n```\n\n## Usage\n\nFirstly, create an API instance with\n\n| Name      | Description                                                                        |\n|-----------|------------------------------------------------------------------------------------|\n| `BaseURL` | The API server URL, refer to https://www.currencyconverterapi.com/docs for details |\n| `Version` | The API version number, latest is `v7`.                                            |\n| `APIKey`  | Your secret API key.                                                               |\n\n```go\napi := currconv.NewAPI(currconv.Config{\n    BaseURL: \"https://free.currconv.com\",\n    Version: \"v7\",\n    APIKey:  \"[KEY]\",\n})\n```\n\nAvailable methods:\n\n- [Convert](#convert)\n- [ConvertCompact](#convertcompact)\n- [ConvertHistorical](#converthistorical)\n- [ConvertHistoricalCompact](#converthistoricalcompact)\n- [Currencies](#currencies)\n- [Countries](#countries)\n- [Usage](#usage)\n\n### `Convert`\n\nReturns the currency conversion rate with `[FROM]_[TO]` request.\n\nTo convert currency from `USD` to `MYR`, construct a request struct and set `USD_MYR` to the `Q` field:\n\n```go\nconvert, err := api.Convert(currconv.ConvertRequest{\n    Q: []string{\"USD_MYR\"},\n})\n\n// convert\n// \u0026{\n//     Query: {\n//         Count: 1\n//     }\n//     Results: map[\n//         \"USD_MYR\": {\n//             ID:  \"USD_MYR\"\n//             Val: 4.348493\n//             To:  \"MYR\"\n//             Fr:  \"USD\"\n//         }\n//     ]\n// }\n```\n\nSince `Q` is a string slice, you can append more currencies to request multiple conversion in a single request:\n\n```go\nconvert, err := api.Convert(currconv.ConvertRequest{\n    Q: []string{\"USD_MYR\", \"MYR_USD\"},\n})\n\n// convert\n// \u0026{\n//     Query: {\n//         Count: 2\n//     }\n//     Results: map[\n//         \"MYR_USD\": {\n//             ID:  \"MYR_USD\"\n//             Val: 0.229964\n//             To:  \"USD\"\n//             Fr:  \"MYR\"\n//         }\n//         \"USD_MYR\": {\n//             ID:  \"USD_MYR\"\n//             Val: 4.348493\n//             To:  \"MYR\"\n//             Fr:  \"USD\"\n//         }\n//     ]\n// }\n```\n\n### `ConvertCompact`\n\nReturns conversion result with compact mode:\n\n```go\nconvert, err := api.ConvertCompact(currconv.ConvertRequest{\n    Q: []string{\"USD_MYR\", \"MYR_USD\"},\n})\n\n// convert\n// map[\n//     \"MYR_USD\": 0.229964\n//     \"USD_MYR\": 4.348493\n// ]\n```\n\n### `ConvertHistorical`\n\nReturns historical currency conversion rate data:\n\n```go\nconvert, err := api.ConvertHistorical(currconv.ConvertHistoricalRequest{\n    Q:    []string{\"USD_MYR\", \"MYR_USD\"},\n    Date: time.Date(2023, 2, 14, 0, 0, 0, 0, time.UTC),\n})\n\n// convert\n// \u0026{\n//     Query: {\n//         Count: 2\n//     }\n//     Date: \"2023-02-14\"\n//     Results: map[\n//         \"MYR_USD\": {\n//             ID:  \"MYR_USD\"\n//             To:  \"USD\"\n//             Fr:  \"MYR\"\n//             Val: map[\n//                 \"2023-02-14\": 0.229965\n//             ]}\n//         \"USD_MYR\": {\n//             ID:  \"USD_MYR\"\n//             To:  \"MYR\"\n//             Fr:  \"USD\"\n//             Val: map[\n//                 \"2023-02-14\": 4.348497\n//             ]\n//         }\n//     ]\n// }\n```\n\nSet `EndDate` to request historical data with date range:\n\n```go\nconvert, err := api.ConvertHistorical(currconv.ConvertHistoricalRequest{\n    Q:       []string{\"USD_MYR\", \"MYR_USD\"},\n    Date:    time.Date(2023, 2, 1, 0, 0, 0, 0, time.UTC),\n    EndDate: time.Date(2023, 2, 5, 0, 0, 0, 0, time.UTC),\n})\n\n// convert\n// \u0026{\n//     Query:{\n//         Count: 2\n//     }\n//     Date: \"2023-02-01\"\n//     EndDate: \"2023-02-05\"\n//     Results: map[\n//         \"MYR_USD\": {\n//             ID:  \"MYR_USD\"\n//             To:  \"USD\"\n//             Fr:  \"MYR\"\n//             Val: map[\n//                 \"2023-02-01\": 0.234411\n//                 \"2023-02-02\": 0.235513\n//                 \"2023-02-03\": 0.23485\n//                 \"2023-02-04\": 0.23485\n//                 \"2023-02-05\": 0.234851\n//             ]}\n//         \"USD_MYR\": {\n//             ID:  \"USD_MYR\"\n//             To:  \"MYR\"\n//             Fr:  \"USD\"\n//             Val: map[\n//                 \"2023-02-01\": 4.266011\n//                 \"2023-02-02\": 4.246055\n//                 \"2023-02-03\": 4.258039\n//                 \"2023-02-04\": 4.258039\n//                 \"2023-02-05\": 4.258023\n//             ]\n//         }\n//     ]\n// }\n```\n\n### `ConvertHistoricalCompact`\n\nReturns historical data with compact mode:\n\n```go\nconvert, err := api.ConvertHistoricalCompact(currconv.ConvertHistoricalRequest{\n    Q:       []string{\"USD_MYR\", \"MYR_USD\"},\n    Date:    time.Date(2023, 2, 1, 0, 0, 0, 0, time.UTC),\n    EndDate: time.Date(2023, 2, 5, 0, 0, 0, 0, time.UTC),\n})\n\n// convert\n// map[\n//     \"2023-02-01\": 4.266011\n//     \"2023-02-02\": 4.246055\n//     \"2023-02-03\": 4.258039\n//     \"2023-02-04\": 4.258039\n//     \"2023-02-05\": 4.258023\n// ]\n```\n\n### `Currencies`\n\nReturns a list of currencies:\n\n```go\ncurrencies, err := api.Currencies()\n\n// currencies\n// \u0026{\n//     Results:map[\n//         \"MYR\": {\n//             ID:             \"MYR\"\n//             CurrencyName:   \"Malaysian Ringgit\"\n//             CurrencySymbol: \"RM\"\n//         }\n//         \"USD\": {\n//             ID:             \"USD\"\n//             CurrencyName:   \"United States Dollar\"\n//             CurrencySymbol: \"$\"\n//         }\n//         ...\n//     ]\n// }\n```\n\n### `Countries`\n\nReturns a list of countries:\n\n```go\ncountries, err := api.Countries()\n\n// countries\n// \u0026{\n//     Results: map[\n//         \"MY\": {\n//             ID:             \"MY\"\n//             Alpha3:         \"MYS\"\n//             CurrencyID:     \"MYR\"\n//             CurrencyName:   \"Malaysian ringgit\"\n//             CurrencySymbol: \"RM\"\n//             Name:           \"Malaysia\"\n//         }\n//         \"US\": {\n//             ID:             \"US\"\n//             Alpha3:         \"USA\"\n//             CurrencyID:     \"USD\"\n//             CurrencyName:   \"United States dollar\"\n//             CurrencySymbol: \"$\"\n//             Name:           \"United States of America\"\n//         }\n//         ...\n//     ]\n// }\n```\n\n### `Usage`\n\nReturns your current API usage:\n\n```go\nusage, err := api.Usage()\n\n// usage\n// \u0026{\n//     Timestamp: \"2023-02-15 02:05:49.988 +0000 UTC\"\n//     Usage: 1\n// }\n```\n\n## License\n\nThe project is open-sourced software licensed under the [MIT](LICENSE) license\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkitloong%2Fgo-currency-converter-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkitloong%2Fgo-currency-converter-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkitloong%2Fgo-currency-converter-api/lists"}