{"id":50841017,"url":"https://github.com/tetherto/wdk-pricing-bitfinex-http","last_synced_at":"2026-06-14T06:35:11.822Z","repository":{"id":345811258,"uuid":"907496583","full_name":"tetherto/wdk-pricing-bitfinex-http","owner":"tetherto","description":"HTTP client for price data from Bitfinex API.","archived":false,"fork":false,"pushed_at":"2026-06-09T17:47:37.000Z","size":766,"stargazers_count":2,"open_issues_count":0,"forks_count":8,"subscribers_count":5,"default_branch":"main","last_synced_at":"2026-06-09T19:08:04.632Z","etag":null,"topics":["bitfinex","crypto-prices","market-data","pricing","wdk"],"latest_commit_sha":null,"homepage":"https://docs.wdk.tether.io/tools/price-rates","language":"JavaScript","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/tetherto.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-12-23T18:01:48.000Z","updated_at":"2026-06-09T17:44:33.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/tetherto/wdk-pricing-bitfinex-http","commit_stats":null,"previous_names":["tetherto/wdk-pricing-bitfinex-http"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/tetherto/wdk-pricing-bitfinex-http","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fwdk-pricing-bitfinex-http","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fwdk-pricing-bitfinex-http/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fwdk-pricing-bitfinex-http/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fwdk-pricing-bitfinex-http/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tetherto","download_url":"https://codeload.github.com/tetherto/wdk-pricing-bitfinex-http/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fwdk-pricing-bitfinex-http/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34312072,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-14T02:00:07.365Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["bitfinex","crypto-prices","market-data","pricing","wdk"],"created_at":"2026-06-14T06:35:11.154Z","updated_at":"2026-06-14T06:35:11.811Z","avatar_url":"https://github.com/tetherto.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @tetherto/wdk-pricing-bitfinex-http\n\nNote: This package is in beta. Please test in a dev setup first.\n\nHTTP client for prices from Bitfinex, it uses [Bitfinex Public HTTP API](https://docs.bitfinex.com/docs/rest-public) to obtain the current price \u0026 historical data for given ticker.\n\nIt works as a `PricingClient` for [`@tetherto/wdk-pricing-provider`](https://github.com/tetherto/wdk-pricing-provider).\n\n## 🔍 About WDK\n\nThis module is part of the WDK (Wallet Development Kit) project. Learn more at https://docs.wallet.tether.io.\n\n## ✨ Features\n\n- Compatible with [@tetherto/wdk-pricing-provider](https://github.com/tetherto/wdk-pricing-provider)\n- Fetch current price for given ticker (single or batch) via the Bitfinex FX endpoint\n- Converts to fiat currencies Bitfinex does not quote directly (e.g. BRL, ARS, MXN) by pivoting through USD using its fiat FX rates\n- Fetch historical prices given ticker\n- Downscales long history to max 100 points\n\n## ⬇️ Installation\n\n```bash\nnpm install @tetherto/wdk-pricing-bitfinex-http\n```\n\n## 🚀 Quick Start\n\n```javascript\nimport { BitfinexPricingClient } from \"@tetherto/wdk-pricing-bitfinex-http\";\n\n// Create the client\nconst client = new BitfinexPricingClient();\n\n// Get latest price\nconst current = await client.getCurrentPrice(\"BTC\", \"USD\");\n\n// Get historical prices\nconst history = await client.getHistoricalPrice(\"BTC\", \"USD\", {\n  start: 1709906400000, // optional\n  end: 1709913600000, // optional\n});\n```\n\n## 📚 API Reference\n\n### BitfinexPricingClient\n\nSimple HTTP pricing client for Bitfinex.\n\n#### Constructor\n\n```javascript\nnew BitfinexPricingClient(options?)\n```\n\nParameters:\n\n- `options` (optional): future use\n\n### Methods\n\n| Method                               | Description                       | Returns                                  |\n| ------------------------------------ | --------------------------------- | ---------------------------------------- |\n| `getCurrentPrice(base, quote)`       | Get latest price                  | `Promise\u003cnumber \\| null\u003e`                |\n| `getMultiCurrentPrices(pairs)`       | Get latest prices in a batch      | `Promise\u003cArray\u003cnumber \\| null\u003e\u003e`         |\n| `getMultiPriceData(pairs)`           | Get last price + 24h change batch | `Promise\u003cArray\u003cPriceData \\| null\u003e\u003e`      |\n| `getHistoricalPrice(from, to, opts?)`| Get price history                 | `Promise\u003cArray\u003cany\u003e\u003e`                    |\n\n#### `getCurrentPrice(base, quote)`\n\nUses the Bitfinex `/calc/fx/batch` endpoint. If Bitfinex cannot quote the pair\ndirectly (typically a fiat currency it does not list), it falls back to a\ntwo-leg conversion through USD: `base → USD → quote`. Returns `null` if the\npair cannot be resolved even through the pivot.\n\n```javascript\nconst price = await client.getCurrentPrice(\"BTC\", \"USD\");\nconst brl = await client.getCurrentPrice(\"BTC\", \"BRL\"); // resolved via USD pivot\n```\n\n#### `getMultiCurrentPrices(pairs)`\n\nResolves many pairs in a single batch request, applying the same USD-pivot\nfallback per pair. Results are returned in the same order as the input; a pair\nthat cannot be resolved even through the pivot is `null`.\n\n```javascript\nconst prices = await client.getMultiCurrentPrices([\n  { from: \"BTC\", to: \"USD\" },\n  { from: \"ETH\", to: \"BRL\" },\n]);\n```\n\n#### `getMultiPriceData(pairs)`\n\nReturns the last price plus 24h absolute and relative change for each pair, from\nthe Bitfinex `/tickers` endpoint. Unlike the methods above, it does **not** use\nthe USD pivot, so a currency Bitfinex does not quote directly resolves to\n`null`. Results are returned in the same order as the input.\n\n```javascript\nconst data = await client.getMultiPriceData([{ from: \"BTC\", to: \"USD\" }]);\n// [{ lastPrice, dailyChange, dailyChangeRelative }]\n```\n\n#### `getHistoricalPrice(from, to, opts?)`\n\nIf the list is longer than 100 points, it is downscaled by 2x steps until \u003c= 100.\n\n```javascript\nconst series = await client.getHistoricalPrice(\"BTC\", \"USD\");\n```\n\n## ⚠️ Limitations\n\n- **Currency codes are Bitfinex-specific.** You must pass the codes Bitfinex\n  uses, not the common ISO/ticker symbol. For example, Tether is `UST` (not\n  `USDT`), and some fiats are only available as tokenized assets such as `CNHT`\n  or `MXNT`. Unknown codes resolve to `null`. The full list is at\n  `https://api-pub.bitfinex.com/v2/conf/pub:list:currency`.\n- **The USD pivot only applies to current prices.** `getCurrentPrice` and\n  `getMultiCurrentPrices` fall back to a `from → USD → to` conversion for fiat\n  Bitfinex does not quote directly. `getHistoricalPrice` does **not** — it\n  returns an empty array for such pairs (Bitfinex has no historical FX series\n  for them).\n- **`getMultiPriceData` does not support pivot currencies.** It sources last\n  price and daily change from `/tickers`, which only exists for natively quoted\n  pairs. For a currency that requires the USD pivot (e.g. BRL, ARS) it returns\n  `null` for that entry.\n\n## 🛠️ Development\n\n```bash\nnpm install\nnpm run lint\nnpm test\n```\n\n## 📜 License\n\nThis project is licensed under the Apache License 2.0 - see the LICENSE file for details.\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## 🆘 Support\n\nFor support, please open an issue on the GitHub repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftetherto%2Fwdk-pricing-bitfinex-http","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftetherto%2Fwdk-pricing-bitfinex-http","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftetherto%2Fwdk-pricing-bitfinex-http/lists"}