Package Exports
- position-size
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (position-size) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
position-size
Calculate position-size given risk tolerance and distance to stop-loss
Install
npm install position-sizeUse
▸ 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')