Coder Social home page Coder Social logo

lballabio / quantlib-old Goto Github PK

View Code? Open in Web Editor NEW
470.0 470.0 409.0 983.15 MB

The QuantLib C++ library and extensions (warning: out of date)

Home Page: http://quantlib.org

CSS 0.32% Python 1.62% C++ 82.56% Shell 0.20% HTML 3.28% C 8.92% Objective-C 0.01% C# 0.08% Scheme 0.38% Java 0.15% Perl 6 0.01% Perl 0.09% R 0.06% Ruby 0.11% Scala 0.08% Makefile 0.72% TeX 0.70% Groff 0.13% Visual Basic 0.50% Awk 0.09%

quantlib-old's Introduction

quantlib-old's People

Contributors

andres-hernandez avatar aradicchi avatar bernd8 avatar bgc-nglass avatar compatibl avatar eddelbuettel avatar eehlers avatar ethicalbanker avatar fametrano avatar gouthambs avatar gpazmandi avatar igitur avatar japari avatar joequant avatar jschnetm avatar klausspanderen avatar lballabio avatar maddazanzi avatar maksqwe avatar marosaci avatar masrtis avatar mdriesch avatar mgroncki avatar nesteruk avatar pcaspers avatar pmazzocchi avatar rglarix avatar scchess avatar simon-sql avatar wegamekinglc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

quantlib-old's Issues

Build fails with boost 1.57

Quantlib 1.4 fails to build against Boost 1.57 with clang.

The error looks like:

In file included from extendedornsteinuhlenbeckprocess.cpp:24:
In file included from /usr/local/include/boost/lambda/bind.hpp:15:
In file included from /usr/local/include/boost/lambda/core.hpp:46:
/usr/local/include/boost/lambda/detail/lambda_traits.hpp:256:58: error: cannot form a reference to 'void'
      typename detail::IF<boost::is_function<T>::value, T&, const T>::RET

Here are full build logs. Thanks!

Wrong implied_volatility calculation

Hi,

As an example to price an European call option, I set all rates to zero and set the option price to its intrinsic value. I expected the result implied-vol to be 0 but got 0.349138 instead. Is this normal?

from QuantLib import *

Settings.instance().evaluationDate = Date(17, June, 2015)

exercise = EuropeanExercise(Date(18, September, 2015))
payoff = PlainVanillaPayoff(Option.Call, 500.0)
option = EuropeanOption(payoff, exercise)

S = QuoteHandle(SimpleQuote(2076.65))
r = YieldTermStructureHandle(FlatForward(0, TARGET(), 0.0, Actual360()))
q = YieldTermStructureHandle(FlatForward(0, TARGET(), 0.0, Actual360()))
sigma = BlackVolTermStructureHandle(BlackConstantVol(0, TARGET(), 0.0, Actual360()))
process = BlackScholesMertonProcess(S,q,r,sigma)

sigma_val = option.impliedVolatility(1576.65, process)
root@5d12de1fc77c:~/quant/option_price# python npv_test.py
0.349138541667

Type shrink in Bond helper

In the constructure of type BondHelper,:

BondHelper::BondHelper(const Handle<Quote>& price,
                           const boost::shared_ptr<Bond>& bond,
                           const bool useCleanPrice)
    : RateHelper(price), bond_(boost::make_shared<Bond>(*bond))

as in the initialization of bond_ the contend is copied as type Bond, there exists the chance the original type information will be lost. As I see there do exist some virtual method in the base class Bond, e.g.:

 //! accrued amount at a given date
        /*! The default bond settlement is used if no date is given. */
        virtual Real accruedAmount(Date d = Date()) const;
        //@}

        /*! Expected next coupon: depending on (the bond and) the given date
            the coupon can be historic, deterministic or expected in a
            stochastic sense. When the bond settlement date is used the coupon
            is the already-fixed not-yet-paid one.

            The current bond settlement is used if no date is given.
        */
        virtual Rate nextCouponRate(Date d = Date()) const;

They may cause some bug in the code when these method was overridden by inherited class. (Actually I found that issue because I have one class inherited from Bond and overrides the accruedAmount method.

Should we find some way to handle such issue?

Auto-generated headers files such as ql/quantlib.hpp in Git

Hi,
I noticed that the header file ql/quantlib.hpp, are generated by the build process, and depend on the list of source files mentioned in ql/Makefile.am. However this file is in Git, and so if changes are made in Makefile.am, it is necessary to check in the new version of the generated file.

Is there are reason for this, or would it make more sense for these files to be in .gitignore?

I believe there are other similar files, such as */all.hpp, but I haven't checked them. Since I suspected there is probably a good reason for this which I don't know about, I preferred to ask first.

Thanks!

Integration broken in 1.4?

Simply declaring an integration method such as
GaussLegendreIntegration gLegInt(64);
results in an access violation, before even applying it.
This occurs at the following lines of tqreigendecomposition.cpp:
// sort (eigenvalues, eigenvectors),
// code taken from symmetricSchureDecomposition.cpp
std::vector<std::pair<Real, std::vector > > temp(n);
std::vector eigenVector(ev_.rows());
for (i=0; i<n; i++) {
if (ev_.rows() > 0)
std::copy(ev_.column_begin(i),
ev_.column_end(i), eigenVector.begin());
====>>>>> (access violation here) temp[i] = std::make_pair(d_[i], eigenVector);
}

EigenVector is massive, size=2305843009213692540 but I'm not sure if this is the problem.
This occurs with any of the integration methods.
I'm using Windows 7 64-bit, intel parallel studio.

Ruby SWIG - Errors on build

Building the ruby version on mac osx 10.10.5:

  • ruby 2.2.2
  • quantlib 1.6.1 (installed via 'brew install quantlib' and via the quantlib.org instructions)
  • swig 3.0.7

Not sure if there's an error on my side or it's not compatible with the versions I'm using. To isolate the issue I installed the RQuantLib package for R and it works within R.

ruby setup.rb wrap

swig -ruby -c++ -I../SWIG -o ./quantlib_wrap.cpp quantlib.i
SWIG:1: Warning 125: Use of the include path to find the input file is deprecated and will not work with ccache. Please include the path when specifying the input file.

ruby setup.rb build

creating Makefile
compiling quantlib_wrap.cpp
quantlib_wrap.cpp:2652:6: error: using an old version of QuantLib, please update
    #error using an old version of QuantLib, please update
     ^
In file included from quantlib_wrap.cpp:2649:
In file included from /usr/local/Cellar/quantlib/1.6.1/include/ql/quantlib.hpp:47:
In file included from /usr/local/Cellar/quantlib/1.6.1/include/ql/math/all.hpp:35:
In file included from /usr/local/Cellar/quantlib/1.6.1/include/ql/math/matrixutilities/all.hpp:4:
In file included from /usr/local/Cellar/quantlib/1.6.1/include/ql/math/matrixutilities/basisincompleteordered.hpp:25:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/valarray:4035:59: error: 
      'value_type' is a private member of
      'boost::iterators::detail::operator_brackets_proxy<QuantLib::step_iterator<double
      *> >'
    __val_expr<_BinaryOp<__bit_shift_left<typename _Expr::value_type>,
                                                          ^
quantlib_wrap.cpp:8230:23: note: while substituting deduced template arguments
      into function template 'operator<<' [with _Expr =
      boost::iterators::detail::operator_brackets_proxy<QuantLib::step_iterator<double
      *> >]
                    s << (*self)[i][j];
                      ^
In file included from quantlib_wrap.cpp:2649:
In file included from /usr/local/Cellar/quantlib/1.6.1/include/ql/quantlib.hpp:47:
In file included from /usr/local/Cellar/quantlib/1.6.1/include/ql/math/all.hpp:35:
In file included from /usr/local/Cellar/quantlib/1.6.1/include/ql/math/matrixutilities/all.hpp:4:
In file included from /usr/local/Cellar/quantlib/1.6.1/include/ql/math/matrixutilities/basisincompleteordered.hpp:25:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/valarray:4036:46: error: 
      'value_type' is a private member of
      'boost::iterators::detail::operator_brackets_proxy<QuantLib::step_iterator<double
      *> >'
               __scalar_expr<typename _Expr::value_type>, _Expr> >
                                             ^
quantlib_wrap.cpp:71997:13: error: no member named 'Israel' in namespace
      'QuantLib'
  QuantLib::Israel::Market arg1 ;
  ~~~~~~~~~~^
quantlib_wrap.cpp:72000:13: error: no type named 'Israel' in namespace
      'QuantLib'
  QuantLib::Israel *result = 0 ;
  ~~~~~~~~~~^
quantlib_wrap.cpp:72009:33: error: no member named 'Israel' in namespace
      'QuantLib'
  arg1 = static_cast< QuantLib::Israel::Market >(val1);
                      ~~~~~~~~~~^
quantlib_wrap.cpp:72012:27: error: no member named 'Israel' in namespace
      'QuantLib'
      result = (QuantLib::Israel *)new QuantLib::Israel(arg1);
                ~~~~~~~~~~^
quantlib_wrap.cpp:72012:35: error: expected expression
      result = (QuantLib::Israel *)new QuantLib::Israel(arg1);
                                  ^
quantlib_wrap.cpp:72047:13: error: no type named 'Israel' in namespace
      'QuantLib'
  QuantLib::Israel *result = 0 ;
  ~~~~~~~~~~^
quantlib_wrap.cpp:72054:27: error: no member named 'Israel' in namespace
      'QuantLib'
      result = (QuantLib::Israel *)new QuantLib::Israel();
                ~~~~~~~~~~^
quantlib_wrap.cpp:72054:35: error: expected expression
      result = (QuantLib::Israel *)new QuantLib::Israel();
                                  ^
quantlib_wrap.cpp:72104:32: error: no type named 'Israel' in namespace
      'QuantLib'
free_QuantLib_Israel(QuantLib::Israel *arg1) {
                     ~~~~~~~~~~^
quantlib_wrap.cpp:72670:13: error: no type named 'Romania' in namespace
      'QuantLib'
  QuantLib::Romania *result = 0 ;
  ~~~~~~~~~~^
quantlib_wrap.cpp:72677:27: error: no member named 'Romania' in namespace
      'QuantLib'
      result = (QuantLib::Romania *)new QuantLib::Romania();
                ~~~~~~~~~~^
quantlib_wrap.cpp:72677:36: error: expected expression
      result = (QuantLib::Romania *)new QuantLib::Romania();
                                   ^
quantlib_wrap.cpp:72694:33: error: no type named 'Romania' in namespace
      'QuantLib'
free_QuantLib_Romania(QuantLib::Romania *arg1) {
                      ~~~~~~~~~~^
quantlib_wrap.cpp:274968:47: error: no member named 'Israel' in namespace
      'QuantLib'
    return (void *)((Calendar *)  ((QuantLib::Israel *) x));
                                    ~~~~~~~~~~^
quantlib_wrap.cpp:274968:55: error: expected expression
    return (void *)((Calendar *)  ((QuantLib::Israel *) x));
                                                      ^
quantlib_wrap.cpp:275037:47: error: no member named 'Romania' in namespace
      'QuantLib'
    return (void *)((Calendar *)  ((QuantLib::Romania *) x));
                                    ~~~~~~~~~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [quantlib_wrap.o] Error 1

quantlib fails to build against Boost 1.59.0

Hello! Homebrew noticed that the quantlib test suite fails to build against Boost 1.59.0.

Here is a build log with the failure highlighted: https://gist.github.com/anonymous/63f8844069d07cc0b3ed#file-02-make-L3577-L3578

The error looks like:

binaryoption.cpp:93:5: error: use of undeclared identifier 'BOOST_MESSAGE'
    BOOST_MESSAGE("Testing cash-or-nothing barrier options against Haug's values...");

This looks unrelated to the fix in #292 to me. FWIW, at least one other package is affected in a similar way. Homebrew is tracking packages which fail to build against Boost 1.59.0 at Homebrew/legacy-homebrew#42960. Thanks!

Trouble with SWIG for Go

swig -c++ -go -cgo -intgosize 64 succeeded in generating quantlib_wrap.cxx and Quantlib.go files, but go build fails with many "undefined reference to " errors.

I have zero C++ experience, so I'm hoping there's an obvious fix I'm unaware of.

Full disclosure: I added the line #cgo CPPFLAGS: -I../../QuantLib -I/usr/include to Quantlib.go.

A sample:

/tmp/go-build907426143/github.com/lballabio/quantlib/QuantLib-SWIG/SWIG/_obj/quantlib_wrap.cxx.o:(.data.rel.ro._ZTCN8QuantLib19PiecewiseYieldCurveINS_9ZeroYieldENS_6LinearENS_18IterativeBootstrapEEE0_NS_18ZeroYieldStructureE[_ZTVN8QuantLib19PiecewiseYieldCurveINS_9ZeroYieldENS_6LinearENS_18IterativeBootstrapEEE]+0x48): undefined reference to `QuantLib::TermStructure::referenceDate() const'
/tmp/go-build907426143/github.com/lballabio/quantlib/QuantLib-SWIG/SWIG/_obj/quantlib_wrap.cxx.o:(.data.rel.ro._ZTCN8QuantLib19PiecewiseYieldCurveINS_9ZeroYieldENS_6LinearENS_18IterativeBootstrapEEE0_NS_18ZeroYieldStructureE[_ZTVN8QuantLib19PiecewiseYieldCurveINS_9ZeroYieldENS_6LinearENS_18IterativeBootstrapEEE]+0x60): undefined reference to `QuantLib::YieldTermStructure::update()'
/tmp/go-build907426143/github.com/lballabio/quantlib/QuantLib-SWIG/SWIG/_obj/quantlib_wrap.cxx.o:(.data.rel.ro._ZTCN8QuantLib19PiecewiseYieldCurveINS_9ZeroYieldENS_6LinearENS_18IterativeBootstrapEEE0_NS_18ZeroYieldStructureE[_ZTVN8QuantLib19PiecewiseYieldCurveINS_9ZeroYieldENS_6LinearENS_18IterativeBootstrapEEE]+0xa8): undefined reference to `virtual thunk to QuantLib::YieldTermStructure::update()'
/tmp/go-build907426143/github.com/lballabio/quantlib/QuantLib-SWIG/SWIG/_obj/quantlib_wrap.cxx.o:(.data.rel.ro._ZTCN8QuantLib19PiecewiseYieldCurveINS_9ZeroYieldENS_6LinearENS_18IterativeBootstrapEEE0_NS_21InterpolatedZeroCurveIS2_EE[_ZTVN8QuantLib19PiecewiseYieldCurveINS_9ZeroYieldENS_6LinearENS_18IterativeBootstrapEEE]+0x48): undefined reference to `QuantLib::TermStructure::referenceDate() const'
/tmp/go-build907426143/github.com/lballabio/quantlib/QuantLib-SWIG/SWIG/_obj/quantlib_wrap.cxx.o:(.data.rel.ro._ZTCN8QuantLib19PiecewiseYieldCurveINS_9ZeroYieldENS_6LinearENS_18IterativeBootstrapEEE0_NS_21InterpolatedZeroCurveIS2_EE[_ZTVN8QuantLib19PiecewiseYieldCurveINS_9ZeroYieldENS_6LinearENS_18IterativeBootstrapEEE]+0x60): undefined reference to `QuantLib::YieldTermStructure::update()'
/tmp/go-build907426143/github.com/lballabio/quantlib/QuantLib-SWIG/SWIG/_obj/quantlib_wrap.cxx.o:(.data.rel.ro._ZTCN8QuantLib19PiecewiseYieldCurveINS_9ZeroYieldENS_6LinearENS_18IterativeBootstrapEEE0_NS_21InterpolatedZeroCurveIS2_EE[_ZTVN8QuantLib19PiecewiseYieldCurveINS_9ZeroYieldENS_6LinearENS_18IterativeBootstrapEEE]+0xa8): undefined reference to `virtual thunk to QuantLib::YieldTermStructure::update()'
/tmp/go-build907426143/github.com/lballabio/quantlib/QuantLib-SWIG/SWIG/_obj/quantlib_wrap.cxx.o:(.data.rel.ro._ZTVN8QuantLib19PiecewiseYieldCurveINS_9ZeroYieldENS_6LinearENS_18IterativeBootstrapEEE[_ZTVN8QuantLib19PiecewiseYieldCurveINS_9ZeroYieldENS_6LinearENS_18IterativeBootstrapEEE]+0x48): undefined reference to `QuantLib::TermStructure::referenceDate() const'
/tmp/go-build907426143/github.com/lballabio/quantlib/QuantLib-SWIG/SWIG/_obj/quantlib_wrap.cxx.o:(.data.rel.ro._ZTCN8QuantLib19PiecewiseYieldCurveINS_9ZeroYieldENS_5CubicENS_18IterativeBootstrapEEE0_NS_13TermStructureE[_ZTVN8QuantLib19PiecewiseYieldCurveINS_9ZeroYieldENS_5CubicENS_18IterativeBootstrapEEE]+0x48): undefined reference to `QuantLib::TermStructure::referenceDate() const'
/tmp/go-build907426143/github.com/lballabio/quantlib/QuantLib-SWIG/SWIG/_obj/quantlib_wrap.cxx.o:(.data.rel.ro._ZTCN8QuantLib19PiecewiseYieldCurveINS_9ZeroYieldENS_5CubicENS_18IterativeBootstrapEEE0_NS_13TermStructureE[_ZTVN8QuantLib19PiecewiseYieldCurveINS_9ZeroYieldENS_5CubicENS_18IterativeBootstrapEEE]+0x60): undefined reference to `QuantLib::TermStructure::update()'
/tmp/go-build907426143/github.com/lballabio/quantlib/QuantLib-SWIG/SWIG/_obj/quantlib_wrap.cxx.o:(.data.rel.ro._ZTCN8QuantLib19PiecewiseYieldCurveINS_9ZeroYieldENS_5CubicENS_18IterativeBootstrapEEE0_NS_13TermStructureE[_ZTVN8QuantLib19PiecewiseYieldCurveINS_9ZeroYieldENS_5CubicENS_18IterativeBootstrapEEE]+0x98): undefined reference to `virtual thunk to QuantLib::TermStructure::update()'
/tmp/go-build907426143/github.com/lballabio/quantlib/QuantLib-SWIG/SWIG/_obj/quantlib_wrap.cxx.o:(.data.rel.ro._ZTCN8QuantLib19PiecewiseYieldCurveINS_9ZeroYieldENS_5CubicENS_18IterativeBootstrapEEE0_NS_18YieldTermStructureE[_ZTVN8QuantLib19PiecewiseYieldCurveINS_9ZeroYieldENS_5CubicENS_18IterativeBootstrapEEE]+0x18): undefined reference to `typeinfo for QuantLib::YieldTermStructure'
/tmp/go-build907426143/github.com/lballabio/quantlib/QuantLib-SWIG/SWIG/_obj/quantlib_wrap.cxx.o:(.data.rel.ro._ZTCN8QuantLib19PiecewiseYieldCurveINS_9ZeroYieldENS_5CubicENS_18IterativeBootstrapEEE0_NS_18YieldTermStructureE[_ZTVN8QuantLib19PiecewiseYieldCurveINS_9ZeroYieldENS_5CubicENS_18IterativeBootstrapEEE]+0x48): undefined reference to `QuantLib::TermStructure::referenceDate() const'

HKD Typo - should be Hong Kong dollar

// Honk Kong dollar
/* The ISO three-letter code is HKD; the numeric code is 344.
  It is divided in 100 cents.
*/
HKDCurrency::HKDCurrency() {
    static boost::shared_ptr<Data> hkdData(
                              new Data("Honk Kong dollar", "HKD", 344,
                                       "HK$", "", 100,
                                       Rounding(),
                                       "%3% %1$.2f"));

ShortRateModel does not expose fixed parameter constraints in SWIG wrapper

The SWIG wrapper for calibrate(...) in the ShortRateModel reads:

void calibrate(
    const std::vector<boost::shared_ptr<CalibrationHelper> >&,
    OptimizationMethod&, const EndCriteria &,
    const Constraint& constraint = Constraint(),
    const std::vector<Real>& weights = std::vector<Real>());

However the C++ signature reads:

virtual void calibrate(
            const std::vector<boost::shared_ptr<CalibrationHelper> >&,
            OptimizationMethod& method,
            const EndCriteria& endCriteria,
            const Constraint& constraint = Constraint(),
            const std::vector<Real>& weights = std::vector<Real>(),
            const std::vector<bool>& fixParameters = std::vector<bool>());

The fixParameters argument allows for calibration with one value constrained. This issue will fix this discrepancy.

Will provide PR.

Compile error building QuantLib-SWIG for Python on OSX 10.10.5 Yosemite

Hello,

I was able to build and install libQuantLib (source label QuantLib-v1.6.1) with no trouble. I am using Boost 1.58 and clang++ 6.1.0 on OSX 10.10.5. However, the Python wrapper for QuantLib-SWIG fails to compile with the error below. I have tried both the latest and the relevant *-v1.6.1 tags, all to no avail.

/usr/local/bin/swig -python -c++ -modern -outdir QuantLib \
            -o QuantLib/quantlib_wrap.cpp ../SWIG/quantlib.i
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-am
CXXFLAGS="-g -O2 -fno-strict-aliasing -Wno-unused -Wno-uninitialized -Wno-sign-compare -Wno-write-strings" /usr/local/bin/python setup.py build
running build
running build_py
copying QuantLib/QuantLib.py -> build/lib.macosx-10.10-x86_64-2.7/QuantLib
running build_ext
building 'QuantLib._QuantLib' extension
/usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/usr/local/include -c QuantLib/quantlib_wrap.cpp -o build/temp.macosx-10.10-x86_64-2.7/QuantLib/quantlib_wrap.o -Wno-unused -g -O2 -fno-strict-aliasing -Wno-unused -Wno-uninitialized -Wno-sign-compare -Wno-write-strings
In file included from QuantLib/quantlib_wrap.cpp:3883:
In file included from /usr/local/include/ql/quantlib.hpp:47:
In file included from /usr/local/include/ql/math/all.hpp:35:
In file included from /usr/local/include/ql/math/matrixutilities/all.hpp:4:
In file included from /usr/local/include/ql/math/matrixutilities/basisincompleteordered.hpp:25:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/valarray:4035:59: error: 
      'value_type' is a private member of
      'boost::iterators::detail::operator_brackets_proxy<QuantLib::step_iterator<double *> >'
    __val_expr<_BinaryOp<__bit_shift_left<typename _Expr::value_type>,
                                                          ^
QuantLib/quantlib_wrap.cpp:7078:23: note: while substituting deduced template arguments into function template
      'operator<<' [with _Expr = boost::iterators::detail::operator_brackets_proxy<QuantLib::step_iterator<double
      *> >]
                    s << (*self)[i][j];
                      ^
In file included from QuantLib/quantlib_wrap.cpp:3883:
In file included from /usr/local/include/ql/quantlib.hpp:47:
In file included from /usr/local/include/ql/math/all.hpp:35:
In file included from /usr/local/include/ql/math/matrixutilities/all.hpp:4:
In file included from /usr/local/include/ql/math/matrixutilities/basisincompleteordered.hpp:25:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/valarray:4036:46: error: 
      'value_type' is a private member of
      'boost::iterators::detail::operator_brackets_proxy<QuantLib::step_iterator<double *> >'
               __scalar_expr<typename _Expr::value_type>, _Expr> >
                                             ^

Is this expected? Am I using the right toolchain? I tried to follow the build instructions on the web site, but they appear to be out of date.

Thanks,
Alex.

unable to build QuantLib on mac os x 10.9.5

So far I'm unable to build QuantLib 1.5 on os x 10.9.5 following the official instructions http://quantlib.org/install/macosx.shtml

 ./configure --enable-static --with-boost-include=/opt/local/include/ \
        --with-boost-lib=/opt/local/lib/ --prefix=/opt/local/ \
        CXXFLAGS="-stlib=libstdc++ -mmacosx-version-min=10.6" \
        LDFLAGS="-stlib=libstdc++ -mmacosx-version-min=10.6"

configure: WARNING: you should use --build, --host, --target
configure: WARNING: invalid host type:  
configure: WARNING: you should use --build, --host, --target
configure: WARNING: invalid host type:  
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... config/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gawk... (cached) awk
checking for -gcc... no
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `~/Downloads/qlib/QuantLib-1.5':
configure: error: C compiler cannot create executables
See `config.log' for more details

$ make && sudo make install
make: *** No targets specified and no makefile found.  Stop.

So what may be wrong? And how can I fix it?

Add default parameter values to SWIG interface for floating-rate bond

The FloatingRateBond constructor is exported to Python with %feature("kwargs"), which allows one to pass keyword arguments. However, this is not half as useful without exporting the default parameters defined in the C++ class; we can use keyword args, but we're still forced to pass all of them.

Bond DiscountCurve example in documentation does not work

The Bond example present in the documentation (pages 15 and16) doesn't seem to be working correctly.

I get the following error:

    Error: 1st iteration: failed at 10th alive instrument, maturity September 22nd, 2006, reference date September 22nd, 2004: root not bracketed: f[0.929837,0.934946] -> [1.205744e-004,2.907287e-003]

To reproduce the error:

## This data is taken from sample code shipped with QuantLib 0.9.7
## from the file Examples/Swap/swapvaluation
params <- list(tradeDate=as.Date('2004-09-20'),
settleDate=as.Date('2004-09-22'),
dt=.25,
interpWhat="discount",
interpHow="loglinear")
setEvaluationDate(as.Date("2004-11-22"))
## We got numerical issues for the spline interpolation if we add
## any on of these three extra futures, at least with QuantLib 0.9.7
## The curve data comes from QuantLib's Examples/Swap/swapvaluation.cpp
tsQuotes <- list(d1w = 0.0382,
d1m = 0.0372,
fut1=96.2875,
fut2=96.7875,
fut3=96.9875,
fut4=96.6875,
fut5=96.4875,
fut6=96.3875,
fut7=96.2875,
fut8=96.0875,
s2y = 0.037125,
s3y = 0.0398,
s5y = 0.0443,
s10y = 0.05165,
s15y = 0.055175)
times <- seq(0,10,.1)
discountCurve <- DiscountCurve(params, tsQuotes, times)

How can I check the version number of an installed QuantLib?

We are often building and installing different versions of QuantLib and sometimes forget what should be on which machine etc.

How can I get the QuantLib version from a QuantLib.so shared object? Either by writing some C/C++ or using some tool to examine the binary is completely fine to me.

Add CMakeLists.txt

CMake can be used to generate UNIX and windows build systems (Makefiles, Solutions etc).

Could CMake be used to replace existing projects and makefiles?

Possible bug in `PerturbativeBarrierOptionEngine`

In ql/experimental/barrieroption/perturbativebarrieroptionengine.cpp, the value assigned to caux at line 172 is never used. It might be just a dead assignment (in which acse we can delete it) but since there's another variable called ccaux and used in the rest of the function, it's also possible that the wrong variable was assigned or used. We should check the implementation based on the reference quoted in the header file.

Negative Time Given - Forward rate - C#, QuantLib

Would you mind advising on following please.

Double rate = Pricer.GetForwardRate(Pricer.GenerateRateCurve());

public class CRate
{
public Double ExpiryYear;
public Double Rate;
}

public class Pricer
{
public static YieldTermStructure GenerateRateCurve()
{
CRate[] cRate = new CRate[11];
SortedList<double, double> matrix = new SortedList<double, double>();

        cRate[0] = new CRate() { ExpiryYear = 0.0192, Rate = 0.002275 };
        cRate[1] = new CRate() { ExpiryYear = 0.2521, Rate = 0.002275 };
        cRate[2] = new CRate() { ExpiryYear = 0.5041, Rate = 0.002775 };
        cRate[3] = new CRate() { ExpiryYear = 0.7507, Rate = 0.003275 };
        cRate[4] = new CRate() { ExpiryYear = 1.0027, Rate = 0.003275 };
        cRate[5] = new CRate() { ExpiryYear = 1.5068, Rate = 0.0032625 };
        cRate[6] = new CRate() { ExpiryYear = 2.0027, Rate = 0.003275 };
        cRate[7] = new CRate() { ExpiryYear = 3.0027, Rate = 0.003435 };
        cRate[8] = new CRate() { ExpiryYear = 4.0027, Rate = 0.003785 };
        cRate[9] = new CRate() { ExpiryYear = 5.0055, Rate = 0.00425 };
        cRate[10] = new CRate() { ExpiryYear = 10.0082, Rate = 0.007485 };

        foreach (CRate r in cRate)
        {
            if (!matrix.ContainsKey(r.ExpiryYear))
            {
                matrix.Add(r.ExpiryYear, r.ExpiryYear);
            }
        }

        DateVector matVec = new DateVector();

        foreach (double mat in matrix.Keys)
        {
            matVec.Add(Date.todaysDate().Add(((int)(365.0 * mat))));
        }

        DoubleVector rates = new DoubleVector();

        for (uint i = 0; i < matrix.Count; ++i)
        {
            rates.Add(GetRate(cRate, matrix.Keys[(int)i]));
        }
        YieldTermStructure yield = new ZeroCurve(matVec, rates, new Business252(), new Japan());

        yield.enableExtrapolation();

        return yield;
    }

    public static Double GetForwardRate(YieldTermStructure yield)
    {
        double rr = yield.forwardRate(Date.todaysDate(), new Date(11, QuantLib.Month.December, 2015), yield.dayCounter(), Compounding.Continuous).rate();
        return rr;
    }

    static double GetRate(CRate[] cRate, double mat)
    {
        foreach (CRate r in cRate)
        {
            if (r.ExpiryYear == mat)
            {
                return r.Rate;
            }
        }

        return 0;
    }
}

Bounds error in BinomialVanillaEngine::calculate

This line:

option.rollback(grid[2]);

fails when the binomial engine is told to use a step size of 1. Since a larger step size is probably used most of the time, a quick fix is to change the lower bound to 1 in this line and modify the error message to say something like "step size must be positive and greater than 1".

C# System.AccessViolationException still exists on new version QuantLib-SWIG-1.6

I upgraded to new version QuantLib-SWIG-1.6 - Still has many System.AccessViolationException. System.AccessViolationException - Is very hard to reproduce and generally comes randomly during very high load, consistent with comment

"This usually occurs because a pointer has a bad value. Not all reads or writes through bad pointers lead to access violations, so an access violation usually indicates that several reads or writes have occurred through bad pointers, and that memory might be corrupted. Thus, access violations almost always indicate serious programming errors"
https://msdn.microsoft.com/en-us/library/system.accessviolationexception(v=vs.110).aspx

We were using V1.2 with same issues, wondering if anything has been done to solve these issues in V1.6?

Appreciate any help, many thanks.

Application: Pricer.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
Stack:
at QuantLib.NQuantLibcPINVOKE.delete_DividendVanillaOption(System.Runtime.InteropServices.HandleRef)
at QuantLib.DividendVanillaOption.Dispose()
at QuantLib.DividendVanillaOption.Finalize()

Application: Pricer.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
Stack:
at QuantLib.NQuantLibcPINVOKE.delete_BlackVolTermStructureHandle(System.Runtime.InteropServices.HandleRef)
at QuantLib.BlackVolTermStructureHandle.Dispose()
at QuantLib.BlackVolTermStructureHandle.Finalize()

Expose additional methods for VanillaSwap in SWIG

Currently a limited set of methods are exposed for VanillaSwap in SWIG. For instance, methods such as floatingLeg and fixedLeg available in C++ are nicer to use than leg[0] and leg[1] exposed currently. This issue is to address these shortcomings.

I can take a stab at working on this issue if there is some interest to take PR.

mingw GCC 4.6.3 compilation error on windows 7 using 64bit

Hi all,

I am using the mingw GCC 4.6.3 from Rtools to compile latest head revision of quantlib. It works fine for 32bit under windows 7 (64bit) and XP (32bit). However, when I tried to compile the 64bit library under 64bit Win7, I got the following errors. What am I missing here? Any suggestions would be highly appreciated. Please let me know if you need more information to troubleshoot. Thanks!

Making all in Examples
make[1]: Entering directory /c/R/cpp/QuantLib-1.4.x-64/Examples' Making all in BasketLosses make[2]: Entering directory/c/R/cpp/QuantLib-1.4.x-64/Examples/BasketLosses'
g++ -DHAVE_CONFIG_H -I. -I../../ql -I../.. -I../.. -I/c/R/cpp/boost_1_55_0 -m64 -MT BasketLosses.o -MD -MP -MF .deps/BasketLosses.Tpo -c -o BasketLo
sses.o BasketLosses.cpp
In file included from ../../ql/experimental/credit/all.hpp:34:0,
from ../../ql/experimental/all.hpp:11,
from ../../ql/quantlib.hpp:42,
from BasketLosses.cpp:20:
../../ql/experimental/credit/randomdefaultlatentmodel.hpp:812:13: warning: this decimal constant is unsigned only in ISO C90 [enabled by default]
../../ql/experimental/credit/randomdefaultlatentmodel.hpp:830:13: warning: this decimal constant is unsigned only in ISO C90 [enabled by default]
In file included from ../../ql/experimental/credit/all.hpp:36:0,
from ../../ql/experimental/all.hpp:11,
from ../../ql/quantlib.hpp:42,
from BasketLosses.cpp:20:
../../ql/experimental/credit/randomlosslatentmodel.hpp:84:13: warning: this decimal constant is unsigned only in ISO C90 [enabled by default]
BasketLosses.cpp:174:21: warning: this decimal constant is unsigned only in ISO C90 [enabled by default]
BasketLosses.cpp:189:21: warning: this decimal constant is unsigned only in ISO C90 [enabled by default]
BasketLosses.cpp:217:17: warning: this decimal constant is unsigned only in ISO C90 [enabled by default]
BasketLosses.cpp:228:17: warning: this decimal constant is unsigned only in ISO C90 [enabled by default]
mv -f .deps/BasketLosses.Tpo .deps/BasketLosses.Po
/bin/sh ../../libtool --tag=CXX --mode=link g++ -m64 -o BasketLosses.exe BasketLosses.o ../../ql/libQuantLib.la
libtool: link: g++ -m64 -o .libs/BasketLosses.exe BasketLosses.o ../../ql/.libs/libQuantLib.a
../../ql/.libs/libQuantLib.a(sobolrsg.o):sobolrsg.cpp:(.text+0x924): undefined reference to PrimitivePolynomials' ../../ql/.libs/libQuantLib.a(sobolrsg.o):sobolrsg.cpp:(.text+0x99e): undefined reference toPrimitivePolynomials'
collect2: ld returned 1 exit status
make[2]: *** [BasketLosses.exe] Error 1
make[2]: Leaving directory /c/R/cpp/QuantLib-1.4.x-64/Examples/BasketLosses' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory/c/R/cpp/QuantLib-1.4.x-64/Examples'
make: *** [all-recursive] Error 1

BUG: C# - SWIG - Unable to Run both 1.6.x and quantlib-master

A call to PInvoke function 'NQuantLib!QuantLib.NQuantLibcPINVOKE::new_Date__SWIG_1' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

Following is what I did-

  • Set QL_DIR environment directory to ../QuantLib folder.
  • Compile QuantLib in both Release/Debug Mode.
  • Run swig.cmd under ../QuantLib-SWIG\CSharp
  • Compile and Run BermudanSwaption Project under ../QuantLib-SWIG\CSharp VS 2010 solution.

-- I am using Visual Studio 2010

I also downloaded pre built solution from Following for V1.6 and 1.5 - Both throwing same exception

http://sourceforge.net/projects/quantlib/files/QuantLib/1.6/other%20languages/

Using Boost 1.7, and for C# wrappers, I used SWIG swigwin-3.0.7

Could you advice please?

Error compiling Quantlib-SWIG on Linux for Python using Boost 1.55

Hello all,

I am running into a fatal error when trying to compile Quantlib-SWIG for Python. The following error occurs several times during 'make':

/home/###/dev/trunk/CEDerivsReengFramework/external/boost-1.55.0/boost/assign/assignment_exception.hpp: In static member function 'static int swig::traits_asptr_stdseq<Seq, T>::asptr(PyObject*, Seq**) [with Seq = std::vector<boost::shared_ptr<QuantLib::Quote>, std::allocator<boost::shared_ptr<QuantLib::Quote> > >, T = boost::shared_ptr<QuantLib::Quote>]':
QuantLib/quantlib_wrap.cpp:5657:   instantiated from 'static int swig::traits_asptr<std::vector<T, std::allocator<_CharT> > >::asptr(PyObject*, std::vector<T, std::allocator<_CharT> >**) [with T = boost::shared_ptr<QuantLib::Quote>]'
QuantLib/quantlib_wrap.cpp:4680:   instantiated from 'int swig::asptr(PyObject*, Type**) [with Type = std::vector<boost::shared_ptr<QuantLib::Quote>, std::allocator<boost::shared_ptr<QuantLib::Quote> > >]'
QuantLib/quantlib_wrap.cpp:43984:   instantiated from here
/home/###/dev/trunk/CEDerivsReengFramework/external/boost-1.55.0/boost/assign/assignment_exception.hpp:24: error: 'boost::assign' is not a function,
QuantLib/quantlib_wrap.cpp:5575: error:   conflict with 'template<class SwigPySeq, class Seq> void swig::assign(const SwigPySeq&, Seq*)'
QuantLib/quantlib_wrap.cpp:5602: error:   in call to 'assign'

I've noticed someone else had this issue on OS X: http://stackoverflow.com/questions/31331535/quantlib-swig-python-installation-failed
They said they resolved it by adding the namespace (as it seems this is a namespace issue), but I'm not exactly sure what they are talking about.

Thanks!

Chris

FittedBondDiscountCurve doesn't calculate correctly when the bond helpers use dirty prices.

In recent releases, the bond helpers have been given the possibility to work with quoted dirty prices when bootstrapping a curve (see the last parameter of their constructors, useCleanPrice, which defaults to true but can be set to false to use dirty prices. However, the FittedBondDiscountCurve class is not yet aware of this change, and thus setting useCleanPrice to false would silently break its calculations.

The fix must be done in the FittedBondDiscountCurve::FittingMethod::FittingCost::value method, where the value of the bond quote is requested. If the quoted price is dirty, it must be adjusted accordingly.

Fix annuity calculation for cash-settled swaptions

Sebastian Schlenkrich wrote:

the BlackSwaptionEngine code says:

case Settlement::Cash: {
    const Leg& fixedLeg = swap.fixedLeg();
    boost::shared_ptr<FixedRateCoupon> firstCoupon = boost::dynamic_pointer_cast<FixedRateCoupon>(fixedLeg[0]);
    DayCounter dayCount = firstCoupon->dayCounter();
    Real fixedLegCashBPS = CashFlows::bps(fixedLeg, InterestRate(atmForward, dayCount, Compounded, Annual), false, discountCurve_->referenceDate());
    annuity = std::fabs(fixedLegCashBPS/basisPoint);
    break;
}

That is the annuity cash flows are discounted to referenceDate() (which usually is valuation date) using the forward par swap rate. With this code I cannot match match Bloomberg premiums and vols

To my understanding the ‘market formula’ for cash settled swaptions says discounting the annuity to settlement date and then discounting from settlement date to today using the ‘correct’ discount curve. Consequently, I would propose the following change:

case Settlement::Cash: {
    const Leg& fixedLeg = swap.fixedLeg();
    boost::shared_ptr<FixedRateCoupon> firstCoupon = boost::dynamic_pointer_cast<FixedRateCoupon>(fixedLeg[0]);
    DayCounter dayCount = firstCoupon->dayCounter();
    Date settlementDate = firstCoupon->accrualStartDate();
    Real fixedLegCashBPS = CashFlows::bps(fixedLeg, InterestRate(atmForward, dayCount, Compounded, Annual), false, settlementDate, settlementDate);
    annuity = termStructure()->discount(settlementDate) * std::fabs(fixedLegCashBPS/basisPoint);
    break;
}

Test failure in markov functional calibration to one instrument set

This is with 1.3 and current HEAD:

[...]
Testing Kahale smile section...
Testing markov functional calibration to one instrument set...
unknown location(0): fatal error in "QuantLib::detail::quantlib_test_case(&MarkovFunctionalTest::testCalibrationOneInstrumentSet)": memory access violation at address: 0x7fffc53db000: no mapping at fault address
utilities.hpp(78): last checkpoint
Test is aborted

Additional Methods in Interest Rate Models for Python Extension

@lballabio
I noticed that the python extension to QuantLib doesn't expose methods such as drift expectation standardDeviation in HullWhiteProcess. Can this be added? I can look into shortratemodels.i to see how to extend.

Also, I am not sure what is the exact difference between the term-structure model such as ql/processes/hullwhiteprocess.* and process that can be created using ql/models/shortrate/onefactormodels/hullwhite.*.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.