npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fintech

v0.9.0

Published

Financial technology utilities

Downloads

39

Readme

fintech

Financial technology utilities

Motivation

Make developers more powerful in financial world.

Features

Installation

$ npm i --save fintech

Common Usage

/*
 *Calculate max loss of an array
 */
const { maxLoss } = require('fintech')

const tickArr = [1, 1.2, 1.15, 1.08, 1.16]
const lossRate = maxLoss(tickArr)

console.log(lossRate) // -10%
/*
 *Calculate MA of a List of candles 
 */
const { ma } = require('fintech')

const candlesList = [{close: 5}, {close: 6}, {close: 7}, {close: 8}, {close: 9}]
const ma5 = ma(5, candlesList)

console.log(ma5) // 7
/*
 *Calculate WR Index of a List of candles 
 */
const { wr } = require('fintech')

const candlesList = [
    {open: 5, high: 5, low: 5, close: 5,},
    {open: 6, high: 6, low: 6, close: 6,},
    {open: 7, high: 7, low: 7, close: 7,},
    {open: 8, high: 8, low: 8, close: 8,},
    {open: 9, high: 9, low: 9, close: 9,}
]
const wr5 = wr(5, candlesList)

console.log(wr5) // 0
const { numberToRate } = require('fintech')

const rateA = numberToRate(0.618, 100, 1) // Number, type, accuracy
console.log(rateA) // 61.8%

const rateB = numberToRate(0.003141592653, 1000, 3)
console.log(rateB) // 3.142‰

const rateC = numberToRate(0.00299792458, 10000, 5)
console.log(rateC) // 29.97925‱
const { spitNum } = require('fintech')

const localeA = numberToRate(58888.88) // Number
console.log(localeA) // 58,888.88

const localeB = numberToRate('100000000000', 4) // String, Unit
console.log(localeB) // 1000,0000,0000

const localeC = numberToRate(100000000000, 4, ' ') // Number, Unit, Symbol
console.log(localeC) // 1000 0000 0000

const localeD = numberToRate('BTCETHLTC', 3, ' 🚀 ') // String, Unit, Symbol
console.log(localeD) // BTC 🚀 ETH 🚀 LTC
const { assetsSum } = require('fintech')

const amountA = {BTC: 1, ETH: 11}
const amountB = {BTC: 2, ETH: 22}
const amountC = {BTC: 3, ETH: 33}

const assetsArr = [amountA, amountB, amountC]

const assets = assetsSum(assetsArr) // Assets array
console.log(assets) // {BTC: 6, ETH: 66}
const { assetsValue } = require('fintech')

const amount = {BTC: 1, ETH: 10}
const price = {BTC: 10000, ETH: 1000}

const assets = assetsValue(amount, price) // Amount object, price object
console.log(assets) // {assets: {BTC: 10000, ETH: 10000}, total: 20000}

Advanced Usage

License

MIT