npm

npm’s 2019 JavaScript ecosystem survey analysis is now available!Get your copy here »

market-session

2.0.4 • Public • Published

market-session Build Status npm version Code coverage

Logic for financial-market sessions

Note: all times assumed to be UTC

Install

npm install market-session

Use

import session from 'market-session'
 
console.log(session.fromString('D'))
//=> 1440
 
console.log(session.toString(1440))
//=> 1D
 
console.log(session(new Date('2019-01-01')))
//=> [ '5', '15', '30', '1H', '4H', '12H', '1D', '3D', '1M', '3M', '1Y' ]
 
console.log(session(new Date('2019-04-01'), ['3M']))
//=> ['3M']
 
console.log(session(new Date('2019-01-01')).map(session.fromString))
//=> [ 5, 15, 30, 60, 240, 720, 1440, 4320, 40320, 120960, 483840 ]

Related

install

npm i market-session

Downloadsweekly downloads

26

version

2.0.4

license

ISC

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability