{"id":24567301,"url":"https://github.com/autonomoussoftware/safe-exchange-rate","last_synced_at":"2025-03-17T03:41:04.998Z","repository":{"id":48894487,"uuid":"209668281","full_name":"autonomoussoftware/safe-exchange-rate","owner":"autonomoussoftware","description":"Safely get exchange rates","archived":false,"fork":false,"pushed_at":"2021-07-06T17:46:46.000Z","size":325,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-02-23T17:17:41.907Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/autonomoussoftware.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}},"created_at":"2019-09-19T23:55:48.000Z","updated_at":"2020-12-22T22:38:18.000Z","dependencies_parsed_at":"2022-09-23T23:11:08.174Z","dependency_job_id":null,"html_url":"https://github.com/autonomoussoftware/safe-exchange-rate","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autonomoussoftware%2Fsafe-exchange-rate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autonomoussoftware%2Fsafe-exchange-rate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autonomoussoftware%2Fsafe-exchange-rate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autonomoussoftware%2Fsafe-exchange-rate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/autonomoussoftware","download_url":"https://codeload.github.com/autonomoussoftware/safe-exchange-rate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243971157,"owners_count":20376785,"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":[],"created_at":"2025-01-23T13:17:39.944Z","updated_at":"2025-03-17T03:41:04.970Z","avatar_url":"https://github.com/autonomoussoftware.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# safe-exchange-rate\n\n[![Build Status](https://travis-ci.com/autonomoussoftware/safe-exchange-rate.svg?branch=master)](https://travis-ci.com/autonomoussoftware/safe-exchange-rate)\n[![Code Style](https://img.shields.io/badge/code%20style-bloq-0063a6.svg)](https://github.com/bloq/eslint-config-bloq)\n[![Known Vulnerabilities](https://snyk.io/test/github/autonomoussoftware/safe-exchange-rate/badge.svg?targetFile=package.json)](https://snyk.io/test/github/autonomoussoftware/safe-exchange-rate?targetFile=package.json)\n\nSafely get exchange rates from different providers.\nIf any provider is down or failing, a different one from an internal list will be used.\n\nThe following exchange rate pairs are currently supported:\n\n- BAT:USD\n- ETH:USD\n- DAI:USD\n- ETC:USD\n- KNC:USD\n- MANA:USD\n- QTUM:USD\n- USDC:USD\n- WBTC:USD\n- ZRX:USD\n\nOnly 100% open and free providers are queried:\n\n- [Bittrex](https://bittrex.com)\n- [CoinCap](https://coincap.io)\n- [CoinGecko](https://coingecko.com)\n\n## Installation\n\n```shell\nnpm install safe-exchange-rate\n```\n\n## Usage\n\n```js\nconst getExchangeRate = require('safe-exchange-rate')\n\ngetExchangeRate('ETH:USD').then(function (rate) {\n  console.log(rate) // 225.68\n}\n```\n\n## API\n\n### getExchangeRate(pair) ⇒ `Promise\u003cnumber\u003e`\n\nObtain the exchange rate between two assets given list of providers. If one\nfails for any reason, the next in the list is used. The providers include:\nBittrex, CoinCap, CoinGecko.\n\n**Returns**: `Promise\u003cnumber\u003e` - The exchange rate.\n\n| Param | Type     | Description                   |\n| ----- | -------- | ----------------------------- |\n| pair  | `string` | The rate pair like `ETH:USD`. |\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fautonomoussoftware%2Fsafe-exchange-rate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fautonomoussoftware%2Fsafe-exchange-rate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fautonomoussoftware%2Fsafe-exchange-rate/lists"}