Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including market-session with all npm packages installed. Try it out:

var marketSession = require("market-session")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

market-session v2.0.4

Logic for financial-market sessions

market-session Build Status npm version Code coverage

Logic for financial-market sessions

Note: all times assumed to be UTC


npm install market-session


import session from 'market-session'

//=> 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 ]


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free