Skip to content

Commit 62ca4ed

Browse files
authored
Merge pull request #5 from quantlibnode/1.8
update for QuantLib 1.8
2 parents d1eb11c + 3482ebb commit 62ca4ed

File tree

138 files changed

+1116
-154
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+1116
-154
lines changed

CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ ENDIF ()
7171

7272
IF (MSVC_IDE)
7373
IF ( CMAKE_CONFIGURATION_TYPES STREQUAL "Debug" )
74-
TARGET_LINK_LIBRARIES(quantlib QuantLib-vc120-mt-gd.lib)
75-
TARGET_LINK_LIBRARIES(quantlib QuantLibObjects-vc120-mt-gd-1_7_0.lib)
76-
TARGET_LINK_LIBRARIES(quantlib ObjectHandler-vc120-mt-gd-1_7_0.lib)
74+
TARGET_LINK_LIBRARIES(quantlib QuantLib-vc140-mt-gd.lib)
75+
TARGET_LINK_LIBRARIES(quantlib QuantLibObjects-vc140-mt-gd-1_8_0.lib)
76+
TARGET_LINK_LIBRARIES(quantlib ObjectHandler-vc140-mt-gd-1_8_0.lib)
7777
ELSE ()
78-
TARGET_LINK_LIBRARIES(quantlib QuantLib-vc120-mt-s.lib)
79-
TARGET_LINK_LIBRARIES(quantlib QuantLibObjects-vc120-mt-s-1_7_0.lib)
80-
TARGET_LINK_LIBRARIES(quantlib ObjectHandler-vc120-mt-s-1_7_0.lib)
78+
TARGET_LINK_LIBRARIES(quantlib QuantLib-vc140-mt-s.lib)
79+
TARGET_LINK_LIBRARIES(quantlib QuantLibObjects-vc140-mt-s-1_8_0.lib)
80+
TARGET_LINK_LIBRARIES(quantlib ObjectHandler-vc140-mt-s-1_8_0.lib)
8181
ENDIF ()
8282
ENDIF ()
8383

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2016 Jerry Jin
3+
Copyright (c) 2016 - 2017 Jerry Jin
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,10 @@ All functions in this project are Async, they are exported to [Promise](https://
1313
npm install quantlib
1414
```
1515

16-
* Windows - 32-Bit
16+
* Windows
1717

1818
`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.
1919

20-
* Windows - 64-Bit
21-
22-
I will try to build and upload the pre-built addon, before that, Please refer to [how to build](#building-the-native-addon) below
23-
2420
* Linux & Mac
2521

2622
Please refer to [how to build](#building-the-native-addon) below
@@ -37,6 +33,35 @@ Please refer to [how to build](#building-the-native-addon) below
3733
| QuantLib | QuantLibAddin | Node.js | quantlib.node |
3834
| -------- | ------------- | ------- | ------------- |
3935
| 1.7.1 | 1.7.0 | 6.9.1 | 0.1.x |
36+
| 1.8.1 | 1.8.0 | 6.9.5 | 0.2.x |
37+
38+
## Building the native addon
39+
40+
#### Prerequisite
41+
42+
* CMake 2.8 or above, Visual C++ for windows, Xcode for Mac, GCC for Linux
43+
* Node.js according to [version matrix](#version-matrix)
44+
* [nan](https://github.com/nodejs/nan) ^2.2.0
45+
* [node-gyp](https://github.com/nodejs/node-gyp) ~3.0.3
46+
* QuantLib, QuantLibAddin, ObjectHandler source code according to [version matrix](#version-matrix), they need to be put in the same directory
47+
* `boost` - which is required to build QuantLib
48+
49+
#### Set environment variable
50+
51+
please refer to `cmake/*.cmake` and `CMakeList.txt` files
52+
53+
* `NAN_DIR` - location of `nan`
54+
* `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
55+
* `QUANTLIB_ROOT` - location of QuantLib, QuantLibAddin, ObjectHandler source code
56+
* `BOOST_ROOT` - location `boost` installed
57+
58+
#### Use cmake to build the addon
59+
60+
1. Build QuantLib and QuantLibAddin, please check `CMakeList.txt` for library name, and make sure generated library names are the same in `CMakeList.txt`
61+
2. from `quantlibnode` root directory `cd build`
62+
3. `cmake ..` for Windows and Linux, `cmake -G Xcode ..` for Mac OS X
63+
4. `cmake --build . --config Release`
64+
5. For Linux, you may need to put `quantlib.node` under `build/Release` manually,
4065

4166
## Building the native addon
4267

cmake/FindNode.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# NODE_GYP_FOUND - True if node found.
55

66
# Read environment variables to find node_gyp include/lib directories
7-
SET(NODE_GYP_VER "6.9.1")
7+
SET(NODE_GYP_VER "6.9.5")
88
MESSAGE( STATUS "NODE_GYP_VER: " ${NODE_GYP_VER} )
99
SET(NODE_GYP_DIR $ENV{NODE_GYP_DIR}/${NODE_GYP_VER})
1010
MESSAGE( STATUS "NODE_GYP_DIR: " ${NODE_GYP_DIR} )

lib/quantlib.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
// This is a generated file, modify: generate/templates/quantlib.js
1+
/*
2+
Copyright (C) 2016 -2017 Jerry Jin
3+
*/
4+
25

36
var promisify = require("promisify-node");
47
var rawApi = require("../build/Release/quantlib");
@@ -1060,6 +1063,12 @@ exports.PiecewiseConstantVarianceVariance = promisify(rawApi.PiecewiseConstantVa
10601063
exports.PiecewiseConstantVarianceVolatility = promisify(rawApi.PiecewiseConstantVarianceVolatility);
10611064
exports.PiecewiseConstantVarianceTotalVariance = promisify(rawApi.PiecewiseConstantVarianceTotalVariance);
10621065
exports.PiecewiseConstantVarianceTotalVolatility = promisify(rawApi.PiecewiseConstantVarianceTotalVolatility);
1066+
1067+
exports.PiecewiseYieldCurveMixedInterpolation = promisify(PiecewiseYieldCurveMixedInterpolation);
1068+
exports.BachelierCapFloorEngine = promisify(BachelierCapFloorEngine);
1069+
exports.BachelierCapFloorEngine2 = promisify(BachelierCapFloorEngine2);
1070+
exports.BachelierBlackFormulaImpliedVol = promisify(BachelierBlackFormulaImpliedVol);
1071+
10631072
exports.ObjectPropertyNames = promisify(rawApi.ObjectPropertyNames);
10641073
exports.DeleteObject = promisify(rawApi.DeleteObject);
10651074
exports.DeleteObjects = promisify(rawApi.DeleteObjects);

package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
{
22
"name": "quantlib",
33
"description": "QuantLib Asyn Bindings for Node.js",
4-
"version": "0.1.5",
4+
"version": "0.2.0",
55
"keywords": [
6-
"quantlib",
7-
"native",
8-
"addon"
6+
"quantlib"
97
],
108
"main": "lib/quantlib.js",
119
"repository": {

quantlibnode.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/*
2+
Copyright (C) 2016 -2017 Jerry Jin
3+
*/
4+
15
#include <v8.h>
26
#include <node.h>
37
#include <nan.h>
@@ -1080,6 +1084,11 @@ NAN_MODULE_INIT(init){
10801084
Nan::SetMethod(target, "PiecewiseConstantVarianceTotalVariance", QuantLibNode::PiecewiseConstantVarianceTotalVariance);
10811085
Nan::SetMethod(target, "PiecewiseConstantVarianceTotalVolatility", QuantLibNode::PiecewiseConstantVarianceTotalVolatility);
10821086

1087+
Nan::SetMethod(target, "PiecewiseYieldCurveMixedInterpolation", QuantLibNode::PiecewiseYieldCurveMixedInterpolation);
1088+
Nan::SetMethod(target, "BachelierCapFloorEngine", QuantLibNode::BachelierCapFloorEngine);
1089+
Nan::SetMethod(target, "BachelierCapFloorEngine2", QuantLibNode::BachelierCapFloorEngine2);
1090+
Nan::SetMethod(target, "BachelierBlackFormulaImpliedVol", QuantLibNode::BachelierBlackFormulaImpliedVol);
1091+
10831092
Nan::SetMethod(target, "DeleteObject", QuantLibNode::DeleteObject);
10841093
Nan::SetMethod(target, "DeleteObjects", QuantLibNode::DeleteObjects);
10851094
Nan::SetMethod(target, "DeleteAllObjects", QuantLibNode::DeleteAllObjects);

quantlibnode.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
Copyright (C) 2016 -2017 Jerry Jin
3+
*/
4+
5+
16
#ifndef quantlibnode_hpp
27
#define quantlibnode_hpp
38

@@ -1127,6 +1132,11 @@ class QuantLibNode : public Nan::ObjectWrap {
11271132
static NAN_METHOD(PiecewiseConstantVarianceTotalVariance);
11281133
static NAN_METHOD(PiecewiseConstantVarianceTotalVolatility);
11291134

1135+
static NAN_METHOD(PiecewiseYieldCurveMixedInterpolation);
1136+
static NAN_METHOD(BachelierCapFloorEngine);
1137+
static NAN_METHOD(BachelierCapFloorEngine2);
1138+
static NAN_METHOD(BachelierBlackFormulaImpliedVol);
1139+
11301140
static NAN_METHOD(DeleteObject);
11311141
static NAN_METHOD(DeleteObjects);
11321142
static NAN_METHOD(DeleteAllObjects);

src/abcd.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (C) 2016 Jerry Jin
2+
Copyright (C) 2016 -2017 Jerry Jin
33
*/
44

55
#include <nan.h>

src/abcd.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (C) 2016 Jerry Jin
2+
Copyright (C) 2016 -2017 Jerry Jin
33
*/
44

55
#ifndef abcd_h

0 commit comments

Comments
 (0)