{"_id":"@anypay/prices-client","_rev":"2-7daa375ecc63eff2fabfa18d87b6cba6","name":"@anypay/prices-client","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"@anypay/prices-client","version":"0.1.0","description":"Prices client for Anypay developers","main":"dist/index.node.js","browser":"dist/index.browser.js","types":"dist/index.d.ts","scripts":{"build":"webpack --mode=production","build:watch":"webpack --watch","test":"jest"},"keywords":[],"author":"","license":"ISC","devDependencies":{"@types/jest":"^29.5.12","@types/node":"^20.11.27","jest":"^29.7.0","ts-jest":"^29.1.2","ts-loader":"^9.5.1","typescript":"^5.4.2","webpack":"^5.90.3","webpack-cli":"^5.1.4"},"dependencies":{"@types/axios":"^0.14.0","@types/ws":"^8.5.10","axios":"^1.6.7","bufferutil":"^4.0.8","utf-8-validate":"^6.0.3","ws":"^8.16.0"},"_id":"@anypay/prices-client@0.1.0","gitHead":"030a40e5a0fde85ed7944c2d654ee609fc58987a","_nodeVersion":"18.18.2","_npmVersion":"9.8.1","dist":{"integrity":"sha512-cexlObI32GiAas+/P0gnp4+ipiaqTtPkyabbdelqN4mFd0euXMUoyZOY06jJwNJPVZS4J9GX6gqjMTsX03ggsg==","shasum":"79231a72f8cb467fb68305b36d910e957ddf529c","tarball":"https://registry.npmjs.org/@anypay/prices-client/-/prices-client-0.1.0.tgz","fileCount":11,"unpackedSize":285843,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB8qVwJe/N5+HftNIfQUwmUMAOD6YYBA6Vw0ozAvOpV5AiBbUEzp0Sd6b6LalZO/ToxCgs1c9+pguI4G2qdWYi9haQ=="}]},"_npmUser":{"name":"stevenzeiler","email":"me@stevenzeiler.com"},"directories":{},"maintainers":[{"name":"stevenzeiler","email":"me@stevenzeiler.com"},{"name":"anypayops","email":"ops@anypayx.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/prices-client_0.1.0_1710488929117_0.5742156081543957"},"_hasShrinkwrap":false},"0.1.1":{"name":"@anypay/prices-client","version":"0.1.1","description":"Prices client for Anypay developers","main":"dist/index.node.js","browser":"dist/index.browser.js","types":"dist/index.d.ts","scripts":{"build":"webpack --mode=production","build:watch":"webpack --watch","test":"jest"},"keywords":[],"author":"","license":"ISC","devDependencies":{"@types/jest":"^29.5.12","@types/node":"^20.11.27","jest":"^29.7.0","ts-jest":"^29.1.2","ts-loader":"^9.5.1","typescript":"^5.4.2","webpack":"^5.90.3","webpack-cli":"^5.1.4"},"dependencies":{"@types/axios":"^0.14.0","@types/ws":"^8.5.10","axios":"^1.6.7","bufferutil":"^4.0.8","utf-8-validate":"^6.0.3","ws":"^8.16.0"},"_id":"@anypay/prices-client@0.1.1","gitHead":"996274a60bcbcb47cd8079db97ec0a3f6694dbeb","_nodeVersion":"18.18.2","_npmVersion":"9.8.1","dist":{"integrity":"sha512-i6xuP0q5INiniPhucZ+7dpfLc2MRHvctJYH7WufVN/U4Han7pglSE02Tj/NaAUqWfSIQgA0EOhj0DpEhDBoXwQ==","shasum":"9607a506bdec502f64fd0138bb5d74b56b3bf9ca","tarball":"https://registry.npmjs.org/@anypay/prices-client/-/prices-client-0.1.1.tgz","fileCount":11,"unpackedSize":285874,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHb/+2oK993gY8w0IITSWEa1Mu2cUd69bHW4W9DggBgtAiEA26zoub2dFHO1ug/TkcIjUAgHc4IKPNiHJ/YPTgx1giM="}]},"_npmUser":{"name":"stevenzeiler","email":"me@stevenzeiler.com"},"directories":{},"maintainers":[{"name":"stevenzeiler","email":"me@stevenzeiler.com"},{"name":"anypayops","email":"ops@anypayx.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/prices-client_0.1.1_1710489313597_0.12882372178560586"},"_hasShrinkwrap":false},"0.1.2":{"name":"@anypay/prices-client","version":"0.1.2","description":"Prices client for Anypay developers","main":"dist/index.node.js","browser":"dist/index.browser.js","types":"dist/index.d.ts","scripts":{"build":"webpack --mode=production","build:watch":"webpack --watch","test":"jest"},"keywords":[],"author":"","license":"ISC","devDependencies":{"@types/jest":"^29.5.12","@types/node":"^20.11.27","jest":"^29.7.0","ts-jest":"^29.1.2","ts-loader":"^9.5.1","typescript":"^5.4.2","webpack":"^5.90.3","webpack-cli":"^5.1.4"},"dependencies":{"@types/axios":"^0.14.0","@types/ws":"^8.5.10","axios":"^1.6.7","bufferutil":"^4.0.8","utf-8-validate":"^6.0.3","ws":"^8.16.0"},"_id":"@anypay/prices-client@0.1.2","gitHead":"0ea06da06c1cef0a0ce31e9e939b3dd8908f5de0","_nodeVersion":"18.18.2","_npmVersion":"9.8.1","dist":{"integrity":"sha512-dstruzf2O6U6jO9v5Osu/fPRIGahc/jnMxg42XkBaI6Mv7o46Js8SF0yGSsZw1hhMWZNL2wCHG9p8o/mpmBR1A==","shasum":"1aa363753144d37893920eb62a04b068392a0637","tarball":"https://registry.npmjs.org/@anypay/prices-client/-/prices-client-0.1.2.tgz","fileCount":11,"unpackedSize":285874,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCelA27Cero34hzC5YReqBQ2f+sAK8xqvVu+c5fpakNpAIgemADKY0Fo4QPIfv/hZLv02zM+pXjb/N47/cPN38I4Pg="}]},"_npmUser":{"name":"stevenzeiler","email":"me@stevenzeiler.com"},"directories":{},"maintainers":[{"name":"stevenzeiler","email":"me@stevenzeiler.com"},{"name":"anypayops","email":"ops@anypayx.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/prices-client_0.1.2_1710489369369_0.10063506908209274"},"_hasShrinkwrap":false}},"time":{"created":"2024-03-15T07:48:49.004Z","0.1.0":"2024-03-15T07:48:49.321Z","modified":"2024-03-15T07:56:10.037Z","0.1.1":"2024-03-15T07:55:13.787Z","0.1.2":"2024-03-15T07:56:09.574Z"},"maintainers":[{"name":"stevenzeiler","email":"me@stevenzeiler.com"},{"name":"anypayops","email":"ops@anypayx.com"}],"description":"Prices client for Anypay developers","keywords":[],"license":"ISC","readme":"# @anypay/prices-client\n\n## Overview\n\n`@anypay/prices-client` is a TypeScript library for connecting to and interacting with the Anypay Prices API. This client library provides easy access to real-time financial market price updates and conversion rates. It's built for both browser and Node.js environments, making it versatile for various applications, including web apps, server-side applications, and more.\n\n## Features\n\n- Real-time price updates via WebSocket.\n- Fetch current prices and conversion rates through HTTP API.\n- Automatic reconnection to WebSocket in case of disconnection.\n- Typed interfaces for easy integration and development within TypeScript projects.\n\n## Installation\n\nInstall `@anypay/prices-client` using npm:\n\n```bash\nnpm install @anypay/prices-client\n```\n\nOr using yarn:\n\n```bash\nyarn add @anypay/prices-client\n```\n\n## Usage\n\n### Creating a Client\n\nFirst, import and create a client instance. You can optionally pass in configuration options.\n\n```typescript\nimport { createClient } from '@anypay/prices-client';\n\nconst client = createClient({\n  http_api_url: 'https://prices.anypayx.com', // Optional custom API URL\n  websocket_api_url: 'wss://prices.anypayx.com', // Optional custom WebSocket URL\n  token: 'your_api_token_here', // Optional API token for authenticated requests\n});\n```\n\n### Subscribing to Price Updates\n\nTo listen for real-time updates on prices:\n\n```typescript\nclient.subscribeToPricesUpdates();\n\nclient.on('price/updated', (price) => {\n  console.log('Price updated', price);\n});\n\nclient.on('websocket.error', (err) => {\n  console.error('WebSocket error', err);\n});\n\nclient.on('websocket.open', () => {\n  console.log('WebSocket open');\n});\n\nclient.on('websocket.message', (data) => {\n  console.log(data);\n});\n```\n\n### Unsubscribing from Price Updates\n\nTo stop receiving price updates:\n\n```typescript\nclient.unsubscribeFromPricesUpdates();\n```\n\n### Fetching Prices and Conversions\n\nFetch current prices:\n\n```typescript\nasync function fetchPrices() {\n  const prices = await client.listPrices();\n  console.log(prices);\n}\nfetchPrices();\n```\n\nConvert one currency to another:\n\n```typescript\nasync function convertCurrency() {\n  const conversion = await client.convertPrice({\n    base: 'USD',\n    value: 1000,\n    quote: 'BTC'\n  });\n  console.log(conversion);\n}\nconvertCurrency();\n```\n\n## Development\n\nThis library is open for contributions! Clone the repository, install dependencies, and make sure to follow the coding standards and commit message guidelines.\n\n## Testing\n\nRun the test suite to ensure your changes do not break existing functionality:\n\n```bash\nnpm run test\n```\n\n## License\n\nThis project is licensed under the ISC License. See the LICENSE file for details.\n\n---\n\nThis README provides a comprehensive guide to using the `@anypay/prices-client` library, from installation to making API calls for price updates and conversions. Adjust the content as needed to match the specifics of your project and its development workflow.","readmeFilename":"README.md"}