FIFO count
FIFO count is a module to get a first in first out calculation of a list of trades.
Usage
const fifo = // add tradesfifofifofifofifofifo // calculate tradesconst res = fifo // res === [// { inPrice: 120, outPrice: 150, amount: 3, profit: 90 },// { inPrice: 120, outPrice: 180, amount: 5, profit: 300 },// { inPrice: 190, outPrice: 210, amount: 6, profit: 400 }// ]