Skip to Content
Financial Modelling in Python
book

Financial Modelling in Python

by Shayne Fletcher, Christopher Gardner
August 2009
Intermediate to advanced
244 pages
9h 5m
English
Wiley
Content preview from Financial Modelling in Python
P1: JYS
c11 JWBK378-Fletcher April 24, 2009 8:17 Printer: Yet to come
11
Hybrid Python/C++ Pricing Systems
In Chapter 3, we saw how we may extend Python with modules written in C++. Specifically,
we studied case examples of reflecting types from the Boost.Date
Time library into Python.
Further, in section 3.1.1 we developed functionality in Python making use of those reflected
types to compute IMM dates. In this chapter we aim to show how we can exercise that
functionality from C++. What is the relevance of this? Well, it demonstrates the possibility of
‘hybrid pricing systems’. That is, systems formed from a mix of both C++ and Python. Such
potential will likely be of no small interest to those institutions that already have a considerable
investment in C++. By using the techniques about to be presented, organisations with pricing
frameworks in C++ can enjoy the many benefits Python offers while seamlessly integrating
these efforts with their existing C++ frameworks.
11.1 nth imm of year REVISITED
Our goal will be to exercise the Python code for IMM date computation functionality, presented
in section 3.1.1 from C++. As the first step in seeing how to achieve that, it is necessary for us
to review the implementation of the Python class nth
imm of year and examine in closer
detail its relationship with the C++ code on which it rests.
from ppf date time import \
weekdays \
, months
of year \
, nth
kday of
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Stochastic Financial Models

Stochastic Financial Models

Douglas Kennedy
Python and R for the Modern Data Scientist

Python and R for the Modern Data Scientist

Rick J. Scavetta, Boyan Angelov

Publisher Resources

ISBN: 9780470987841Purchase book