Language bindings for QuantLib
Questions tagged [quantlib-swig]
75 questions
10
votes
1 answer
Pricing a Floating Bond in quantlib using Python
I am trying to price a very basic floating rate bond in python using the Quantlib (v1.2) SWIG wrapper. I modified the example included with the documentation.
My bond has a 4 year maturity. The libor is set to 10% and the spread of the bond is 0.…

ducky
- 1,113
- 1
- 11
- 23
5
votes
2 answers
Python Quantlib convert Quantlib Date to datetime
I have a list of dates defined in the Date format of quantlib. How can I convert these into datetime format. The reason I am asking is, that I would like to plot it and I received the follwoing error:
TypeError: float() argument must be a string or…

MCM
- 1,479
- 2
- 17
- 22
4
votes
1 answer
Cash-settled swaptions pricing in QuantLib-Python
I am trying to price a cash-settled swaption in QuantLib using the swigged python version, the code is as follows:
import QuantLib as ql
# QL session
today = ql.Date(2, ql.January, 2019)
ql.Settings.instance().evaluationDate = today
# Underlying…

byouness
- 1,746
- 2
- 24
- 41
4
votes
1 answer
QuantLib cpibond bond example in Python
I am trying to get the official C++ cpibond example working in Python. The original example is here: https://github.com/lballabio/quantlib/blob/master/QuantLib/test-suite/inflationcpibond.cpp and for scala here:…

Charles
- 439
- 4
- 18
3
votes
1 answer
QuantLib in Python - cannot pickle 'SwigPyObject' object
I complied QuantLib in Visual Studio 2017 and built the library under Release x64. Then I installed QuantLib Swig according to the instruction here: https://www.quantlib.org/install/windows-python.shtml
The directories in VS are set as in the…

yi_fr
- 33
- 1
- 3
3
votes
1 answer
Quantlib-python No constructor defined
I am trying to instanciate the class Forward as below
import QuantLib as ql
calculation_date = ql.Date().todaysDate()
ql.Settings.instance().evaluationDate = calculation_date
day_count = ql.Thirty360()
yield_ts_handle =…

Loic Rougier
- 41
- 1
3
votes
2 answers
Using QuantLib to compute cash flows for floored FloatingRateBonds
I'm encountering an issue generating cash flows from bonds with a floor.
I initially had an issue because I neglected to set a pricer. I've since set a pricer as below.
ql_bond = QuantLib.FloatingRateBond(settlement_days, #settlementDays
…

user402078
- 63
- 3
3
votes
1 answer
Using QuantLib to compute cash flows for FloatingRateBond with Floor
Very new to QuantLib so guessing this is a rookie mistake. Enjoyed getting to know this powerful library so thank you to the authors and contributors!
I'm able to generate amounts for cashflows for a FloatingRateBond without a pricer if there isn't…

user402078
- 63
- 3
3
votes
0 answers
Installing QuantLib Python under Windows
I am trying to install QuantLib Python under Windows. I dowloaded Christopher Gohlke precompiled version 3.5 64-bit and installed it, but got usual error after running it
File "E:/Code/Centerprise/Positions/Common items/Python/Temp.py", line 4, in…

user1700890
- 7,144
- 18
- 87
- 183
3
votes
1 answer
How do I get coupon payment dates for a simple fixed bond using quantlib, quantlib-swig and python
I am trying yo learn quantlib (1.3) & python bindings using quantlib-swig (1.2) in ubuntu 13.04. As a starter I am trying to determine the payment dates for a very simple bond as given below using 30/360 European day counter
from QuantLib import…

kishore
- 541
- 1
- 6
- 18
2
votes
2 answers
QuantLib+SWIG+C# 4.0+Visual Studio 2010: TypeInitializationException
I would like to add a small feature to QuantLib and compile it together with SWIG bindings to use in a C# project in Visual Studio 2010. I am however having problems at almost every turn. What are the steps involved in building QuantLib in Visual…

user1214135
- 625
- 2
- 11
- 22
2
votes
0 answers
Do QuantLib 1.1 + SWIG + Ruby 1.9 work on Mac?
For starters I would like to find out whether the latest version of QuantLib 1.1 is working with its Ruby bindings via SWIG with Ruby 1.9 on a Mac.
I installed QuantLib and QuantLib-SWIG along with Boost and SWIG itself via Homebrew but I get an…

iRonin
- 470
- 4
- 12
2
votes
1 answer
How to Debug QuantLib-Python module in Visual Studio
QuantLib-Python is a SWIG-generated python module allowing access to QuantLib (C++) functionality.
I wish to debug the core QuantLib source code from within Visual Studio debugger (by attaching to a python process). In the past I was able to do…

weesh
- 21
- 4
2
votes
1 answer
python 3.6: No module named _QuantLib after installation of QuantLib and QuantLib-SWIG
I am trying to install QuantLib and Python QuantLib-SWIG on Mac OSX 10.12.5 Sierra and Python 3.6.1., but get error messages:
ImportError: dlopen(build/lib.macosx-10.7-x86_64-
3.6/QuantLib/_QuantLib.cpython-36m-darwin.so, 2): Symbol not found: __…

Taylor Fitch
- 41
- 1
- 6
2
votes
1 answer
How to advance the day in Quantlib
My understanding is that in order to advance the day, you do something like this:
ql.Settings.instance().evaluation_date = calculation_date + 1
However, when I execute the following code, I get the same value for the options:
import QuantLib as ql …

Ivan
- 7,448
- 14
- 69
- 134