{"_id":"@bitfinexorg/lib-js-util-math","_rev":"1-da6278b7f2f0bbfa1dfc08fc8b8718cf","name":"@bitfinexorg/lib-js-util-math","dist-tags":{"latest":"0.7.0"},"versions":{"0.7.0":{"name":"@bitfinexorg/lib-js-util-math","version":"0.7.0","description":"Bitfinex JS Math Lib","author":{"name":"prdn","email":"paolo@bitfinex.com"},"keywords":["bitfinex","math","util"],"license":"Apache-2.0","repository":{"type":"git","url":"git+https://github.com/bitfinexcom/lib-js-util-math.git"},"engine":{"node":">=8.0"},"main":"index.js","scripts":{"format":"standard --fix","test":"npm run lint && npm run unit","unit":"NODE_ENV=test ./node_modules/.bin/mocha ./test/index.test.js","lint":"standard"},"dependencies":{"bignumber.js":"^9.0.0"},"devDependencies":{"chai":"^4.2.0","dirty-chai":"^2.0.1","husky":"^4.3.6","mocha":"^8.2.1","standard":"^16.0.3"},"standard":{"globals":["it","describe","before","after","beforeEach","afterEach"]},"husky":{"hooks":{"pre-commit":"npm run lint","pre-push":"npm run test"}},"gitHead":"4db20c3a55744ae16de3c58ee784f979e06b30a9","bugs":{"url":"https://github.com/bitfinexcom/lib-js-util-math/issues"},"homepage":"https://github.com/bitfinexcom/lib-js-util-math#readme","_id":"@bitfinexorg/lib-js-util-math@0.7.0","_nodeVersion":"12.14.0","_npmVersion":"6.13.4","dist":{"integrity":"sha512-elcNSMt/5D3LkEzaMAYR6HPiW1iUH7Uz4dZGDFJXSI6U37CFa6T4sERwRet/GoMJMhAPXqo749hrBz1A+1V2fg==","shasum":"710f99f2a2a1edd287d08320f827d5b00fd2b799","tarball":"https://registry.npmjs.org/@bitfinexorg/lib-js-util-math/-/lib-js-util-math-0.7.0.tgz","fileCount":29,"unpackedSize":74336,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgBsBcCRA9TVsSAnZWagAANMkP/1uqn8jBX6pLS/pbNNIF\nxkkKYMkURAU/dJDa2dpi0raK6ToG2E/+CIbSzSDglb0MDp1K6MaaqZmXDyvb\nKshJ67vnw0fFpb6QmxkLgP/Aw9Z8cDVwqZSYYYAYv/kk2JcwcX8oYFaQd70s\nDSBT84eOlGXamrm2vTEbZaqUnAB9r3vjUa/e5ZpD8wseTWUGKGg/1ASDQGRm\nxNRcdDOOF8iLZYS75+HMePoaI6G9ZyJYAVP7EtXwqXw0Szbucx7MXrnfraX3\nATbVerKHP0MdoQhTDAWLZ5OIQaakWwAMyehHPcteiodghP8u/FBAQ5b/vKP1\n3sOcbdCtrajn4bHP0SSekctGjH18xPMNF+kivRa1J9B8LmCUG5wB5m/pxGeO\nMYzo82JwqU+D/OV4JkGay6w60W+n0CqSQEQDEMQPNqlSIG9l4Apfzo0il99d\nCj7/xbXU/LO92KvcdeVMvppbPdCYmUKuQSFnos25rnVeeJ7MswoTB7ifL45A\nbMzZb+It8aWafYBBLFQa9wJFB6TtBwcUreMn2EFrobtA9tz1m6rIqdb7uogt\nR1V1GIyFVHYyGwaIVL5UFflxru7DkI3n83XCGw5ESht4g2p9l2PUFZG3qIFj\nsD3ZHgUpBeidD7gRCgc6stcQ+3C0kHaMhA3SmpRXCO2zqHTjKhyOA4d2a6cx\n+62l\r\n=tcpv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDAgcqeeqC8CzB9Y0+Um3wcsMK7rkXS9aJhyqipQ9r5OQIgDMSF/wytAHqayjZcX2/sI1rkQYVH+U5zaiBRQXDsxYM="}]},"_npmUser":{"name":"bitfinexorg","email":"paolo@bitfinex.com"},"directories":{},"maintainers":[{"name":"bitfinexorg","email":"paolo@bitfinex.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/lib-js-util-math_0.7.0_1611055196104_0.5056775544043504"},"_hasShrinkwrap":false}},"time":{"created":"2021-01-19T11:19:56.103Z","0.7.0":"2021-01-19T11:19:56.251Z","modified":"2022-04-04T19:00:00.292Z"},"maintainers":[{"name":"bitfinexorg","email":"paolo@bitfinex.com"}],"description":"Bitfinex JS Math Lib","homepage":"https://github.com/bitfinexcom/lib-js-util-math#readme","keywords":["bitfinex","math","util"],"repository":{"type":"git","url":"git+https://github.com/bitfinexcom/lib-js-util-math.git"},"author":{"name":"prdn","email":"paolo@bitfinex.com"},"bugs":{"url":"https://github.com/bitfinexcom/lib-js-util-math/issues"},"license":"Apache-2.0","readme":"# lib-js-util-math\n\nThe lib includes the utilities depicted below:\n- `BN` - BigNumber utilities\n- `Array utilites` - Array utilites like min, max, median and avg with big number manipulation\n- `VWAP` - Volume Weighted Average Price (VWAP) index utilities\n- `Standard Deviation` - Standard deviation utilities\n- `SMA` - Simple Moving Average \n- `EMA` - Exponential Moving Average \n- `TWAP` - Time Weighted Average Price utilities\n- `Impact mid price` - Mid price from bids and asks until specific book depth\n\n## Installing\n```console\nnpm install --save https://github.com/bitfinexcom/lib-js-util-math.git\n```\n\n## Testing\n```console\nnpm run test\n```\n\n## Usage\n```javascript\nconst data = [\n  { price: nBN(10500), y: 'jan', volume: '1' },\n  { price: nBN(10700), y: 'feb', volume: '0.33' },\n  { price: nBN(11500), y: 'mar', volume: '2.13' },\n  { price: nBN('12300'), y: 'apr', volume: '5.26' },\n  { price: nBN(5000), y: 'may', volume: '0.77' },\n  { price: nBN(5100), y: 'jun', volume: '1.52' }\n]\n\nconst vwap = VWAP(data)\nconsole.log(vwap) // 10429.24613987284287011807\n\nconst dev = stdDeviation(data, a => a.price)\nconsole.log(dev.toFixed()) // 2980.16591633568094682823\n\n```\n\n## Authors\n- prdn\n- robertkowalski\n- vigan-abd\n","readmeFilename":"README.md"}