Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ ENDIF ()

IF (MSVC_IDE)
IF ( CMAKE_CONFIGURATION_TYPES STREQUAL "Debug" )
TARGET_LINK_LIBRARIES(quantlib QuantLib-vc120-mt-gd.lib)
TARGET_LINK_LIBRARIES(quantlib QuantLibObjects-vc120-mt-gd-1_7_0.lib)
TARGET_LINK_LIBRARIES(quantlib ObjectHandler-vc120-mt-gd-1_7_0.lib)
TARGET_LINK_LIBRARIES(quantlib QuantLib-vc140-mt-gd.lib)
TARGET_LINK_LIBRARIES(quantlib QuantLibObjects-vc140-mt-gd-1_8_0.lib)
TARGET_LINK_LIBRARIES(quantlib ObjectHandler-vc140-mt-gd-1_8_0.lib)
ELSE ()
TARGET_LINK_LIBRARIES(quantlib QuantLib-vc120-mt-s.lib)
TARGET_LINK_LIBRARIES(quantlib QuantLibObjects-vc120-mt-s-1_7_0.lib)
TARGET_LINK_LIBRARIES(quantlib ObjectHandler-vc120-mt-s-1_7_0.lib)
TARGET_LINK_LIBRARIES(quantlib QuantLib-vc140-mt-s.lib)
TARGET_LINK_LIBRARIES(quantlib QuantLibObjects-vc140-mt-s-1_8_0.lib)
TARGET_LINK_LIBRARIES(quantlib ObjectHandler-vc140-mt-s-1_8_0.lib)
ENDIF ()
ENDIF ()

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2016 Jerry Jin
Copyright (c) 2016 - 2017 Jerry Jin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
35 changes: 30 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,10 @@ All functions in this project are Async, they are exported to [Promise](https://
npm install quantlib
```

* Windows - 32-Bit
* Windows

`npm install quantlib` will do everything, including the node package installation and pre-built native addon (no dependency) download, you can start use it right away.

* Windows - 64-Bit

I will try to build and upload the pre-built addon, before that, Please refer to [how to build](#building-the-native-addon) below

* Linux & Mac

Please refer to [how to build](#building-the-native-addon) below
Expand All @@ -37,6 +33,35 @@ Please refer to [how to build](#building-the-native-addon) below
| QuantLib | QuantLibAddin | Node.js | quantlib.node |
| -------- | ------------- | ------- | ------------- |
| 1.7.1 | 1.7.0 | 6.9.1 | 0.1.x |
| 1.8.1 | 1.8.0 | 6.9.5 | 0.2.x |

## Building the native addon

#### Prerequisite

* CMake 2.8 or above, Visual C++ for windows, Xcode for Mac, GCC for Linux
* Node.js according to [version matrix](#version-matrix)
* [nan](https://github.com/nodejs/nan) ^2.2.0
* [node-gyp](https://github.com/nodejs/node-gyp) ~3.0.3
* QuantLib, QuantLibAddin, ObjectHandler source code according to [version matrix](#version-matrix), they need to be put in the same directory
* `boost` - which is required to build QuantLib

#### Set environment variable

please refer to `cmake/*.cmake` and `CMakeList.txt` files

* `NAN_DIR` - location of `nan`
* `NODE_GYP_DIR` - location of `.node-gyp` generated by `node-gyp` tool, which is at `~/.node-gyp`, if it doesn't exist, follow the instruction in [node-gyp](https://github.com/nodejs/node-gyp), and build a helloword program, it will generate the `.node-gyp` directory
* `QUANTLIB_ROOT` - location of QuantLib, QuantLibAddin, ObjectHandler source code
* `BOOST_ROOT` - location `boost` installed

#### Use cmake to build the addon

1. Build QuantLib and QuantLibAddin, please check `CMakeList.txt` for library name, and make sure generated library names are the same in `CMakeList.txt`
2. from `quantlibnode` root directory `cd build`
3. `cmake ..` for Windows and Linux, `cmake -G Xcode ..` for Mac OS X
4. `cmake --build . --config Release`
5. For Linux, you may need to put `quantlib.node` under `build/Release` manually,

## Building the native addon

Expand Down
2 changes: 1 addition & 1 deletion cmake/FindNode.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# NODE_GYP_FOUND - True if node found.

# Read environment variables to find node_gyp include/lib directories
SET(NODE_GYP_VER "6.9.1")
SET(NODE_GYP_VER "6.9.5")
MESSAGE( STATUS "NODE_GYP_VER: " ${NODE_GYP_VER} )
SET(NODE_GYP_DIR $ENV{NODE_GYP_DIR}/${NODE_GYP_VER})
MESSAGE( STATUS "NODE_GYP_DIR: " ${NODE_GYP_DIR} )
Expand Down
11 changes: 10 additions & 1 deletion lib/quantlib.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// This is a generated file, modify: generate/templates/quantlib.js
/*
Copyright (C) 2016 -2017 Jerry Jin
*/


var promisify = require("promisify-node");
var rawApi = require("../build/Release/quantlib");
Expand Down Expand Up @@ -1060,6 +1063,12 @@ exports.PiecewiseConstantVarianceVariance = promisify(rawApi.PiecewiseConstantVa
exports.PiecewiseConstantVarianceVolatility = promisify(rawApi.PiecewiseConstantVarianceVolatility);
exports.PiecewiseConstantVarianceTotalVariance = promisify(rawApi.PiecewiseConstantVarianceTotalVariance);
exports.PiecewiseConstantVarianceTotalVolatility = promisify(rawApi.PiecewiseConstantVarianceTotalVolatility);

exports.PiecewiseYieldCurveMixedInterpolation = promisify(PiecewiseYieldCurveMixedInterpolation);
exports.BachelierCapFloorEngine = promisify(BachelierCapFloorEngine);
exports.BachelierCapFloorEngine2 = promisify(BachelierCapFloorEngine2);
exports.BachelierBlackFormulaImpliedVol = promisify(BachelierBlackFormulaImpliedVol);

exports.ObjectPropertyNames = promisify(rawApi.ObjectPropertyNames);
exports.DeleteObject = promisify(rawApi.DeleteObject);
exports.DeleteObjects = promisify(rawApi.DeleteObjects);
Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
{
"name": "quantlib",
"description": "QuantLib Asyn Bindings for Node.js",
"version": "0.1.5",
"version": "0.2.0",
"keywords": [
"quantlib",
"native",
"addon"
"quantlib"
],
"main": "lib/quantlib.js",
"repository": {
Expand Down
9 changes: 9 additions & 0 deletions quantlibnode.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
Copyright (C) 2016 -2017 Jerry Jin
*/

#include <v8.h>
#include <node.h>
#include <nan.h>
Expand Down Expand Up @@ -1080,6 +1084,11 @@ NAN_MODULE_INIT(init){
Nan::SetMethod(target, "PiecewiseConstantVarianceTotalVariance", QuantLibNode::PiecewiseConstantVarianceTotalVariance);
Nan::SetMethod(target, "PiecewiseConstantVarianceTotalVolatility", QuantLibNode::PiecewiseConstantVarianceTotalVolatility);

Nan::SetMethod(target, "PiecewiseYieldCurveMixedInterpolation", QuantLibNode::PiecewiseYieldCurveMixedInterpolation);
Nan::SetMethod(target, "BachelierCapFloorEngine", QuantLibNode::BachelierCapFloorEngine);
Nan::SetMethod(target, "BachelierCapFloorEngine2", QuantLibNode::BachelierCapFloorEngine2);
Nan::SetMethod(target, "BachelierBlackFormulaImpliedVol", QuantLibNode::BachelierBlackFormulaImpliedVol);

Nan::SetMethod(target, "DeleteObject", QuantLibNode::DeleteObject);
Nan::SetMethod(target, "DeleteObjects", QuantLibNode::DeleteObjects);
Nan::SetMethod(target, "DeleteAllObjects", QuantLibNode::DeleteAllObjects);
Expand Down
10 changes: 10 additions & 0 deletions quantlibnode.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
Copyright (C) 2016 -2017 Jerry Jin
*/


#ifndef quantlibnode_hpp
#define quantlibnode_hpp

Expand Down Expand Up @@ -1127,6 +1132,11 @@ class QuantLibNode : public Nan::ObjectWrap {
static NAN_METHOD(PiecewiseConstantVarianceTotalVariance);
static NAN_METHOD(PiecewiseConstantVarianceTotalVolatility);

static NAN_METHOD(PiecewiseYieldCurveMixedInterpolation);
static NAN_METHOD(BachelierCapFloorEngine);
static NAN_METHOD(BachelierCapFloorEngine2);
static NAN_METHOD(BachelierBlackFormulaImpliedVol);

static NAN_METHOD(DeleteObject);
static NAN_METHOD(DeleteObjects);
static NAN_METHOD(DeleteAllObjects);
Expand Down
2 changes: 1 addition & 1 deletion src/abcd.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2016 Jerry Jin
Copyright (C) 2016 -2017 Jerry Jin
*/

#include <nan.h>
Expand Down
2 changes: 1 addition & 1 deletion src/abcd.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2016 Jerry Jin
Copyright (C) 2016 -2017 Jerry Jin
*/

#ifndef abcd_h
Expand Down
2 changes: 1 addition & 1 deletion src/accountingengines.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2016 Jerry Jin
Copyright (C) 2016 -2017 Jerry Jin
*/

#include <nan.h>
Expand Down
2 changes: 1 addition & 1 deletion src/accountingengines.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2016 Jerry Jin
Copyright (C) 2016 -2017 Jerry Jin
*/

#ifndef accountingengines_h
Expand Down
2 changes: 1 addition & 1 deletion src/alphaform.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2016 Jerry Jin
Copyright (C) 2016 -2017 Jerry Jin
*/

#include <nan.h>
Expand Down
2 changes: 1 addition & 1 deletion src/alphaform.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2016 Jerry Jin
Copyright (C) 2016 -2017 Jerry Jin
*/

#ifndef alphaform_h
Expand Down
2 changes: 1 addition & 1 deletion src/assetswap.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2016 Jerry Jin
Copyright (C) 2016 -2017 Jerry Jin
*/

#include <nan.h>
Expand Down
2 changes: 1 addition & 1 deletion src/assetswap.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2016 Jerry Jin
Copyright (C) 2016 -2017 Jerry Jin
*/

#ifndef assetswap_h
Expand Down
2 changes: 1 addition & 1 deletion src/basketlossmodels.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2016 Jerry Jin
Copyright (C) 2016 -2017 Jerry Jin
*/

#include <nan.h>
Expand Down
2 changes: 1 addition & 1 deletion src/basketlossmodels.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2016 Jerry Jin
Copyright (C) 2016 -2017 Jerry Jin
*/

#ifndef basketlossmodels_h
Expand Down
2 changes: 1 addition & 1 deletion src/bonds.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2016 Jerry Jin
Copyright (C) 2016 -2017 Jerry Jin
*/

#include <nan.h>
Expand Down
2 changes: 1 addition & 1 deletion src/bonds.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2016 Jerry Jin
Copyright (C) 2016 -2017 Jerry Jin
*/

#ifndef bonds_h
Expand Down
2 changes: 1 addition & 1 deletion src/browniangenerators.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2016 Jerry Jin
Copyright (C) 2016 -2017 Jerry Jin
*/

#include <nan.h>
Expand Down
2 changes: 1 addition & 1 deletion src/browniangenerators.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2016 Jerry Jin
Copyright (C) 2016 -2017 Jerry Jin
*/

#ifndef browniangenerators_h
Expand Down
2 changes: 1 addition & 1 deletion src/btp.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2016 Jerry Jin
Copyright (C) 2016 -2017 Jerry Jin
*/

#include <nan.h>
Expand Down
2 changes: 1 addition & 1 deletion src/btp.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2016 Jerry Jin
Copyright (C) 2016 -2017 Jerry Jin
*/

#ifndef btp_h
Expand Down
2 changes: 1 addition & 1 deletion src/calendar.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2016 Jerry Jin
Copyright (C) 2016 -2017 Jerry Jin
*/

#include <nan.h>
Expand Down
2 changes: 1 addition & 1 deletion src/calendar.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2016 Jerry Jin
Copyright (C) 2016 -2017 Jerry Jin
*/

#ifndef calendar_h
Expand Down
2 changes: 1 addition & 1 deletion src/calibrationhelpers.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2016 Jerry Jin
Copyright (C) 2016 -2017 Jerry Jin
*/

#include <nan.h>
Expand Down
2 changes: 1 addition & 1 deletion src/calibrationhelpers.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2016 Jerry Jin
Copyright (C) 2016 -2017 Jerry Jin
*/

#ifndef calibrationhelpers_h
Expand Down
2 changes: 1 addition & 1 deletion src/capfloor.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2016 Jerry Jin
Copyright (C) 2016 -2017 Jerry Jin
*/

#include <nan.h>
Expand Down
2 changes: 1 addition & 1 deletion src/capfloor.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2016 Jerry Jin
Copyright (C) 2016 -2017 Jerry Jin
*/

#ifndef capfloor_h
Expand Down
Loading