Skip to content

xuruilong100/QuantLibPythonExamples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QuantLibPythonExamples

MORE APIs, MORE examples, MORE test suites.

Introduction

  • Reconstructing SWIG interface files for building Python wrapper.
  • Reimplementing QuantLib examples by Python.
  • Reimplementing QuantLib test-suite by Python.

Related blog (in Chinese): https://www.cnblogs.com/xuruilong100/p/13281006.html

Environment:

  • QuantLib: 1.27
  • swig: 4.0.2
  • icx, icpx: Intel(R) oneAPI DPC /C Compiler 2022.1.0 (2022.1.0.20220316)
  • ubuntu: 22.04 LTS

How to build Python wrapper

Open ../SWIGpy/ and run the following commands.

  1. Generate .cpp file:
swig4.0 -w509 -c   -python -outdir QuantLib -o QuantLib/ql_wrap.cpp quantlib.i
  1. Compile .cpp file:
CC=icx CXX=icpx python3 setup.py build
  1. Install Python wrapper:
python3 setup.py install

Examples

  • BasketLosses
  • BermudanSwaption
  • Bonds
  • CallableBonds
  • CDS
  • ConvertibleBonds
  • CVAIRS
  • DiscreteHedging
  • EquityOption
  • FittedBondCurve
  • FRA
  • Gaussian1dModels
  • GlobalOptimizer
  • LatentModel
  • MarketModels
  • MultidimIntegral
  • Replication
  • Repo
  • MulticurveBootstrapping

Test suites

  • americanoption
  • amortizingbond
  • andreasenhugevolatilityinterpl
  • array
  • asianoptions
  • assetswap
  • autocovariances
  • barrieroption
  • basismodels
  • basisswapratehelpers
  • basketoption
  • batesmodel
  • bermudanswaption
  • binaryoption
  • blackdeltacalculator
  • blackformula
  • bondforward
  • bonds
  • brownianbridge
  • businessdayconventions
  • calendars
  • callablebonds
  • capflooredcoupon
  • capfloor
  • cashflows
  • catbonds
  • cdo
  • cdsoption
  • chooseroption
  • cliquetoption
  • cms
  • cmsspread
  • commodityunitofmeasure
  • compoundoption
  • convertiblebonds
  • covariance
  • creditdefaultswap
  • creditriskplus
  • crosscurrencyratehelpers
  • currency
  • curvestates
  • dates
  • daycounters
  • defaultprobabilitycurves
  • digitalcoupon
  • digitaloption
  • distributions
  • dividendoption
  • doublebarrieroption
  • doublebinaryoption
  • europeanoption
  • everestoption
  • exchangerate
  • extendedtrees
  • extensibleoptions
  • fastfouriertransform
  • fdcev
  • fdcir
  • fdheston
  • fdmlinearop
  • fdsabr
  • fittedbonddiscountcurve
  • forwardoption
  • forwardrateagreement
  • functions
  • garch
  • gaussianquadratures
  • gjrgarchmodel
  • gsr
  • hestonmodel
  • hestonslvmodel
  • himalayaoption
  • hybridhestonhullwhiteprocess
  • indexes
  • inflation
  • inflationcapfloor
  • inflationcapflooredcoupon
  • inflationcpibond
  • inflationcpicapfloor
  • inflationcpiswap
  • inflationvolatility
  • inflationzciisinterpolation
  • instruments
  • integrals
  • interestrates
  • interpolations
  • jumpdiffusion
  • lazyobject
  • libormarketmodel
  • libormarketmodelprocess
  • linearleastsquaresregression
  • lookbackoptions
  • lowdiscrepancysequences
  • margrabeoption
  • marketmodel_cms
  • marketmodel
  • marketmodel_smmcapletalphacalibration
  • marketmodel_smmcapletcalibration
  • marketmodel_smmcaplethomocalibration
  • marketmodel_smm
  • markovfunctional
  • matrices
  • mclongstaffschwartzengine
  • mersennetwister
  • money
  • noarbsabr
  • normalclvmodel
  • nthorderderivativeop
  • nthtodefault
  • numericaldifferentiation
  • observable
  • ode
  • operators
  • optimizers
  • optionletstripper
  • overnightindexedcoupon
  • overnightindexedswap
  • pagodaoption
  • partialtimebarrieroption
  • pathgenerator
  • period
  • piecewiseyieldcurve
  • piecewisezerospreadedtermstructure
  • quantooption
  • quotes
  • rangeaccrual
  • riskneutraldensitycalculator
  • riskstats
  • rngtraits
  • rounding
  • sampledcurve
  • schedule
  • settings
  • shortratemodels
  • sofrfutures
  • solvers
  • spreadoption
  • squarerootclvmodel
  • stats
  • subperiodcoupons
  • svivolatility
  • swap
  • swapforwardmappings
  • swaption
  • swaptionvolatilitycube
  • swaptionvolatilitymatrix
  • swingoption
  • termstructures
  • timegrid
  • timeseries
  • tqreigendecomposition
  • tracing
  • transformedgrid
  • twoassetbarrieroption
  • twoassetcorrelationoption
  • ultimateforwardtermstructure
  • variancegamma
  • varianceoption
  • varianceswaps
  • volatilitymodels
  • vpp
  • zabr
  • zerocouponswap

About

Reimplementing QuantLib examples by Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published