Create option pricing engine structure, test architecture.
Some checks failed
C++ CI / build (push) Has been cancelled
Some checks failed
C++ CI / build (push) Has been cancelled
This commit is contained in:
2
tests/stubs/FakeMarketData.cpp
Normal file
2
tests/stubs/FakeMarketData.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
// Minimal TU to satisfy CMake for test stubs
|
||||
#include "FakeMarketData.hpp"
|
||||
38
tests/stubs/FakeMarketData.hpp
Normal file
38
tests/stubs/FakeMarketData.hpp
Normal file
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// Created by David Doebel on 07.03.2026.
|
||||
//
|
||||
#ifndef QUANTENGINE_FAKEMARKETDATA_HPP
|
||||
#define QUANTENGINE_FAKEMARKETDATA_HPP
|
||||
#include "MarketData.hpp"
|
||||
#include "FlatYieldCurve.hpp"
|
||||
#include "FlatVolatilitySurface.hpp"
|
||||
|
||||
class FakeMarketData : public MarketData {
|
||||
public:
|
||||
FakeMarketData() = default;
|
||||
|
||||
FakeMarketData(const FakeMarketData &other)
|
||||
{
|
||||
}
|
||||
|
||||
FakeMarketData(FakeMarketData &&other) noexcept
|
||||
{
|
||||
}
|
||||
|
||||
FakeMarketData & operator=(const FakeMarketData &other) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
FakeMarketData & operator=(FakeMarketData &&other) noexcept {
|
||||
return *this;
|
||||
}
|
||||
|
||||
double spot() const {return 100.0;}
|
||||
YieldCurve& yield_curve(){return *yieldCurve_; };
|
||||
VolatilitySurface& volatility_surface(){return *volatilitySurface_; };
|
||||
|
||||
private:
|
||||
std::unique_ptr<FlatYieldCurve> yieldCurve_ = std::make_unique<FlatYieldCurve>();
|
||||
std::unique_ptr<FlatVolatilitySurface> volatilitySurface_ = std::make_unique<FlatVolatilitySurface>();
|
||||
};
|
||||
#endif
|
||||
2
tests/stubs/FlatVolatilitySurface.cpp
Normal file
2
tests/stubs/FlatVolatilitySurface.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
// Minimal TU to satisfy CMake for test stubs
|
||||
#include "FlatVolatilitySurface.hpp"
|
||||
11
tests/stubs/FlatVolatilitySurface.hpp
Normal file
11
tests/stubs/FlatVolatilitySurface.hpp
Normal file
@@ -0,0 +1,11 @@
|
||||
//
|
||||
// Created by David Doebel on 07.03.2026.
|
||||
//
|
||||
#ifndef QUANTENGINE_FLATVOLATILITYSURFACE_HPP
|
||||
#define QUANTENGINE_FLATVOLATILITYSURFACE_HPP
|
||||
#include "VolatilitySurface.hpp"
|
||||
|
||||
class FlatVolatilitySurface : public VolatilitySurface {
|
||||
double sigma(double K, double T) {return 0.2;}
|
||||
};
|
||||
#endif
|
||||
2
tests/stubs/FlatYieldCurve.cpp
Normal file
2
tests/stubs/FlatYieldCurve.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
// Minimal TU to satisfy CMake for test stubs
|
||||
#include "FlatYieldCurve.hpp"
|
||||
16
tests/stubs/FlatYieldCurve.hpp
Normal file
16
tests/stubs/FlatYieldCurve.hpp
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// Created by David Doebel on 07.03.2026.
|
||||
//
|
||||
#ifndef QUANTENGINE_FLATYIELDCURVE_HPP
|
||||
#define QUANTENGINE_FLATYIELDCURVE_HPP
|
||||
#include "YieldCurve.hpp"
|
||||
#include <cmath>
|
||||
|
||||
class FlatYieldCurve : public YieldCurve{
|
||||
|
||||
double discount(double t) override {return std::exp(-rate_ * t); };
|
||||
double zeroRate(double t) override {return rate_; }
|
||||
private:
|
||||
double rate_ = 0.01;
|
||||
};
|
||||
#endif
|
||||
Reference in New Issue
Block a user