npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@kaishen/quantlib

v0.1.19

Published

Node.js finance library

Downloads

13

Readme

@kaishen/quantlib

actions

Install this package

npm install @kaishen/quantlib --save

Support matrix

| | node10 | node12 | node14 | node15 | | --------------- | ------ | ------ | ------ | ------ | | Windows x64 | ✓ | ✓ | ✓ | ✓ | | Windows x32 | ✓ | ✓ | ✓ | ✓ | | macOS x64 | ✓ | ✓ | ✓ | ✓ | | macOS arm64 | ✓ | ✓ | ✓ | ✓ | | Linux x64 gnu | ✓ | ✓ | ✓ | ✓ | | Linux x64 musl | ✓ | ✓ | ✓ | ✓ | | Android arm64 | ✓ | ✓ | ✓ | ✓ |

Performance

派息日历 @ 债券 x 174,647 ops/sec ±5.55% (92 runs sampled)
应计利息 @ 债券 x 1,854,755 ops/sec ±0.93% (95 runs sampled)
Fastest is 应计利息 @ 债券

Develop requirements

  • Install latest Rust
  • Install NodeJS@10+ which supports N-API

Test in local

  • npm install
  • npm run build
  • npm run test

And you will see:

$ ava --tap | tap-nyan

 138 -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-__,------,
 0   -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-__|  /\_/\
 0   -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_~|_( ^ .^)
     -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ ""  ""
  Pass!

Usage

Bond Calendars

import {Bond, DayCountDes} from '@kaishen/quantlib';

const bond = new Bond(
    '2013-05-09',
    '2013-05-09',
    '2013-11-09',
    '2043-05-09',
    2,
    DayCountDes.ISMAThirty360,
    4.25,
);

const calendars = bond.calendars();
console.log(`calendars: ${calendars}`);
$ console
calendars: ["2013-05-09","2013-11-09","2014-05-09","2014-11-09","2015-05-09","2015-11-09","2016-05-09","2016-11-09","2017-05-09","2017-11-09","2018-05-09","2018-11-09","2019-05-09","2019-11-09","2020-05-09","2020-11-09","2021-05-09","2021-11-09","2022-05-09","2022-11-09","2023-05-09","2023-11-09","2024-05-09","2024-11-09","2025-05-09","2025-11-09","2026-05-09","2026-11-09","2027-05-09","2027-11-09","2028-05-09","2028-11-09","2029-05-09","2029-11-09","2030-05-09","2030-11-09","2031-05-09","2031-11-09","2032-05-09","2032-11-09","2033-05-09","2033-11-09","2034-05-09","2034-11-09","2035-05-09","2035-11-09","2036-05-09","2036-11-09","2037-05-09","2037-11-09","2038-05-09","2038-11-09","2039-05-09","2039-11-09","2040-05-09","2040-11-09","2041-05-09","2041-11-09","2042-05-09","2042-11-09","2043-05-09"]

Bond Accrued

import {Bond, DayCountDes} from '@kaishen/quantlib';

const bond = new Bond(
    '2013-05-09',
    '2013-05-09',
    '2013-11-09',
    '2043-05-09',
    2,
    DayCountDes.ISMAThirty360,
    4.25,
);

const accrued = bond.accrued('2021-05-07', 1000000);
console.log(`accrued: ${accrued}`);
$ console
accrued: 21013.888888888887

Bond Gav

import {Bond, Trade, AssetType, DayCountDes, ActionType} from '@kaishen/quantlib';

const trades = new Trades('Bond', AssetType.Bond);
trades.add({
    action: ActionType.Buy,
    quantity: 1000000,
    price: 101,
    trade_date: '2020-01-02',
    settle_date: '2020-01-03',
});

const bond = new Bond(
    '2013-05-09',
    '2013-05-09',
    '2013-11-09',
    '2043-05-09',
    2,
    DayCountDes.ISMAThirty360,
    4.25,
);

const gav = bond.gav('2021-05-07', 110, trades);
console.log(`gav: ${gav}`);
$ console
gav: 1121131.9444444445