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 fme-calendar with all npm packages installed. Try it out:

var fmeCalendar = require("fme-calendar")

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

fme-calendar v2.1.4

This is the calendar service for xronos

Synopsis

This is the calendar part of the Xronos package - a time aware financial database

Code Example

import { Log } from "fme-logger";
var L = new Log("Test Calendar");
import * as mongo from "mongodb";

import { CalendarDay } from "xronos-calendar";

var mongoURL = 'mongodb://localhost:27017/xronos'

mongo.MongoClient.connect(mongoURL, async (err, db) => {
    L.info("database connected:",mongoURL);
 
    var dayGenerator = new CalendarDay(db);
    var rtn = await dayGenerator.create.init();
    var day = await dayGenerator.create.generate(new Date());
  
})

Motivation

The package generates a holdiay database from 1980 to 2040, from there passed a date it creates a day object that includes elections and holidays and options expiration information.

Installation

npm install --save xronos-calendar

API Reference

export class Day {
    _id?: string;
    timestamp: Date;
    YYYYMMDD: string;
    month: number;
    year: number;
    dow: number;
    doy: number;
    doyISO:number;
    doq: number;
    woy: number;
    woyISO:number;
    quarter: number;
    opex:Opex;
    lunar:Lunar;
    politics: Politics;
    holidays : HolidayDay[];
   
    constructor() {
    }
   
}

Tests

Describe and show how to run the tests with code examples.

Contributors

FortunesRocks.me LLC contact me there if you have questions;

License

MIT

Metadata

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