{"id":18430983,"url":"https://github.com/me-io/go-swap","last_synced_at":"2025-04-07T18:32:12.911Z","repository":{"id":37773937,"uuid":"147701196","full_name":"me-io/go-swap","owner":"me-io","description":"💱 Currency exchange rates server - Golang \"ƓØ\"","archived":false,"fork":false,"pushed_at":"2018-10-03T19:08:07.000Z","size":279,"stargazers_count":37,"open_issues_count":1,"forks_count":4,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-04-14T09:46:49.349Z","etag":null,"topics":["currency","currency-converter","currency-exchange","currency-exchange-rates","currency-rates","currencylayer","exchange","exchange-rates","fixer","golang","money"],"latest_commit_sha":null,"homepage":"https://go-swap-server.herokuapp.com/swagger/","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/me-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-06T16:20:45.000Z","updated_at":"2022-11-04T13:26:57.000Z","dependencies_parsed_at":"2022-08-31T01:01:48.541Z","dependency_job_id":null,"html_url":"https://github.com/me-io/go-swap","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/me-io%2Fgo-swap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/me-io%2Fgo-swap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/me-io%2Fgo-swap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/me-io%2Fgo-swap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/me-io","download_url":"https://codeload.github.com/me-io/go-swap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247707353,"owners_count":20982768,"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-converter","currency-exchange","currency-exchange-rates","currency-rates","currencylayer","exchange","exchange-rates","fixer","golang","money"],"created_at":"2024-11-06T05:23:00.637Z","updated_at":"2025-04-07T18:32:12.617Z","avatar_url":"https://github.com/me-io.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n## Currency Exchange Server - Golang \n\n[![Build Status](https://travis-ci.org/me-io/go-swap.svg?branch=master)](https://travis-ci.org/me-io/go-swap)\n[![Go Report Card](https://goreportcard.com/badge/github.com/me-io/go-swap)](https://goreportcard.com/report/github.com/me-io/go-swap)\n[![Coverage Status](https://coveralls.io/repos/github/me-io/go-swap/badge.svg?branch=master)](https://coveralls.io/github/me-io/go-swap?branch=master)\n[![GoDoc](https://godoc.org/github.com/me-io/go-swap?status.svg)](https://godoc.org/github.com/me-io/go-swap)\n[![GitHub release](https://img.shields.io/github/release/me-io/go-swap.svg)](https://github.com/me-io/go-swap/releases)\n\n\n[![Blog URL](https://img.shields.io/badge/Author-blog-green.svg?style=flat-square)](https://meabed.com)\n[![COMMIT](https://images.microbadger.com/badges/commit/meio/go-swap-server.svg)](https://microbadger.com/images/meio/go-swap-server)\n[![SIZE-LAYERS](https://images.microbadger.com/badges/image/meio/go-swap-server.svg)](https://microbadger.com/images/meio/go-swap-server)\n[![Pulls](https://shields.beevelop.com/docker/pulls/meio/go-swap-server.svg?style=flat-square)](https://hub.docker.com/r/meio/go-swap-server)\n\nSwap allows you to retrieve currency exchange rates from various services such as **[Google](https://google.com)**, **[Yahoo](https://yahoo.com)**, **[Fixer](https://fixer.io)**, **[CurrencyLayer](https://currencylayer.com)** or **[1Forge](https://1forge.com)** \nand optionally cache the results. \n\n## Playground\n\u003ca href=\"https://go-swap-server.herokuapp.com/swagger\" target=\"_blank\"\u003e\n  \u003cimg height=\"64\" src=\"https://image.ibb.co/ehsqGp/swagger_ui.jpg\" alt=\"Swagger UI\"\u003e\n\u003c/a\u003e \n\u003ca href=\"https://go-swap-server.herokuapp.com\" target=\"_blank\"\u003e\n    \u003cimg height=\"64\" src=\"https://image.ibb.co/hvWT2U/go_swap_server_heroku.png\" alt=\"heroku test instance @ https://go-swap-server.herokuapp.com\"\u003e\n\u003c/a\u003e\n\n#### /GET Examples for single exchanger:\n- [GET /convert?from=USD\u0026to=AED\u0026amount=2\u0026exchanger=yahoo](https://go-swap-server.herokuapp.com/convert?from=USD\u0026to=AED\u0026amount=100\u0026exchanger=yahoo) \n- [GET /convert?from=EUR\u0026to=GBP\u0026amount=1\u0026exchanger=google\u0026cacheTime=300s](https://go-swap-server.herokuapp.com/convert?from=EUR\u0026to=GBP\u0026amount=100\u0026exchanger=google\u0026cacheTime=300s)\n- [GET /convert?from=USD\u0026to=SAR\u0026amount=1\u0026exchanger=themoneyconverter](https://go-swap-server.herokuapp.com/convert?from=USD\u0026to=SAR\u0026amount=100\u0026exchanger=themoneyconverter)\n\n#### /POST Examples for single or multi exchanger:\n- CURL examples:\n    ```bash\n    curl -X POST \\\n      https://go-swap-server.herokuapp.com/convert \\\n      -H 'Content-Type: application/json' \\\n      -d '{\n      \"amount\": 2.5,\n      \"from\": \"USD\",\n      \"to\": \"AED\",\n      \"decimalPoints\": 4,\n      \"cacheTime\": \"120s\",\n      \"exchanger\": [\n        {\n          \"name\": \"yahoo\"\n        },\n        {\n          \"name\": \"google\"\n        },\n        {\n          \"name\": \"themoneyconverter\",\n          \"userAgent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0\"\n        }\n      ]\n    }'\n  \n     # Response example\n     # {\n     #    \"to\": \"AED\",\n     #    \"from\": \"USD\",\n     #    \"exchangerName\": \"yahoo\",\n     #    \"exchangeValue\": 3.6721,\n     #    \"originalAmount\": 2.5,\n     #    \"convertedAmount\": 9.1802,\n     #    \"convertedText\": \"2.5 USD is worth 9.1802 AED\",\n     #    \"rateDateTime\": \"2018-09-30T07:45:45Z\",\n     #    \"rateFromCache\": false\n     # }  \n    ```\n- [Run in SwaggerUI](https://go-swap-server.herokuapp.com/swagger)\n- [![Run in Postman](https://run.pstmn.io/button.svg)](https://app.getpostman.com/run-collection/5f8445ef9a390fd3faa1)\n\n## QuickStart \n\n\u003ca href=\"https://heroku.com/deploy?template=https://github.com/me-io/go-swap\" target=\"_blank\"\u003e\n  \u003cimg src=\"https://www.herokucdn.com/deploy/button.svg\" alt=\"Deploy\"\u003e\n\u003c/a\u003e\n\u003cbr\u003e\n\n\n\n```bash\n# Or using docker  \n$ docker pull meio/go-swap-server:latest \u0026\u0026 \\\n  docker run --rm --name go-swap-server -p 5000:5000 -it meio/go-swap-server:latest\n```\n\n### Programmatically\n```bash\n$ go get github.com/me-io/go-swap\n```\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\tex \"github.com/me-io/go-swap/pkg/exchanger\"\n\t\"github.com/me-io/go-swap/pkg/swap\"\n)\n\nfunc main() {\n\tSwapTest := swap.NewSwap()\n\n\tSwapTest.\n\t\tAddExchanger(ex.NewGoogleApi(nil)).\n\t\tBuild()\n\n\teuroToUsdRate := SwapTest.Latest(\"EUR/USD\")\n\tfmt.Println(euroToUsdRate.GetRateValue())\n}\n\n```\n\n## Features\n- Convert with Single exchange source `/GET` \n- Convert with Multi exchange sources with fallback mechanism `/POST`\n    - Google\n    - Yahoo\n    - CurrencyLayer\n    - Fixer.io\n    - themoneyconverter.com\n    - openexchangerates.org\n    - 1forge.com\n- Rate Caching - `120s Default` \n    - Memory - `Default`\n    - Redis\n- Rate decimal points rounding `4 Default`\n- Swagger UI\n- Clear API Request and Response\n- Docker image, Binary release and Heroku Demo\n- Clear documentation and 90%+ code coverage\n- Unit tested on live and mock data\n\n### Screens\n\u003cimg height=\"200\" src=\"https://image.ibb.co/nEMd4K/Screen_Shot_2018_10_03_at_10_30_46_PM.png\"\u003e\n\n## Documentation\nThe documentation for the current branch can be found [here](#documentation).\n\n\n## Services\n|Exchanger                  |type           |#                  |$|\n|:---                       |:----          |:---               |:---|\n|[Google][1]                |HTML / Regex   |:heavy_check_mark: |Free|\n|[Yahoo][2]                 |JSON / API     |:heavy_check_mark: |Free|\n|[Currency Layer][3]        |JSON / API     |:heavy_check_mark: |Paid - ApiKey|\n|[Fixer.io][4]              |JSON / API     |:heavy_check_mark: |Paid - ApiKey|\n|[1forge][7]                |API            |:heavy_check_mark: |Freemium / Paid - ApiKey|\n|[The Money Converter][5]   |HTML / Regex   |:heavy_check_mark: |Free|\n|[Open Exchange Rates][6]   |API            |:heavy_check_mark: |Freemium / Paid - ApiKey|\n\n[1]: //google.com\n[2]: //yahoo.com\n[3]: //currencylayer.com\n[4]: //fixer.io\n[5]: //themoneyconverter.com\n[6]: //openexchangerates.org\n[7]: //1forge.com\n\n### Uptime Monitor\n\u003ca href=\"https://stats.uptimerobot.com/vo1g1ip5W\" target=\"_blank\"\u003e\n  \u003cimg src=\"https://uptimerobot.com/assets/img/logo_plain.png\" alt=\"Deploy\"\u003e\n\u003c/a\u003e\n\n## TODO LIST\n- [ ] error structure for empty json or regex not matched\n- [ ] convert panic to api json error\n- [ ] increase tests\n- [ ] verbose logging\n- [ ] godoc \n- [ ] static bundle public folder `./cmd/server/public`\n- [ ] v 1.0.0 release ( docker / binary github / homebrew mac )\n- [ ] support historical rates if possible\n- [ ] benchmark \u0026 performance optimization ` memory leak`\n- [ ] contributors list \n\n## Contributing\n\nAnyone is welcome to [contribute](CONTRIBUTING.md), however, if you decide to get involved, please take a moment to review the guidelines:\n\n* [Only one feature or change per pull request](CONTRIBUTING.md#only-one-feature-or-change-per-pull-request)\n* [Write meaningful commit messages](CONTRIBUTING.md#write-meaningful-commit-messages)\n* [Follow the existing coding standards](CONTRIBUTING.md#follow-the-existing-coding-standards)\n\n#### Credits\n\u003e Inspired by [florianv/swap](https://github.com/florianv/swap) \n\n## License\n\nThe code is available under the [MIT license](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fme-io%2Fgo-swap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fme-io%2Fgo-swap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fme-io%2Fgo-swap/lists"}