Package Exports
- riskjs
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (riskjs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
RiskJS
The goal of this project is to port Calvin456/VaR library into JavaScript for Portfolio Value at Risk calculation.
This library for now includes CVaR computation using the following methods:
- Historical
- Monte Carlo
- Variance Covariance (used now in Vigor project)
Many other quantitative finance computations might be added in the future to facilitate the use of such functionality in JavaScript Blockchain Oracles.
This is part of our team work to participate in LiquidApps Global Hackathon 2019.
Installation
- OS X (XCode & Command Line Tools)
- Linux (GCC >= 4.8):
$ npm install riskjs
- Windows7/8 (Visual Studio 2012):
$ npm install riskjs --msvs_version=2012
Testing
There is a small but important suite of tests to check that this code runs correctly.
$ npm run test
> riskjs@0.0.5 test ./vigorish/riskjs
> mocha test/*.js
Loading data from "./test/data.csv"
Loading data from "./test/data.csv"
Loading data from "./test/data.csv"
CVaR Historical
✓ RiskJS.CVaRHistorical() should be a function
✓ Should throw error when tried with wrong arguments
✓ Should return a string with the same result value
CVaR Monte Carlo
✓ RiskJS.CVaRMonteCarlo() should be a function
✓ Should throw error when tried with wrong arguments (111ms)
✓ Should return a string with the same result value (99ms)
CVaR Variance Covariance
✓ RiskJS.CVaRVarianceCovariance() should be a function
✓ Should throw error when tried with wrong arguments
✓ Should return a string with the same result value
9 passing (221ms)
Dependencies
Included in the project are both dependencies to build this library, please check include
folder.