我已经通过svn结账然后在Windows上安装了boost_1_54
bootstrap
.\b2
Run Code Online (Sandbox Code Playgroud)
除了一个项目之外,依赖于boost的QuantLib库编译得很好:使用BOOST_MESSAGE的测试套件.这是未定义的.我可以看到我的boost版本中没有BOOST_MESSAGE.因此,这个QuantLib不兼容还是我错过了什么?在我的linux boost版本中同样适用于BOOST_MESSAGE - 它是未定义的
我已经看过了,但我不知道如何解释这一点.
我正在尝试使用 Amazon Linux AMI 在 Amazon 的 EC2 实例上编译 QuantLib Python SWIG 绑定。我已经成功地编译了 QuantLib 本身,但是,在尝试编译 anaconda python swig 绑定时,我遇到了 -fno-plt 选项的错误。我把gcc编译器版本升级到了5.4.0,原来是4.8
首先我配置如下:
sudo ./configure --disable-perl --disable-ruby --disable-mzscheme --disable-guile --disable-csharp --disable-ocaml --disable-r --disable-java PYTHON=/opt/anaconda/anaconda2/bin/python
Run Code Online (Sandbox Code Playgroud)
然后我做如下:
make -C Python
Run Code Online (Sandbox Code Playgroud)
我收到错误:
make: Entering directory `/home/ec2-user/downloads/QuantLib-SWIG-1.8/Python'
make all-am
make[1]: Entering directory `/home/ec2-user/downloads/QuantLib-SWIG-1.8/Python'
CXXFLAGS="-O3 -fno-strict-aliasing -Wno-unused -Wno-uninitialized -Wno-sign-compare -Wno-write-strings" CC="gcc" CXX="g++" /opt/anaconda/anaconda2/bin/python setup.py build
running build
running build_py
running build_ext
building 'QuantLib._QuantLib' extension
gcc -fno-strict-aliasing -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O3 -pipe -DNDEBUG -fwrapv …Run Code Online (Sandbox Code Playgroud) 我们一直在尝试在redhat linux机器上安装RQuantLib.经过一个月(令人尴尬的长时间!)的反复试验,我们成功地编译了最新版本的boost和quantlib.我根本不是Linux专家,因此在运行install.packages("RQuantLib")时调试编译标志时遇到一些麻烦.Rcpp已经安装并且工作正常.
以下错误消息详细说明了该问题.我很困惑,因为我认为它应该需要的文件(libQuantLib.so.0)存在于/ usr/local/lib中.很抱歉,这很可能是一个愚蠢的问题,但我认为我们非常接近在Linux上访问R中的quantlib.
错误消息如下:
g++ -I/apps/R/R-3.0.0/include -DNDEBUG -I/usr/local/include -I"/apps/R/R-3.0.0/library/Rcpp/include" -g -O2 -I/usr/local/include -I/usr/loca
l/include/boost -I. -fpic -g -O2 -c zero.cpp -o zero.o
g++ -shared -L/usr/local/lib64 -o RQuantLib.so asian.o barrier_binary.o bermudan.o bonds.o calendars.o curves.o daycounter.o discount.o hullwhi
te.o implieds.o utils.o vanilla.o zero.o -L/apps/R/R-3.0.0/library/Rcpp/lib -lRcpp -Wl,-rpath,/apps/R/R-3.0.0/library/Rcpp/lib -L/usr/local/lib
-L/usr/local/lib -lQuantLib
installing to /apps/R/R-3.0.0/library/RQuantLib/libs
** R
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be …Run Code Online (Sandbox Code Playgroud) 由于经常从.csv或.txt文件中读取这些字符串,我想知道获取%d/%m%/%y(或任何其他类似格式)字符串并将其转换为适合QuantLib::Date对象构造函数的最简单方法.
下面是一个示例代码:
#include <ql/quantlib.hpp>
#include <boost/timer.hpp>
#include <iostream>
#include <iomanip>
#include <boost/algorithm/string.hpp>
int main() {
boost::timer timer;
std::cout << std::endl;
std::string datesString = {
",17/10/2014,21/11/2014,19/12/2014,20/03/2015,19/06/2015,18/09/2015,18/12/2015,17/06/2016,"
};
std::vector<std::string> expiryDates;
boost::split(expiryDates, datesString, boost::is_any_of(","));
for(int i = 0; i < expiryDates.size(); i++)
{
std::cout << expiryDates[i] << std::endl;
}
// 17/10/2014
// 21/11/2014
// 19/12/2014
// 20/03/2015
// 19/06/2015
// 18/09/2015
// 18/12/2015
// 17/06/2016
// QuantLib::Date myQLDate(?);
return 0;
}
Run Code Online (Sandbox Code Playgroud) 我正在从csv中读取一些参数数据,并且正在努力转换日期,以便日期Date()类接受该日期
我已经尝试过:
d = datetime.date(datetime.strptime('2011-03-07','%Y-%m-%d'))
Date(d)
Run Code Online (Sandbox Code Playgroud)
但它返回:
NotImplementedError:重载函数“ new_Date”的参数数量或类型错误。
我正在尝试运行下面的代码,但由于某种原因,在一台电脑上它运行正常,在第二台电脑上它失败并显示以下错误消息;1台电脑正常运行,第2台就失败的原因是什么?
代码来源:http://gouthamanbalaraman.com/blog/quantlib-bond-modeling.html
!pip install QuantLib
import QuantLib as ql
todaysDate = ql.Date(15, 1, 2015)
ql.Settings.instance().evaluationDate = todaysDate
spotDates = [ql.Date(15, 1, 2015), ql.Date(15, 7, 2015), ql.Date(15, 1, 2016)]
spotRates = [0.0, 0.005, 0.007]
dayCount = ql.Thirty360()
calendar = ql.UnitedStates()
interpolation = ql.Linear()
compounding = ql.Compounded
compoundingFrequency = ql.Annual
spotCurve = ql.ZeroCurve(spotDates, spotRates, dayCount, calendar, interpolation,
compounding, compoundingFrequency)
spotCurveHandle = ql.YieldTermStructureHandle(spotCurve)
> TypeError: Wrong number or type of arguments for overloaded function
> 'new_Thirty360'. Possible C/C++ prototypes are:
> QuantLib::Thirty360::Thirty360(QuantLib::Thirty360::Convention,Date …Run Code Online (Sandbox Code Playgroud) 我来自ruby/C#并且是Python的新手.
我正在看下面的代码:
def raiseFlag():
global flag
flag = 1
class TermStructureTest():
def testImpliedObs(self):
global flag
flag = None
h = RelinkableYieldTermStructureHandle()
settlement = self.termStructure.referenceDate()
new_settlement = self.calendar.advance(settlement,3,Years)
implied = ImpliedTermStructure(h,new_settlement)
obs = Observer(raiseFlag)
obs.registerWith(implied)
h.linkTo(self.termStructure)
if not flag:
self.fail("Observer was not notified of term structure change")
Run Code Online (Sandbox Code Playgroud)
为什么在TermStructureTest()类中调用"raiseFlag"是有效的?