position-size
TypeScript icon, indicating that this package has built-in type declarations

1.0.23 • Public • Published

position-size

License NPM Package Build status Code Coverage Dependencies

Calculate position-size given risk tolerance and distance to stop-loss

Install

npm install position-size

Use

positionSize(capital: number, riskAsPercentOfCapital: number, percentDistanceToStopLoss: number): Either‹string, number›

Defined in src/position-size.ts:39

Calculate position-size given risk-tolerance and distance to stop-loss.

Parameters:

Name Type
capital number
riskAsPercentOfCapital number
percentDistanceToStopLoss number

Returns: Either‹string, number›

import { positionSize } from 'position-size'
 
positionSize(1000, 1, 2.6)
//=> Right(384.6153846153846
 
positionSize(1000, 150, 2.6)
//=> Left('Risk cannot exceed 100 percent')

Documentation

See generated documentation.

Related

/position-size/

    Package Sidebar

    Install

    npm i position-size

    Weekly Downloads

    1

    Version

    1.0.23

    License

    ISC

    Unpacked Size

    8.88 kB

    Total Files

    6

    Last publish

    Collaborators

    • hamroctopus