fib-retracement
v0.2.1
Published
A tool for calculating fib retracement values
Downloads
62
Maintainers
Readme
fib-retracement
A tool to easily calculate the fibonacci retracement levels based on both extremes (0 and 1).
Status
Installation
Install the package via yarn
:
❯ yarn add fib-retracement
or via npm
:
❯ npm install fib-retracement --save
Usage
A single method is exported called getFibRetracement
. For convenience levels
are also exported in case you need them.
const { getFibRetracement, levels } = require('fib-retracement');
/**
* levels = [0, 0.236, 0.382, 0.5, 0.618, 0.786, 1]
*/
// Run with named parameter notation where 1 is the `start` and 0 is the `end`
const fib = getFibRetracement({ 0: 10, 1: 0 });
// Or with `start`, `end` positional notation
const fib = getFibRetracement(0, 10);
/**
* fib = {
* 1: 0
* 0.786: 2.1399999999999997,
* 0.618: 3.8200000000000003,
* 0.5: 5,
* 0.382: 6.18,
* 0.236: 7.640000000000001,
* 0: 10,
* }
*/
NOTE: The method supports fibonacci retracement calculations as long as both extremes are provided, i.e. 0
and 1
.
Tests
❯ yarn test
License
MIT