{"id":25131943,"url":"https://github.com/robotomize/gokuu","last_synced_at":"2025-06-19T13:35:48.125Z","repository":{"id":64307518,"uuid":"379203170","full_name":"robotomize/gokuu","owner":"robotomize","description":"Gokuu is a library for getting up-to-date exchange rates and converting them on Go","archived":false,"fork":false,"pushed_at":"2023-11-24T10:43:30.000Z","size":109,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-08T14:15:59.663Z","etag":null,"topics":["convert","convertion-rate","currency","exchange","finance","go","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robotomize.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":"2021-06-22T08:52:15.000Z","updated_at":"2023-11-20T22:38:56.000Z","dependencies_parsed_at":"2024-06-20T13:01:58.295Z","dependency_job_id":"642d1e5f-ff6c-42e9-83e1-c5bc2b496a3b","html_url":"https://github.com/robotomize/gokuu","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robotomize%2Fgokuu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robotomize%2Fgokuu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robotomize%2Fgokuu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robotomize%2Fgokuu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robotomize","download_url":"https://codeload.github.com/robotomize/gokuu/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246911471,"owners_count":20853657,"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":["convert","convertion-rate","currency","exchange","finance","go","golang"],"created_at":"2025-02-08T14:16:02.037Z","updated_at":"2025-04-03T00:11:41.770Z","avatar_url":"https://github.com/robotomize.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gokuu\n\n[![Go Report](https://goreportcard.com/badge/github.com/robotomize/gokuu)](https://goreportcard.com/report/github.com/robotomize/gokuu)\n[![codebeat badge](https://codebeat.co/badges/a4a12b24-98e6-4627-b01c-8b124561f2e1)](https://codebeat.co/projects/github-com-robotomize-gokuu-main)\n[![codecov](https://codecov.io/gh/robotomize/gokuu/branch/main/graph/badge.svg)](https://codecov.io/gh/robotomize/gokuu)\n[![Build status](https://github.com/robotomize/gokuu/actions/workflows/main.yml/badge.svg)](https://github.com/robotomize/gokuu/actions)\n[![GitHub license](https://img.shields.io/github/license/robotomize/gokuu.svg)](https://github.com/robotomize/gokuu/blob/master/LICENSE)\n\nGokuu is a library for getting up-to-date exchange rates and converting them on Go. Gokuu is a controller and plug-in data sources that work with a specific financial institution. \n\nRight now, Gokuu can retrieve data from the European central bank, the Russian central bank and the central bank of the United Arab Emirates. Altogether, these sources cover exchange rates for 59 currencies\n\n## Installation\n```bash\ngo get github.com/robotomize/gokuu\n```\n## Features\n* Currently supports 59 currency pairs\n* Use your own data sources with provider.Source interface\n\n## Usage\n\nIf you want to get all current exchange rates, you can use the following GetLatest method.\nWhen you match currency pairs from different providers, Gokuu by default saves the data from the provider who gave it faster. \n\n```go\nctx := context.Background()\ng := gokuu.New(http.DefaultClient)\n\nlatest := g.GetLatest(ctx)\nfor _, r := range latest.Result {\n\tfmt.Printf(\"from: %s, to: %s, rate: %f, date: %v\", \n\t\tr.From().Symbol, r.To().Symbol, r.Rate(), r.Time(),\n\t)\n}\n```\n\nWith options you can change the strategy for merging data from multiple providers. For example, a merger based on priorities\n\n```go\ng := gokuu.New(http.DefaultClient, gokuu.WithPriorityMergeStrategy())\n```\n\nCalculate the arithmetic average of the currency pair from all providers\n\n```go\ng := gokuu.New(http.DefaultClient, gokuu.WithAverageMergeStrategy())\n```\n\nYou can also use the conversion function\n```go\nctx := context.Background()\ng := gokuu.New(http.DefaultClient)\n\nconv, err := g.Convert(\n\tctx, gokuu.ConvOpt{\n\t\tFrom:  label.USD,\n\t\tTo:    label.RUB,\n\t\tValue: 10,\n\t},\n)\nif err != nil {\n\tlog.Fatalln(err)\n}\nfmt.Println(conv)\n```\n\nUse your caching function for better performance. For example like this\n```go\ng := gokuu.New(http.DefaultClient, gokuu.WithAverageMergeStrategy())\nlatest := g.GetLatest(ctx)\nconv, err := g.Convert(\n\tctx, gokuu.ConvOpt{\n\t\tFrom:  label.USD,\n\t\tTo:    label.RUB,\n\t\tValue: 10,\n\t\tCacheFn: func(ctx context.Context) gokuu.LatestResponse {\n\t\t\treturn latest\n\t\t},\n\t},\n)\nif err != nil {\n\tlog.Fatalln(err)\n}\nfmt.Println(conv)\n```\n\nYou can also use the helper functions from the package github.com/robotomize/gokuu/label\n```go\nlabel.GetSymbols()\nlabel.GetCountries()\nlabel.GetCurrencies()\nlabel.GetCountriesUsingCurrency(\"currency-symbol\")\nlabel.GetCurrenciesUsedCountry(\"countryname\")\n```\n\n## Contributing\nwelcome\n\n## License\n\nSOD is under the Apache 2.0 license. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobotomize%2Fgokuu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobotomize%2Fgokuu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobotomize%2Fgokuu/lists"}