@storm-trade/market-schedule-parser
v1.0.1
Published
Parser for Storm market trading schedules: weekly sessions, holidays and forced-open non-holidays
Readme
@storm-trade/market-schedule-parser
Parses Storm market trading schedules and resolves when a market is paused.
npm i @storm-trade/market-schedule-parserUsage
import { Schedule } from '@storm-trade/market-schedule-parser';
const schedule = new Schedule({
scheduleTimeZone: 'America/New_York',
// Monday..Sunday, `|`-separated: `+` open all day, `-` closed, `HH:MM-HH:MM[,HH:MM-HH:MM]` sessions
schedule: '09:30-16:00|09:30-16:00|09:30-16:00|09:30-16:00|09:30-16:00|-|-',
// `|`-separated `startMs-endMs` UTC epoch ranges when the market is closed
holidays: '1798761600000-1798848000000',
// optional: `startMs-endMs` ranges that force the market open over breaks and holidays
nonHolidays: '',
});
const { inPause, nextPauseAt, nextUnpauseAt } = schedule.getPauseUnpause(Date.now());
const reopened = schedule.hadUnpauseBetween(fromMs, toMs);Exports
Schedule— parser;getPauseUnpause,hadUnpauseBetween,resolveWeeklyBreaks,getScheduleInfo, staticmergePeriods/subtractPeriods.DailyScheduleState,dailyScheduleStateToString.- Types
AssetSchedule,DailySchedule,InfoResponse.
Development
npm test
npm run build
npm publish