• C++ Programming for Financial Engineering
    Highly recommended by thousands of MFE students. Covers essential C++ topics with applications to financial engineering. Learn more Join!
    Python for Finance with Intro to Data Science
    Gain practical understanding of Python to read, understand, and write professional Python code for your first day on the job. Learn more Join!
    An Intuition-Based Options Primer for FE
    Ideal for entry level positions interviews and graduate studies, specializing in options trading arbitrage and options valuation models. Learn more Join!

Blog: Articles on C++11 and Computational Finance (by Daniel J. Duffy)

yes, all of those. They will be integrated into the Advance C++. In fact, some new features in C++17/20 course are in Boost (so, essentially replace boost namespace by std).

Plan is in 2nd week of January 2021 up and running.
Just curious to know if there's any updates on this? Haven't seen any announcements on this yet. I'm excited to see what you done.
 

Daniel Duffy

C++ author, trainer
The beginning of wisdom for a programmer is to recognize the difference between getting his program to work and getting it right. A program which does not work is undoubtedly wrong; but a program which does work is not necessarily right. It may still be wrong because it is hard to understand; or because it is hard to maintain as the problem requirements change; or because its structure is different from the structure of the problem; or because we cannot be sure that it does indeed work.

Michael A. Jackson
 

Daniel Duffy

C++ author, trainer
C++20 and SDE:
// Concepts
// Interface contract specification
template<typename T, typename Data>
    concept IDiffusion = requires (T c, Data t, Data x) { c.diffusion(t,x); };

template<typename T, typename Data>
    concept IDrift = requires (T c, Data t, Data x) { c.drift(t, x); };

template<typename T, typename Data>
concept IDriftDiffusion = IDiffusion<T, Data> && IDrift<T, Data>;

template <typename T, typename Data> requires IDriftDiffusion<T, Data>
        class SDEAbstract
{ // System under discussion, using composition
  // Really a Bridge pattern

        private:
            T _t;
        public:
        SDEAbstract(const T& t) : _t(t) {}
        Data diffusion(Data t, Data x)
        {
            return _t.diffusion(t, x);
        }
        Data drift(Data t, Data x)
        {
            return _t.drift(t, x);
        }

};



class SDE
{ // Defines drift + diffusion + data
private:
        std::shared_ptr<OptionData> data;    // The data for the option
public:
    SDE(const OptionData& optionData) : data(new OptionData(optionData)) {}

    double drift(double t, double S)
    { // Drift term
 
        return (data->r - data->D)*S; // r - D
    }

 
    double diffusion(double t, double S)
    { // Diffusion term
 
        return data->sig * S;
    }

};
[/QUOTE]

...

SDE sde(myOption);
 SDEAbstract<SDE, double> sud(sde);
[QUOTE="Daniel Duffy, post: 212873, member: 607"]
C++11 for the Impatient (with Mr. A. Palley)

Error - Cookies Turned Off

That article used C++11 functions to model stochastic differential equations (SDE) which resolves efficiency and maintenance problems of class hierarchies.
Now that C++20 Concepts are here, life has become a lot easier with almost no disruption to existing code.

C++ is getting better and better.
 
Last edited:

Daniel Duffy

C++ author, trainer
Here's a very simple runnable example to show how Concepts work.

C++20 Concepts 101:
// Test101Concepts.cpp
//
// Simplest example of a system. Context diagram consists only
// of Input and Output systems.
//
// We use C++20 Concepts to replace policy-based design
//
// Composition
//
//  V2: design using C++20 modules
//
// (C) Datasim Education BV 2015-2021
//

#include <string>
#include <iostream>

// Interface contract specification
template<typename T>
    concept IInput = requires (T x) { x.message(); };

template<typename T>
    concept IOutput = requires (T x, const std::string& s) { x.print(s); };

// I/O stuff
template <typename I, typename O> requires IInput<I> && IOutput<O>
    class SUD
{ // System under discussion, using composition

private:
    I i; O o;
public:
    SUD(const I& input, const O& output) : i(input), o(output) {}
    void run()
    { o.print(i.message());    }
};

// Instance Systems
class Input
{
public:

    std::string message() const
    {
        // Get data from hardware device
        return std::string("Good morning");
    }
};

class Output
{
public:

    void print(const std::string& s) const
    {
        std::cout << s << std::endl;
    }

};

int main()
{
    Input i; Output o;
    SUD<Input, Output> s(i,o);
    s.run();

    return 0;
}
 
Top