diff --git a/.gitignore b/.gitignore index 21e150c..439013d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ build cmake-build-debug venv .idea +*.so +*.pyc +__pycache__/ diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 57cbe2d..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "files.associations": { - "array": "cpp", - "atomic": "cpp", - "bit": "cpp", - "*.tcc": "cpp", - "cctype": "cpp", - "clocale": "cpp", - "cmath": "cpp", - "compare": "cpp", - "concepts": "cpp", - "cstdarg": "cpp", - "cstddef": "cpp", - "cstdint": "cpp", - "cstdio": "cpp", - "cstdlib": "cpp", - "cstring": "cpp", - "cwchar": "cpp", - "cwctype": "cpp", - "deque": "cpp", - "forward_list": "cpp", - "list": "cpp", - "map": "cpp", - "set": "cpp", - "string": "cpp", - "unordered_map": "cpp", - "unordered_set": "cpp", - "vector": "cpp", - "exception": "cpp", - "algorithm": "cpp", - "functional": "cpp", - "iterator": "cpp", - "memory": "cpp", - "memory_resource": "cpp", - "numeric": "cpp", - "optional": "cpp", - "random": "cpp", - "string_view": "cpp", - "system_error": "cpp", - "tuple": "cpp", - "type_traits": "cpp", - "utility": "cpp", - "initializer_list": "cpp", - "iosfwd": "cpp", - "iostream": "cpp", - "istream": "cpp", - "limits": "cpp", - "new": "cpp", - "numbers": "cpp", - "ostream": "cpp", - "stdexcept": "cpp", - "streambuf": "cpp", - "cinttypes": "cpp", - "typeindex": "cpp", - "typeinfo": "cpp", - "valarray": "cpp", - "variant": "cpp" - } -} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 7948d45..81a8ca0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.15) project(finmath) @@ -9,85 +9,53 @@ set(CMAKE_CXX_STANDARD_REQUIRED True) # Add debugging symbols (set to Release for optimized performance if needed) set(CMAKE_BUILD_TYPE Release) +# Enable SIMD optimizations based on architecture +if(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)") + # x86/x86_64: Enable SSE2 (baseline) and detect AVX + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2") + + # Try to enable AVX if available + include(CheckCXXCompilerFlag) + CHECK_CXX_COMPILER_FLAG("-mavx" COMPILER_SUPPORTS_AVX) + if(COMPILER_SUPPORTS_AVX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx") + message(STATUS "AVX support enabled") + else() + message(STATUS "AVX not supported, using SSE2") + endif() +elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64|ARM64)") + # ARM64: NEON is standard on ARMv8 + message(STATUS "ARM NEON support enabled (ARMv8)") +elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm") + # ARM32: Try to enable NEON + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon") + message(STATUS "ARM NEON support enabled (ARMv7)") +else() + message(STATUS "Using scalar fallback (no SIMD)") +endif() + # Add include directories include_directories(${PROJECT_SOURCE_DIR}/include) -# Source files -file(GLOB SOURCES "src/cpp/*/*.cpp") - -# Create the main C++ library target with a unique name -add_library(finmath_library SHARED ${SOURCES} - "src/cpp/InterestAndAnnuities/simple_interest.cpp" - "include/finmath/InterestAndAnnuities/simple_interest.h" - "include/finmath/OptionPricing/options_pricing.h" - "include/finmath/OptionPricing/options_pricing_types.h" - "include/finmath/TimeSeries/rolling_volatility.h" - "include/finmath/TimeSeries/simple_moving_average.h" - "include/finmath/TimeSeries/rsi.h" - "include/finmath/TimeSeries/ema.h" - "include/finmath/TimeSeries/rolling_std_dev.h") - -# Test executables -add_executable(black_scholes_test test/OptionPricing/black_scholes_test.cpp) -target_link_libraries(black_scholes_test finmath_library) - -add_executable(binomial_option_pricing_test test/OptionPricing/binomial_option_pricing_test.cpp) -target_link_libraries(binomial_option_pricing_test finmath_library) - -add_executable(compound_interest_test test/InterestAndAnnuities/compound_interest_test.cpp) -target_link_libraries(compound_interest_test finmath_library) - -add_executable(rsi_test test/TimeSeries/rsi_test.cpp) -target_link_libraries(rsi_test finmath_library) - -add_executable(rolling_std_dev_test test/TimeSeries/rolling_std_dev_test.cpp) -target_link_libraries(rolling_std_dev_test finmath_library) - -add_executable(bellman_arbitrage_test test/GraphAlgos/bellman_arbitrage_test.cpp) -target_link_libraries(bellman_arbitrage_test finmath_library) +# Markov chain sources only (this branch) +set(SOURCES + "src/cpp/MarkovChains/markov_chain.cpp" + "src/cpp/finmath.cpp" +) -# Test runner -add_executable(run_all_tests test/test_runner.cpp) +# Create the main C++ library target +add_library(finmath_library SHARED ${SOURCES}) # Enable testing enable_testing() -# Define individual tests -add_test(NAME BlackScholesTest COMMAND black_scholes_test) -add_test(NAME BinomialOptionPricingTest COMMAND binomial_option_pricing_test) -add_test(NAME CompoundInterestTest COMMAND compound_interest_test) -add_test(NAME RSITest COMMAND rsi_test) -add_test(NAME RollingStdDevTest COMMAND rolling_std_dev_test) -add_test(NAME BellmanArbitrageTest COMMAND bellman_arbitrage_test) - -# Add a custom target to run all tests -add_custom_target(build_and_test - COMMAND ${CMAKE_COMMAND} --build . --target black_scholes_test - COMMAND ${CMAKE_COMMAND} --build . --target binomial_option_pricing_test - COMMAND ${CMAKE_COMMAND} --build . --target compound_interest_test - COMMAND ${CMAKE_COMMAND} --build . --target rsi_test - COMMAND ${CMAKE_COMMAND} --build . --target bellman_arbitrage_test - COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} -) - -# Make 'build_and_test' the default target -add_custom_target(default ALL DEPENDS build_and_test) - -# Add pybind11 for Python bindings -include(FetchContent) -FetchContent_Declare( - pybind11 - GIT_REPOSITORY https://github.com/pybind/pybind11.git - GIT_TAG v2.10.0 # Use a stable version of pybind11 -) -FetchContent_MakeAvailable(pybind11) - -# Create the Python bindings target -pybind11_add_module(finmath_bindings src/python_bindings.cpp ${SOURCES}) - -# Set the output name of the bindings to 'finmath' to match your desired module name -set_target_properties(finmath_bindings PROPERTIES OUTPUT_NAME "finmath") +# Helper macro to add a test executable and link it +macro(add_cpp_test test_name source_file) + message(STATUS "Adding C++ test: ${test_name} from ${source_file}") + add_executable(${test_name}_executable ${source_file}) + target_link_libraries(${test_name}_executable PRIVATE finmath_library) + add_test(NAME ${test_name} COMMAND ${test_name}_executable) +endmacro() -# Link the Python bindings target with the C++ library -target_link_libraries(finmath_bindings PRIVATE finmath_library) +# Markov chain test only +add_cpp_test(MarkovChainTest test/MarkovChains/C++/markov_chain_test.cpp) diff --git a/README.md b/README.md index ea17d27..4170fe4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,12 @@ # finmath -**finmath** is a high-performance financial mathematics library written in C++ with Python bindings using `pybind11`. The library includes various functions for calculating compound interest, option pricing (including Black-Scholes and Binomial Tree models), and time series analysis. The goal is to provide a fast and reliable tool for financial calculations that can be used in Python. +**finmath** is a high-performance financial mathematics library written in C++ with Python bindings using `pybind11`. The library includes various functions for calculating compound interest, option pricing (including Black-Scholes and Binomial Tree models), and time series analysis. + +**Key Features:** +- **Cross-platform SIMD optimizations** (ARM NEON, x86 AVX/SSE) for 2-4x speedups +- **Zero-copy NumPy integration** for efficient memory usage +- **34-308x faster** than pure Python/NumPy implementations +- Production-ready with comprehensive tests ## Installation @@ -16,7 +22,7 @@ 1. **Clone the repository**: ```bash - git clone https://github.com/prajwalshah19/finmath.git + git clone https://github.com/Boiler-Quant/finmath.git cd finmath ``` @@ -102,26 +108,27 @@ int main() { } ``` -## Benchmarking +## Performance -You can compare the performance of `finmath` functions with other implementations (e.g., `gs_quant`) to see the speedup provided by the C++ implementations: +The library uses SIMD optimizations and zero-copy NumPy integration for maximum performance. See `demos/` for benchmark comparisons. +**Example with NumPy (zero-copy):** ```python -import timeit -import gs_quant.timeseries as ts -import functions import finmath +import numpy as np -# Example data for 1000 days -prices = ts.generate_series(1000) - -# Timing the finmath C++ implementation of rolling volatility -def test_cpp_implementation(): - return finmath.rolling_volatility(prices.tolist(), 22) +# Zero-copy NumPy arrays for best performance +prices = np.array([100, 101, 102, 103, 104, 105]) +sma = finmath.simple_moving_average_simd(prices, window_size=3) +rsi = finmath.smoothed_rsi_simd(prices, window_size=14) +``` -cpp_time = timeit.timeit(test_cpp_implementation, number=100) -print(f"C++ implementation time: {cpp_time:.6f} seconds") +## Testing +Run the test suite: +```bash +cd build +ctest ``` ## Contributing diff --git a/benchmark/README.md b/benchmark/README.md deleted file mode 100644 index 8a52e02..0000000 --- a/benchmark/README.md +++ /dev/null @@ -1,52 +0,0 @@ -# Benchmarking Utilities for Financial Mathematics Functions - -This directory contains Python modules for benchmarking financial mathematics functions. It provides an organized framework to benchmark functions for calculating rolling metrics (like Simple Moving Average and Relative Strength Index), as well as other financial and statistical indicators. Results are saved as JSON files with detailed environment information and performance metrics. - -## File Descriptions - -### `benchmark.py` - -The main script to run comprehensive tests for various financial metrics using different implementations. The results are saved in a timestamped JSON file in the `results` directory. - -- **Main Function**: `run_exhaustive_test()` - - Runs a series of tests comparing functions from different libraries (`gs_quant` and `finmath`) for performance. - - Tests metrics such as: - - Simple Moving Average (SMA) - - Relative Strength Index (RSI) - - Volatility - - Saves results including environment information, mean execution time, and standard deviation. - -### `bench_helper.py` - -This module provides helper functions and utilities for testing and benchmarking. - -- **Functions**: - - `get_environment_info()`: Gathers system information, including OS, CPU, RAM, and Python version. - - `test_function()`: Benchmarks a given function multiple times, calculating mean and standard deviation of runtimes. - - `test_generic()`: Generalized function for testing any callable function with various inputs and configurations. - - `test_rolling_window()`: Specifically benchmarks rolling-window functions, such as SMA or RSI, by generating large data arrays and passing a specified window size. - -## Requirements - -```bash -pip3 install -r requirements.txt -``` - -- Python 3.7+ -- `gs_quant` for `moving_average`, `relative_strength_index`, and `volatility` functions. -- `finmath` for alternative financial calculations. -- `cpuinfo` and `psutil` for environment info. -- `pandas` for data manipulation. - -## How to Use - -1. Run `run_exhaustive_test.py` to conduct all predefined benchmarks. -2. Review results in the `results` directory. Each result file is timestamped and contains environment details, test configuration, mean execution time, and standard deviation. - -## Example Usage - -To run the benchmarks: - -```bash -python benchmark.py -``` diff --git a/benchmark/bench_helper.py b/benchmark/bench_helper.py deleted file mode 100644 index 28e3d05..0000000 --- a/benchmark/bench_helper.py +++ /dev/null @@ -1,155 +0,0 @@ -""" -This module provides utilities for benchmarking - -Functions: -- get_environment_info: Fetches environment info including OS, CPU, RAM, and Python version -- test_function: Tests and benchmarks the function $num_iter times. -""" - -from typing import Dict, Tuple, Callable -import platform -import sys -import psutil -import cpuinfo -import time -import statistics -import random -import pandas as pd - -def get_environment_info() -> Dict: - """ - Fetches environment info including OS, CPU, RAM, and Python version - - Returns: - Dict: environment information - - """ - # System and Python version info - env_info = { - "OS": platform.system(), - "OS Version": platform.version(), - "Machine": platform.machine(), - "Python Version": sys.version, - "Python Implementation": platform.python_implementation() - } - - # CPU info - cpu_info = cpuinfo.get_cpu_info() - env_info.update({ - "CPU Brand": cpu_info.get("brand_raw", "Unknown"), - "CPU Cores (Logical)": psutil.cpu_count(logical=True), - "CPU Cores (Physical)": psutil.cpu_count(logical=False), - "CPU Frequency (Max)": psutil.cpu_freq().max - }) - - # Memory info - memory_info = psutil.virtual_memory() - env_info["Total RAM (GB)"] = round(memory_info.total / (1024 ** 3), 2) - - return env_info - -def test_function(test_func: Callable, num_iter: int, *args) -> Tuple[int, int]: - """ - Tests and benchmarks the function $num_iter times. - - Parameters: - test_func (Callable): the function to benchmark - num_iter (int): number of times to benchmark - *args: the arguments that will be passed to test_func - - Returns: - Tuple[int, int]: the mean and the standard deviation of runtimes in seconds - """ - times = [] - # Warm-up - for _ in range(3): - test_func(*args) - - for _ in range(num_iter): - start = time.perf_counter() - result = test_func(*args) - end = time.perf_counter() - times.append(end - start) - - return statistics.mean(times), statistics.stdev(times) - -def test_generic(test_func: Callable, *args, num_iter: int = 3, return_test_config: bool = False, - input_size: int = 1, test_name: str = "test_generic"): - """ - Generalized testing and benchmarking function for arbitrary functions. - - Args: - test_func (Callable): The function to test. Accepts any function as long as its arguments match those passed through `*args`. - *args: Arguments to pass to `test_func`. - num_iter (int, optional): Number of iterations to run the test. Defaults to 3. - return_test_config (bool, optional): If True, returns the configuration and benchmark statistics (mean, stdev). - Defaults to False. - input_size (int, optional): Represents the size of the input data or its parameterization. Defaults to 1. - test_name (str, optional): Name of the test, used in the configuration output. Defaults to "test_generic". - - Returns: - Union[Tuple[float, float, Dict], Tuple[float, float]] - mean (float): The mean execution time across iterations. - stdev (float): The standard deviation of execution times across iterations. - - If `return_test_config` is True, also returns: - test_config (dict): Dictionary with test configuration and statistics. - """ - - test_config = { - "test_name": test_name, - "test_func": f"{test_func.__module__}.{test_func.__name__}", - "num_iter": num_iter, - "input_size": input_size - } - - if return_test_config: - mean, stdev = test_function(test_func, num_iter, *args) - test_config = { **test_config, "mean": mean, "stdev": stdev } - return mean, stdev, test_config - - return test_function(test_func, num_iter, *args) - -def test_rolling_window(test_func: Callable, num_iter: int = 3, num_elem: int = int(1e4), - window_size: int = 10, return_test_config: bool = False, input_type = list, - test_name: str = "test_rolling_window", *args): - """ - Tests and benchmarks for rolling-window type of functions such as simple moving average or relative strength index - - Args: - test_func (Callable): The function to test. Must accept a list and a window-size as its argument - num_iter (int, optional): Number of iterations to run the test. Defaults to 3 - num_elem (int, optional): Number of elements in the generated data array. Defaults to 10^4. - window_size (int, optional): Size of the rolling window to use in the test function. Defaults to 10. - return_test_config (bool, optional): If True, returns the configuration and benchmark statistics (mean, stdev). - Defaults to False. - input_type (type, optional): Data type for the input array, either `list` or `pd.Series`. Defaults to `list`. - test_name (str, optional): Name of the test, used in the configuration output. Defaults to "test_rolling_window". - *args: Additional arguments to pass to the test function. - - Returns: - Union[Tuple[float, float, Dict], Tuple[float, float]] - mean (float): The mean execution time across iterations. - stdev (float): The standard deviation of execution times across iterations. - - If `return_test_config` is True, also returns: - test_config (dict): Dictionary with test configuration and statistics. - """ - test_config = { - "test_name": test_name, - "test_func": f"{test_func.__module__}.{test_func.__name__}", - "num_iter": num_iter, - "num_elem": num_elem, - "window_size": window_size, - "input_type": input_type.__name__ - } - - random.seed(0) - random_list = [random.randint(1, 1 << 30) for _ in range(num_elem)] - if input_type == pd.Series: - random_list = pd.Series(random_list) - - if return_test_config: - mean, stdev = test_function(test_func, num_iter, random_list, window_size) - test_config = { **test_config, "mean": mean, "stdev": stdev } - return mean, stdev, test_config - - return test_function(test_func, num_iter, random_list, window_size) diff --git a/benchmark/benchmark.py b/benchmark/benchmark.py deleted file mode 100644 index 4971d5a..0000000 --- a/benchmark/benchmark.py +++ /dev/null @@ -1,60 +0,0 @@ -import sys -sys.path.append("../build") - -import finmath -import bench_helper as bh -import gs_quant.timeseries as ts -import pandas as pd -from datetime import datetime -import json - -def run_exhaustive_test(): - current_timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") - - benchmark_result = {} - benchmark_result["environment_info"] = bh.get_environment_info() - - - # Test 1: SMA - mean_gs, _, test_config_gs = bh.test_rolling_window(ts.moving_average, num_elem=int(1e4), return_test_config=True, - input_type=pd.Series, test_name="SMA_GS") - mean_finmath, _, test_config_finmath = bh.test_rolling_window(finmath.simple_moving_average, num_elem=int(1e4), - return_test_config=True, test_name="SMA_FINMATH") - benchmark_result["SMA"] = { - "GS_MEAN": mean_gs, - "FINMATH_MEAN": mean_finmath, - "PERFORMANCE_IMPROVEMENT": mean_gs / mean_finmath, - "SMA_GS": test_config_gs, - "SMA_FINMATH": test_config_finmath - } - - # Test 2: RSI - mean_gs, _, test_config_gs = bh.test_rolling_window(ts.relative_strength_index, num_elem=int(1e4), return_test_config=True, - input_type=pd.Series, test_name="RSI_GS") - mean_finmath, _, test_config_finmath = bh.test_rolling_window(finmath.rsi, num_elem=int(1e4), return_test_config=True, - test_name="RSI_FINMATH") - benchmark_result["RSI"] = { - "GS_MEAN": mean_gs, - "FINMATH_MEAN": mean_finmath, - "PERFORMANCE_IMPROVEMENT": mean_gs / mean_finmath, - "SMA_GS": test_config_gs, - "SMA_FINMATH": test_config_finmath - } - - # Test 3: Volatility - mean_gs, _, test_config_gs = bh.test_generic(ts.volatility, ts.generate_series(int(1e4)), 20, return_test_config=True, input_size=int(1e4), - test_name="Volatility_GS") - mean_finmath, _, test_config_finmath = bh.test_rolling_window(finmath.rolling_volatility, num_elem=int(1e4), return_test_config=True, - test_name="Volatility_FINMATH") - benchmark_result["ROLLING_VOLATILITY"] = { - "GS_MEAN": mean_gs, - "FINMATH_MEAN": mean_finmath, - "PERFORMANCE_IMPROVEMENT": mean_gs / mean_finmath, - "SMA_GS": test_config_gs, - "SMA_FINMATH": test_config_finmath - } - - with open(f"results/{current_timestamp}.json", "w") as file: - json.dump(benchmark_result, file, indent=4) - -run_exhaustive_test() \ No newline at end of file diff --git a/benchmark/requirements.txt b/benchmark/requirements.txt deleted file mode 100644 index 25d98df..0000000 --- a/benchmark/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -gs_quant -psutil -py-cpuinfo -pandas \ No newline at end of file diff --git a/benchmark/results/sample_bench.json b/benchmark/results/sample_bench.json deleted file mode 100644 index 0753466..0000000 --- a/benchmark/results/sample_bench.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "environment_info": { - "OS": "Linux", - "OS Version": "#1 SMP Tue Nov 5 00:21:55 UTC 2024", - "Machine": "x86_64", - "Python Version": "3.12.3 (main, Sep 11 2024, 14:17:37) [GCC 13.2.0]", - "Python Implementation": "CPython", - "CPU Brand": "AMD Ryzen 7 7840U w/ Radeon 780M Graphics", - "CPU Cores (Logical)": 16, - "CPU Cores (Physical)": 8, - "CPU Frequency (Max)": 0.0, - "Total RAM (GB)": 15.28 - }, - "SMA": { - "GS_MEAN": 0.00036527666664672626, - "FINMATH_MEAN": 0.0005378133333048633, - "PERFORMANCE_IMPROVEMENT": 0.6791885660440974, - "SMA_GS": { - "test_name": "SMA_GS", - "test_func": "gs_quant.timeseries.technicals.moving_average", - "num_iter": 3, - "num_elem": 10000, - "window_size": 10, - "input_type": "Series", - "mean": 0.00036527666664672626, - "stdev": 3.4519544182124885e-05 - }, - "SMA_FINMATH": { - "test_name": "SMA_FINMATH", - "test_func": "finmath.simple_moving_average", - "num_iter": 3, - "num_elem": 10000, - "window_size": 10, - "input_type": "list", - "mean": 0.0005378133333048633, - "stdev": 0.00013176728561525194 - } - }, - "RSI": { - "GS_MEAN": 0.7612638499999775, - "FINMATH_MEAN": 0.0005520613332995102, - "PERFORMANCE_IMPROVEMENT": 1378.9479611805532, - "SMA_GS": { - "test_name": "RSI_GS", - "test_func": "gs_quant.timeseries.technicals.relative_strength_index", - "num_iter": 3, - "num_elem": 10000, - "window_size": 10, - "input_type": "Series", - "mean": 0.7612638499999775, - "stdev": 0.023978102284543133 - }, - "SMA_FINMATH": { - "test_name": "RSI_FINMATH", - "test_func": "finmath.rsi", - "num_iter": 3, - "num_elem": 10000, - "window_size": 10, - "input_type": "list", - "mean": 0.0005520613332995102, - "stdev": 6.816337535133109e-05 - } - }, - "ROLLING_VOLATILITY": { - "GS_MEAN": 0.0042367189999671, - "FINMATH_MEAN": 0.0012655086666200077, - "PERFORMANCE_IMPROVEMENT": 3.3478387874519813, - "SMA_GS": { - "test_name": "Volatility_GS", - "test_func": "gs_quant.timeseries.econometrics.volatility", - "num_iter": 3, - "input_size": 10000, - "mean": 0.0042367189999671, - "stdev": 0.00041382542709771157 - }, - "SMA_FINMATH": { - "test_name": "Volatility_FINMATH", - "test_func": "finmath.rolling_volatility", - "num_iter": 3, - "num_elem": 10000, - "window_size": 10, - "input_type": "list", - "mean": 0.0012655086666200077, - "stdev": 2.24981011793308e-05 - } - } -} \ No newline at end of file diff --git a/cmake-build-debug/build.ninja b/cmake-build-debug/build.ninja deleted file mode 100644 index 1493bd9..0000000 --- a/cmake-build-debug/build.ninja +++ /dev/null @@ -1,424 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Ninja" Generator, CMake Version 3.29 - -# This file contains all the build statements describing the -# compilation DAG. - -# ============================================================================= -# Write statements declared in CMakeLists.txt: -# -# Which is the root file. -# ============================================================================= - -# ============================================================================= -# Project: finmath -# Configurations: Release -# ============================================================================= - -############################################# -# Minimal version of Ninja required by this file - -ninja_required_version = 1.5 - - -############################################# -# Set configuration variable for custom commands. - -CONFIGURATION = Release -# ============================================================================= -# Include auxiliary files. - - -############################################# -# Include rules file. - -include CMakeFiles/rules.ninja - -# ============================================================================= - -############################################# -# Logical path to working directory; prefix for absolute paths. - -cmake_ninja_workdir = /Users/shashank/finmath/cmake-build-debug/ -# ============================================================================= -# Object build statements for SHARED_LIBRARY target finmath_library - - -############################################# -# Order-only phony target for finmath_library - -build cmake_object_order_depends_target_finmath_library: phony || . - -build CMakeFiles/finmath_library.dir/src/cpp/Helper/helper.cpp.o: CXX_COMPILER__finmath_library_unscanned_Release /Users/shashank/finmath/src/cpp/Helper/helper.cpp || cmake_object_order_depends_target_finmath_library - DEFINES = -Dfinmath_library_EXPORTS - DEP_FILE = CMakeFiles/finmath_library.dir/src/cpp/Helper/helper.cpp.o.d - FLAGS = -O3 -DNDEBUG -std=gnu++17 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk -mmacosx-version-min=14.6 -fPIC -fcolor-diagnostics - INCLUDES = -I/Users/shashank/finmath/include - OBJECT_DIR = CMakeFiles/finmath_library.dir - OBJECT_FILE_DIR = CMakeFiles/finmath_library.dir/src/cpp/Helper - TARGET_COMPILE_PDB = CMakeFiles/finmath_library.dir/ - TARGET_PDB = libfinmath_library.pdb - -build CMakeFiles/finmath_library.dir/src/cpp/InterestAndAnnuities/compound_interest.cpp.o: CXX_COMPILER__finmath_library_unscanned_Release /Users/shashank/finmath/src/cpp/InterestAndAnnuities/compound_interest.cpp || cmake_object_order_depends_target_finmath_library - DEFINES = -Dfinmath_library_EXPORTS - DEP_FILE = CMakeFiles/finmath_library.dir/src/cpp/InterestAndAnnuities/compound_interest.cpp.o.d - FLAGS = -O3 -DNDEBUG -std=gnu++17 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk -mmacosx-version-min=14.6 -fPIC -fcolor-diagnostics - INCLUDES = -I/Users/shashank/finmath/include - OBJECT_DIR = CMakeFiles/finmath_library.dir - OBJECT_FILE_DIR = CMakeFiles/finmath_library.dir/src/cpp/InterestAndAnnuities - TARGET_COMPILE_PDB = CMakeFiles/finmath_library.dir/ - TARGET_PDB = libfinmath_library.pdb - -build CMakeFiles/finmath_library.dir/src/cpp/InterestAndAnnuities/simple_interest.cpp.o: CXX_COMPILER__finmath_library_unscanned_Release /Users/shashank/finmath/src/cpp/InterestAndAnnuities/simple_interest.cpp || cmake_object_order_depends_target_finmath_library - DEFINES = -Dfinmath_library_EXPORTS - DEP_FILE = CMakeFiles/finmath_library.dir/src/cpp/InterestAndAnnuities/simple_interest.cpp.o.d - FLAGS = -O3 -DNDEBUG -std=gnu++17 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk -mmacosx-version-min=14.6 -fPIC -fcolor-diagnostics - INCLUDES = -I/Users/shashank/finmath/include - OBJECT_DIR = CMakeFiles/finmath_library.dir - OBJECT_FILE_DIR = CMakeFiles/finmath_library.dir/src/cpp/InterestAndAnnuities - TARGET_COMPILE_PDB = CMakeFiles/finmath_library.dir/ - TARGET_PDB = libfinmath_library.pdb - -build CMakeFiles/finmath_library.dir/src/cpp/OptionPricing/binomial_tree.cpp.o: CXX_COMPILER__finmath_library_unscanned_Release /Users/shashank/finmath/src/cpp/OptionPricing/binomial_tree.cpp || cmake_object_order_depends_target_finmath_library - DEFINES = -Dfinmath_library_EXPORTS - DEP_FILE = CMakeFiles/finmath_library.dir/src/cpp/OptionPricing/binomial_tree.cpp.o.d - FLAGS = -O3 -DNDEBUG -std=gnu++17 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk -mmacosx-version-min=14.6 -fPIC -fcolor-diagnostics - INCLUDES = -I/Users/shashank/finmath/include - OBJECT_DIR = CMakeFiles/finmath_library.dir - OBJECT_FILE_DIR = CMakeFiles/finmath_library.dir/src/cpp/OptionPricing - TARGET_COMPILE_PDB = CMakeFiles/finmath_library.dir/ - TARGET_PDB = libfinmath_library.pdb - -build CMakeFiles/finmath_library.dir/src/cpp/OptionPricing/black_scholes.cpp.o: CXX_COMPILER__finmath_library_unscanned_Release /Users/shashank/finmath/src/cpp/OptionPricing/black_scholes.cpp || cmake_object_order_depends_target_finmath_library - DEFINES = -Dfinmath_library_EXPORTS - DEP_FILE = CMakeFiles/finmath_library.dir/src/cpp/OptionPricing/black_scholes.cpp.o.d - FLAGS = -O3 -DNDEBUG -std=gnu++17 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk -mmacosx-version-min=14.6 -fPIC -fcolor-diagnostics - INCLUDES = -I/Users/shashank/finmath/include - OBJECT_DIR = CMakeFiles/finmath_library.dir - OBJECT_FILE_DIR = CMakeFiles/finmath_library.dir/src/cpp/OptionPricing - TARGET_COMPILE_PDB = CMakeFiles/finmath_library.dir/ - TARGET_PDB = libfinmath_library.pdb - -build CMakeFiles/finmath_library.dir/src/cpp/TimeSeries/rolling_volatility.cpp.o: CXX_COMPILER__finmath_library_unscanned_Release /Users/shashank/finmath/src/cpp/TimeSeries/rolling_volatility.cpp || cmake_object_order_depends_target_finmath_library - DEFINES = -Dfinmath_library_EXPORTS - DEP_FILE = CMakeFiles/finmath_library.dir/src/cpp/TimeSeries/rolling_volatility.cpp.o.d - FLAGS = -O3 -DNDEBUG -std=gnu++17 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk -mmacosx-version-min=14.6 -fPIC -fcolor-diagnostics - INCLUDES = -I/Users/shashank/finmath/include - OBJECT_DIR = CMakeFiles/finmath_library.dir - OBJECT_FILE_DIR = CMakeFiles/finmath_library.dir/src/cpp/TimeSeries - TARGET_COMPILE_PDB = CMakeFiles/finmath_library.dir/ - TARGET_PDB = libfinmath_library.pdb - - -# ============================================================================= -# Link build statements for SHARED_LIBRARY target finmath_library - - -############################################# -# Link the shared library libfinmath_library.dylib - -build libfinmath_library.dylib: CXX_SHARED_LIBRARY_LINKER__finmath_library_Release CMakeFiles/finmath_library.dir/src/cpp/Helper/helper.cpp.o CMakeFiles/finmath_library.dir/src/cpp/InterestAndAnnuities/compound_interest.cpp.o CMakeFiles/finmath_library.dir/src/cpp/InterestAndAnnuities/simple_interest.cpp.o CMakeFiles/finmath_library.dir/src/cpp/OptionPricing/binomial_tree.cpp.o CMakeFiles/finmath_library.dir/src/cpp/OptionPricing/black_scholes.cpp.o CMakeFiles/finmath_library.dir/src/cpp/TimeSeries/rolling_volatility.cpp.o - ARCH_FLAGS = -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk -mmacosx-version-min=14.6 - INSTALLNAME_DIR = @rpath/ - LANGUAGE_COMPILE_FLAGS = -O3 -DNDEBUG - OBJECT_DIR = CMakeFiles/finmath_library.dir - POST_BUILD = : - PRE_LINK = : - SONAME = libfinmath_library.dylib - SONAME_FLAG = -install_name - TARGET_COMPILE_PDB = CMakeFiles/finmath_library.dir/ - TARGET_FILE = libfinmath_library.dylib - TARGET_PDB = libfinmath_library.pdb - -# ============================================================================= -# Object build statements for EXECUTABLE target runTests - - -############################################# -# Order-only phony target for runTests - -build cmake_object_order_depends_target_runTests: phony || cmake_object_order_depends_target_finmath_library - -build CMakeFiles/runTests.dir/test/test_finmath.cpp.o: CXX_COMPILER__runTests_unscanned_Release /Users/shashank/finmath/test/test_finmath.cpp || cmake_object_order_depends_target_runTests - DEP_FILE = CMakeFiles/runTests.dir/test/test_finmath.cpp.o.d - FLAGS = -O3 -DNDEBUG -std=gnu++17 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk -mmacosx-version-min=14.6 -fcolor-diagnostics - INCLUDES = -I/Users/shashank/finmath/include - OBJECT_DIR = CMakeFiles/runTests.dir - OBJECT_FILE_DIR = CMakeFiles/runTests.dir/test - TARGET_COMPILE_PDB = CMakeFiles/runTests.dir/ - TARGET_PDB = runTests.pdb - - -# ============================================================================= -# Link build statements for EXECUTABLE target runTests - - -############################################# -# Link the executable runTests - -build runTests: CXX_EXECUTABLE_LINKER__runTests_Release CMakeFiles/runTests.dir/test/test_finmath.cpp.o | libfinmath_library.dylib || libfinmath_library.dylib - FLAGS = -O3 -DNDEBUG -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk -mmacosx-version-min=14.6 - LINK_LIBRARIES = -Wl,-rpath,/Users/shashank/finmath/cmake-build-debug libfinmath_library.dylib - OBJECT_DIR = CMakeFiles/runTests.dir - POST_BUILD = : - PRE_LINK = : - TARGET_COMPILE_PDB = CMakeFiles/runTests.dir/ - TARGET_FILE = runTests - TARGET_PDB = runTests.pdb - - -############################################# -# Utility command for build_and_test - -build build_and_test: phony CMakeFiles/build_and_test - - -############################################# -# Utility command for default - -build default: phony CMakeFiles/default build_and_test - -# ============================================================================= -# Object build statements for MODULE_LIBRARY target finmath_bindings - - -############################################# -# Order-only phony target for finmath_bindings - -build cmake_object_order_depends_target_finmath_bindings: phony || cmake_object_order_depends_target_finmath_library - -build CMakeFiles/finmath_bindings.dir/src/python_bindings.cpp.o: CXX_COMPILER__finmath_bindings_unscanned_Release /Users/shashank/finmath/src/python_bindings.cpp || cmake_object_order_depends_target_finmath_bindings - DEFINES = -Dfinmath_bindings_EXPORTS - DEP_FILE = CMakeFiles/finmath_bindings.dir/src/python_bindings.cpp.o.d - FLAGS = -O3 -DNDEBUG -std=gnu++17 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk -mmacosx-version-min=14.6 -fPIC -fvisibility=hidden -fcolor-diagnostics -flto - INCLUDES = -I/Users/shashank/finmath/include -isystem /Users/shashank/finmath/cmake-build-debug/_deps/pybind11-src/include -isystem /opt/homebrew/Caskroom/miniconda/base/include/python3.9 - OBJECT_DIR = CMakeFiles/finmath_bindings.dir - OBJECT_FILE_DIR = CMakeFiles/finmath_bindings.dir/src - TARGET_COMPILE_PDB = CMakeFiles/finmath_bindings.dir/ - TARGET_PDB = finmath.pdb - -build CMakeFiles/finmath_bindings.dir/src/cpp/Helper/helper.cpp.o: CXX_COMPILER__finmath_bindings_unscanned_Release /Users/shashank/finmath/src/cpp/Helper/helper.cpp || cmake_object_order_depends_target_finmath_bindings - DEFINES = -Dfinmath_bindings_EXPORTS - DEP_FILE = CMakeFiles/finmath_bindings.dir/src/cpp/Helper/helper.cpp.o.d - FLAGS = -O3 -DNDEBUG -std=gnu++17 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk -mmacosx-version-min=14.6 -fPIC -fvisibility=hidden -fcolor-diagnostics -flto - INCLUDES = -I/Users/shashank/finmath/include -isystem /Users/shashank/finmath/cmake-build-debug/_deps/pybind11-src/include -isystem /opt/homebrew/Caskroom/miniconda/base/include/python3.9 - OBJECT_DIR = CMakeFiles/finmath_bindings.dir - OBJECT_FILE_DIR = CMakeFiles/finmath_bindings.dir/src/cpp/Helper - TARGET_COMPILE_PDB = CMakeFiles/finmath_bindings.dir/ - TARGET_PDB = finmath.pdb - -build CMakeFiles/finmath_bindings.dir/src/cpp/InterestAndAnnuities/compound_interest.cpp.o: CXX_COMPILER__finmath_bindings_unscanned_Release /Users/shashank/finmath/src/cpp/InterestAndAnnuities/compound_interest.cpp || cmake_object_order_depends_target_finmath_bindings - DEFINES = -Dfinmath_bindings_EXPORTS - DEP_FILE = CMakeFiles/finmath_bindings.dir/src/cpp/InterestAndAnnuities/compound_interest.cpp.o.d - FLAGS = -O3 -DNDEBUG -std=gnu++17 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk -mmacosx-version-min=14.6 -fPIC -fvisibility=hidden -fcolor-diagnostics -flto - INCLUDES = -I/Users/shashank/finmath/include -isystem /Users/shashank/finmath/cmake-build-debug/_deps/pybind11-src/include -isystem /opt/homebrew/Caskroom/miniconda/base/include/python3.9 - OBJECT_DIR = CMakeFiles/finmath_bindings.dir - OBJECT_FILE_DIR = CMakeFiles/finmath_bindings.dir/src/cpp/InterestAndAnnuities - TARGET_COMPILE_PDB = CMakeFiles/finmath_bindings.dir/ - TARGET_PDB = finmath.pdb - -build CMakeFiles/finmath_bindings.dir/src/cpp/InterestAndAnnuities/simple_interest.cpp.o: CXX_COMPILER__finmath_bindings_unscanned_Release /Users/shashank/finmath/src/cpp/InterestAndAnnuities/simple_interest.cpp || cmake_object_order_depends_target_finmath_bindings - DEFINES = -Dfinmath_bindings_EXPORTS - DEP_FILE = CMakeFiles/finmath_bindings.dir/src/cpp/InterestAndAnnuities/simple_interest.cpp.o.d - FLAGS = -O3 -DNDEBUG -std=gnu++17 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk -mmacosx-version-min=14.6 -fPIC -fvisibility=hidden -fcolor-diagnostics -flto - INCLUDES = -I/Users/shashank/finmath/include -isystem /Users/shashank/finmath/cmake-build-debug/_deps/pybind11-src/include -isystem /opt/homebrew/Caskroom/miniconda/base/include/python3.9 - OBJECT_DIR = CMakeFiles/finmath_bindings.dir - OBJECT_FILE_DIR = CMakeFiles/finmath_bindings.dir/src/cpp/InterestAndAnnuities - TARGET_COMPILE_PDB = CMakeFiles/finmath_bindings.dir/ - TARGET_PDB = finmath.pdb - -build CMakeFiles/finmath_bindings.dir/src/cpp/OptionPricing/binomial_tree.cpp.o: CXX_COMPILER__finmath_bindings_unscanned_Release /Users/shashank/finmath/src/cpp/OptionPricing/binomial_tree.cpp || cmake_object_order_depends_target_finmath_bindings - DEFINES = -Dfinmath_bindings_EXPORTS - DEP_FILE = CMakeFiles/finmath_bindings.dir/src/cpp/OptionPricing/binomial_tree.cpp.o.d - FLAGS = -O3 -DNDEBUG -std=gnu++17 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk -mmacosx-version-min=14.6 -fPIC -fvisibility=hidden -fcolor-diagnostics -flto - INCLUDES = -I/Users/shashank/finmath/include -isystem /Users/shashank/finmath/cmake-build-debug/_deps/pybind11-src/include -isystem /opt/homebrew/Caskroom/miniconda/base/include/python3.9 - OBJECT_DIR = CMakeFiles/finmath_bindings.dir - OBJECT_FILE_DIR = CMakeFiles/finmath_bindings.dir/src/cpp/OptionPricing - TARGET_COMPILE_PDB = CMakeFiles/finmath_bindings.dir/ - TARGET_PDB = finmath.pdb - -build CMakeFiles/finmath_bindings.dir/src/cpp/OptionPricing/black_scholes.cpp.o: CXX_COMPILER__finmath_bindings_unscanned_Release /Users/shashank/finmath/src/cpp/OptionPricing/black_scholes.cpp || cmake_object_order_depends_target_finmath_bindings - DEFINES = -Dfinmath_bindings_EXPORTS - DEP_FILE = CMakeFiles/finmath_bindings.dir/src/cpp/OptionPricing/black_scholes.cpp.o.d - FLAGS = -O3 -DNDEBUG -std=gnu++17 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk -mmacosx-version-min=14.6 -fPIC -fvisibility=hidden -fcolor-diagnostics -flto - INCLUDES = -I/Users/shashank/finmath/include -isystem /Users/shashank/finmath/cmake-build-debug/_deps/pybind11-src/include -isystem /opt/homebrew/Caskroom/miniconda/base/include/python3.9 - OBJECT_DIR = CMakeFiles/finmath_bindings.dir - OBJECT_FILE_DIR = CMakeFiles/finmath_bindings.dir/src/cpp/OptionPricing - TARGET_COMPILE_PDB = CMakeFiles/finmath_bindings.dir/ - TARGET_PDB = finmath.pdb - -build CMakeFiles/finmath_bindings.dir/src/cpp/TimeSeries/rolling_volatility.cpp.o: CXX_COMPILER__finmath_bindings_unscanned_Release /Users/shashank/finmath/src/cpp/TimeSeries/rolling_volatility.cpp || cmake_object_order_depends_target_finmath_bindings - DEFINES = -Dfinmath_bindings_EXPORTS - DEP_FILE = CMakeFiles/finmath_bindings.dir/src/cpp/TimeSeries/rolling_volatility.cpp.o.d - FLAGS = -O3 -DNDEBUG -std=gnu++17 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk -mmacosx-version-min=14.6 -fPIC -fvisibility=hidden -fcolor-diagnostics -flto - INCLUDES = -I/Users/shashank/finmath/include -isystem /Users/shashank/finmath/cmake-build-debug/_deps/pybind11-src/include -isystem /opt/homebrew/Caskroom/miniconda/base/include/python3.9 - OBJECT_DIR = CMakeFiles/finmath_bindings.dir - OBJECT_FILE_DIR = CMakeFiles/finmath_bindings.dir/src/cpp/TimeSeries - TARGET_COMPILE_PDB = CMakeFiles/finmath_bindings.dir/ - TARGET_PDB = finmath.pdb - - -# ============================================================================= -# Link build statements for MODULE_LIBRARY target finmath_bindings - - -############################################# -# Link the shared module finmath.cpython-39-darwin.so - -build finmath.cpython-39-darwin.so: CXX_MODULE_LIBRARY_LINKER__finmath_bindings_Release CMakeFiles/finmath_bindings.dir/src/python_bindings.cpp.o CMakeFiles/finmath_bindings.dir/src/cpp/Helper/helper.cpp.o CMakeFiles/finmath_bindings.dir/src/cpp/InterestAndAnnuities/compound_interest.cpp.o CMakeFiles/finmath_bindings.dir/src/cpp/InterestAndAnnuities/simple_interest.cpp.o CMakeFiles/finmath_bindings.dir/src/cpp/OptionPricing/binomial_tree.cpp.o CMakeFiles/finmath_bindings.dir/src/cpp/OptionPricing/black_scholes.cpp.o CMakeFiles/finmath_bindings.dir/src/cpp/TimeSeries/rolling_volatility.cpp.o | libfinmath_library.dylib || libfinmath_library.dylib - ARCH_FLAGS = -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk -mmacosx-version-min=14.6 - LANGUAGE_COMPILE_FLAGS = -O3 -DNDEBUG - LINK_FLAGS = -Xlinker -undefined -Xlinker dynamic_lookup -flto - LINK_LIBRARIES = -Wl,-rpath,/Users/shashank/finmath/cmake-build-debug libfinmath_library.dylib - OBJECT_DIR = CMakeFiles/finmath_bindings.dir - POST_BUILD = cd /Users/shashank/finmath/cmake-build-debug && /Library/Developer/CommandLineTools/usr/bin/strip -x /Users/shashank/finmath/cmake-build-debug/finmath.cpython-39-darwin.so - PRE_LINK = : - TARGET_COMPILE_PDB = CMakeFiles/finmath_bindings.dir/ - TARGET_FILE = finmath.cpython-39-darwin.so - TARGET_PDB = finmath.pdb - - -############################################# -# Utility command for test - -build CMakeFiles/test.util: CUSTOM_COMMAND - COMMAND = cd /Users/shashank/finmath/cmake-build-debug && /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/bin/ctest --force-new-ctest-process - DESC = Running tests... - pool = console - restat = 1 - -build test: phony CMakeFiles/test.util - - -############################################# -# Utility command for edit_cache - -build CMakeFiles/edit_cache.util: CUSTOM_COMMAND - COMMAND = cd /Users/shashank/finmath/cmake-build-debug && /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available. - DESC = No interactive CMake dialog available... - restat = 1 - -build edit_cache: phony CMakeFiles/edit_cache.util - - -############################################# -# Utility command for rebuild_cache - -build CMakeFiles/rebuild_cache.util: CUSTOM_COMMAND - COMMAND = cd /Users/shashank/finmath/cmake-build-debug && /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/bin/cmake --regenerate-during-build -S/Users/shashank/finmath -B/Users/shashank/finmath/cmake-build-debug - DESC = Running CMake to regenerate build system... - pool = console - restat = 1 - -build rebuild_cache: phony CMakeFiles/rebuild_cache.util - - -############################################# -# Custom command for CMakeFiles/build_and_test - -build CMakeFiles/build_and_test | ${cmake_ninja_workdir}CMakeFiles/build_and_test: CUSTOM_COMMAND - COMMAND = cd /Users/shashank/finmath/cmake-build-debug && /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/bin/cmake --build . --target runTests && /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/bin/ctest --output-on-failure - - -############################################# -# Phony custom command for CMakeFiles/default - -build CMakeFiles/default | ${cmake_ninja_workdir}CMakeFiles/default: phony || build_and_test - -# ============================================================================= -# Write statements declared in CMakeLists.txt: -# /Users/shashank/finmath/CMakeLists.txt -# ============================================================================= - - -############################################# -# Utility command for test - -build _deps/pybind11-build/CMakeFiles/test.util: CUSTOM_COMMAND - COMMAND = cd /Users/shashank/finmath/cmake-build-debug/_deps/pybind11-build && /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/bin/ctest --force-new-ctest-process - DESC = Running tests... - pool = console - restat = 1 - -build _deps/pybind11-build/test: phony _deps/pybind11-build/CMakeFiles/test.util - - -############################################# -# Utility command for edit_cache - -build _deps/pybind11-build/CMakeFiles/edit_cache.util: CUSTOM_COMMAND - COMMAND = cd /Users/shashank/finmath/cmake-build-debug/_deps/pybind11-build && /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available. - DESC = No interactive CMake dialog available... - restat = 1 - -build _deps/pybind11-build/edit_cache: phony _deps/pybind11-build/CMakeFiles/edit_cache.util - - -############################################# -# Utility command for rebuild_cache - -build _deps/pybind11-build/CMakeFiles/rebuild_cache.util: CUSTOM_COMMAND - COMMAND = cd /Users/shashank/finmath/cmake-build-debug/_deps/pybind11-build && /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/bin/cmake --regenerate-during-build -S/Users/shashank/finmath -B/Users/shashank/finmath/cmake-build-debug - DESC = Running CMake to regenerate build system... - pool = console - restat = 1 - -build _deps/pybind11-build/rebuild_cache: phony _deps/pybind11-build/CMakeFiles/rebuild_cache.util - -# ============================================================================= -# Target aliases. - -build finmath_bindings: phony finmath.cpython-39-darwin.so - -build finmath_library: phony libfinmath_library.dylib - -# ============================================================================= -# Folder targets. - -# ============================================================================= - -############################################# -# Folder: /Users/shashank/finmath/cmake-build-debug - -build all: phony libfinmath_library.dylib runTests default finmath.cpython-39-darwin.so _deps/pybind11-build/all - -# ============================================================================= - -############################################# -# Folder: /Users/shashank/finmath/cmake-build-debug/_deps/pybind11-build - -build _deps/pybind11-build/all: phony - -# ============================================================================= -# Built-in targets - - -############################################# -# Re-run CMake if any of its inputs changed. - -build build.ninja: RERUN_CMAKE | /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeCCompiler.cmake.in /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeCCompilerABI.c /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeCInformation.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeCXXCompiler.cmake.in /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeCXXCompilerABI.cpp /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeCXXInformation.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeCommonLanguageInclude.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeCompilerIdDetection.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeDependentOption.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeDetermineCCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeDetermineCXXCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeDetermineCompileFeatures.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeDetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeDetermineCompilerABI.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeDetermineCompilerId.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeDetermineSystem.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeFindBinUtils.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeGenericSystem.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeInitializeConfigs.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeLanguageInformation.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakePackageConfigHelpers.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeParseArguments.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeParseImplicitIncludeInfo.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeParseImplicitLinkInfo.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeParseLibraryArchitecture.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeSystem.cmake.in /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeSystemSpecificInformation.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeSystemSpecificInitialize.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeTestCCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeTestCXXCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeTestCompilerCommon.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CheckCXXCompilerFlag.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CheckCXXSourceCompiles.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/ADSP-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/ARMCC-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/ARMClang-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/AppleClang-C.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/AppleClang-CXX.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/AppleClang-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/Borland-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/Bruce-C-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/CMakeCommonCompilerMacros.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/Clang-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/Clang-DetermineCompilerInternal.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/Clang.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/Compaq-C-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/Cray-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/CrayClang-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/Embarcadero-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/Fujitsu-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/FujitsuClang-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/GHS-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/GNU-C-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/GNU-CXX-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/GNU.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/HP-C-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/HP-CXX-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/IAR-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/IBMClang-C-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/IBMClang-CXX-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/Intel-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/IntelLLVM-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/LCC-C-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/LCC-CXX-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/MSVC-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/NVHPC-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/NVIDIA-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/OrangeC-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/PGI-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/PathScale-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/SCO-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/SDCC-C-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/SunPro-C-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/TI-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/TIClang-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/Tasking-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/TinyCC-C-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/VisualAge-C-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/VisualAge-CXX-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/Watcom-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/XL-C-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/XL-CXX-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/XLClang-C-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/XLClang-CXX-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/zOS-C-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/zOS-CXX-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/ExternalProject/shared_internal_commands.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/FetchContent.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/FetchContent/CMakeLists.cmake.in /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/FindGit.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/FindPackageHandleStandardArgs.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/FindPackageMessage.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/FindPythonInterp.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/GNUInstallDirs.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Internal/CMakeDetermineLinkerId.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Internal/CheckCompilerFlag.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Internal/CheckFlagCommonConfig.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Internal/CheckSourceCompiles.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Internal/FeatureTesting.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Platform/Apple-AppleClang-C.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Platform/Apple-AppleClang-CXX.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Platform/Apple-Clang-C.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Platform/Apple-Clang-CXX.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Platform/Apple-Clang.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Platform/Darwin-Determine-CXX.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Platform/Darwin-Initialize.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Platform/Darwin.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Platform/UnixPaths.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/WriteBasicConfigVersionFile.cmake /Users/shashank/finmath/CMakeLists.txt CMakeCache.txt CMakeFiles/3.29.6/CMakeCCompiler.cmake CMakeFiles/3.29.6/CMakeCXXCompiler.cmake CMakeFiles/3.29.6/CMakeSystem.cmake _deps/pybind11-src/CMakeLists.txt _deps/pybind11-src/tools/FindPythonLibsNew.cmake _deps/pybind11-src/tools/pybind11Common.cmake _deps/pybind11-src/tools/pybind11Tools.cmake - pool = console - - -############################################# -# A missing CMake input file is not an error. - -build /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeCCompiler.cmake.in /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeCCompilerABI.c /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeCInformation.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeCXXCompiler.cmake.in /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeCXXCompilerABI.cpp /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeCXXInformation.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeCommonLanguageInclude.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeCompilerIdDetection.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeDependentOption.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeDetermineCCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeDetermineCXXCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeDetermineCompileFeatures.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeDetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeDetermineCompilerABI.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeDetermineCompilerId.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeDetermineSystem.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeFindBinUtils.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeGenericSystem.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeInitializeConfigs.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeLanguageInformation.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakePackageConfigHelpers.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeParseArguments.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeParseImplicitIncludeInfo.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeParseImplicitLinkInfo.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeParseLibraryArchitecture.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeSystem.cmake.in /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeSystemSpecificInformation.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeSystemSpecificInitialize.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeTestCCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeTestCXXCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CMakeTestCompilerCommon.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CheckCXXCompilerFlag.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/CheckCXXSourceCompiles.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/ADSP-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/ARMCC-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/ARMClang-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/AppleClang-C.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/AppleClang-CXX.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/AppleClang-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/Borland-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/Bruce-C-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/CMakeCommonCompilerMacros.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/Clang-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/Clang-DetermineCompilerInternal.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/Clang.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/Compaq-C-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/Cray-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/CrayClang-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/Embarcadero-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/Fujitsu-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/FujitsuClang-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/GHS-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/GNU-C-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/GNU-CXX-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/GNU.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/HP-C-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/HP-CXX-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/IAR-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/IBMClang-C-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/IBMClang-CXX-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/Intel-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/IntelLLVM-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/LCC-C-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/LCC-CXX-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/MSVC-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/NVHPC-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/NVIDIA-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/OrangeC-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/PGI-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/PathScale-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/SCO-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/SDCC-C-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/SunPro-C-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/TI-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/TIClang-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/Tasking-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/TinyCC-C-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/VisualAge-C-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/VisualAge-CXX-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/Watcom-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/XL-C-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/XL-CXX-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/XLClang-C-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/XLClang-CXX-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/zOS-C-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Compiler/zOS-CXX-DetermineCompiler.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/ExternalProject/shared_internal_commands.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/FetchContent.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/FetchContent/CMakeLists.cmake.in /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/FindGit.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/FindPackageHandleStandardArgs.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/FindPackageMessage.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/FindPythonInterp.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/GNUInstallDirs.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Internal/CMakeDetermineLinkerId.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Internal/CheckCompilerFlag.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Internal/CheckFlagCommonConfig.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Internal/CheckSourceCompiles.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Internal/FeatureTesting.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Platform/Apple-AppleClang-C.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Platform/Apple-AppleClang-CXX.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Platform/Apple-Clang-C.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Platform/Apple-Clang-CXX.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Platform/Apple-Clang.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Platform/Darwin-Determine-CXX.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Platform/Darwin-Initialize.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Platform/Darwin.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/Platform/UnixPaths.cmake /Applications/CLion.app/Contents/bin/cmake/mac/aarch64/share/cmake-3.29/Modules/WriteBasicConfigVersionFile.cmake /Users/shashank/finmath/CMakeLists.txt CMakeCache.txt CMakeFiles/3.29.6/CMakeCCompiler.cmake CMakeFiles/3.29.6/CMakeCXXCompiler.cmake CMakeFiles/3.29.6/CMakeSystem.cmake _deps/pybind11-src/CMakeLists.txt _deps/pybind11-src/tools/FindPythonLibsNew.cmake _deps/pybind11-src/tools/pybind11Common.cmake _deps/pybind11-src/tools/pybind11Tools.cmake: phony - - -############################################# -# Clean all the built files. - -build clean: CLEAN - - -############################################# -# Print all primary targets available. - -build help: HELP - - -############################################# -# Make the all target the default. - -default all diff --git a/docs/OptionPricing/black_scholes.md b/docs/OptionPricing/black_scholes.md deleted file mode 100644 index a352e13..0000000 --- a/docs/OptionPricing/black_scholes.md +++ /dev/null @@ -1,91 +0,0 @@ -# Black-Scholes Option Pricing Model - -## Overview - -The Black-Scholes model is a mathematical model for pricing an options contract. The model assumes the market is efficient and the price of the underlying asset follows a geometric Brownian motion with constant drift and volatility. - -## Function Signature - -```cpp -double black_scholes(OptionType type, double strike, double price, double time, double rate, double volatility); -``` - -## Parameters - -- `type` (OptionType): The type of the option (CALL or PUT). -- `strike` (double): The strike price of the option. -- `price` (double): The current price of the underlying asset. -- `time` (double): The time to maturity (in years). -- `rate` (double): The risk-free interest rate (annualized). -- `volatility` (double): The volatility of the underlying asset (annualized). - -## Returns - -- (double): The price of the option. - -## Example Usage - -```cpp -#include "finmath/OptionPricing/black_scholes.h" - -int main() { - double call_price = black_scholes(OptionType::CALL, 100, 105, 1, 0.05, 0.2); - double put_price = black_scholes(OptionType::PUT, 100, 95, 1, 0.05, 0.2); - - std::cout << "Call Option Price: " << call_price << std::endl; - std::cout << "Put Option Price: " << put_price << std::endl; - - return 0; -} -``` - -## Python Usage - -```python -import finmath - -# Example: pricing a call option using Black-Scholes -option_price_call = finmath.black_scholes( - finmath.OptionType.CALL, - 100.0, # strike - 105.0, # current price - 1.0, # time (in years) - 0.05, # risk-free rate - 0.2 # volatility -) -print("Call Option Price:", option_price_call) - -# Example: pricing a put option -option_price_put = finmath.black_scholes( - finmath.OptionType.PUT, - 100.0, - 95.0, - 1.0, - 0.05, - 0.2 -) -print("Put Option Price:", option_price_put) -``` - -## Mathematical Formula - -The Black-Scholes formula for a call option is: - -\[ C = S_0 \Phi(d_1) - K e^{-rT} \Phi(d_2) \] - -For a put option, the formula is: - -\[ P = K e^{-rT} \Phi(-d_2) - S_0 \Phi(-d_1) \] - -Where: - -\[ d_1 = \frac{\ln(S_0 / K) + (r + \sigma^2 / 2) T}{\sigma \sqrt{T}} \] - -\[ d_2 = d_1 - \sigma \sqrt{T} \] - -- \( \Phi \) is the cumulative distribution function of the standard normal distribution. -- \( S_0 \) is the current price of the underlying asset. -- \( K \) is the strike price. -- \( r \) is the risk-free interest rate. -- \( \sigma \) is the volatility. -- \( T \) is the time to maturity. diff --git a/docs/TimeSeries/rsi.md b/docs/TimeSeries/rsi.md deleted file mode 100644 index dee494a..0000000 --- a/docs/TimeSeries/rsi.md +++ /dev/null @@ -1,47 +0,0 @@ -# Relative Strength Index (RSI) - -## Overview - -The Relative Strength Index (RSI) is a momentum oscillator that measures the speed and magnitude of price movements to identify overbought or oversold conditions in a market. - -## Function Signature - -```cpp -std::vector compute_smoothed_rsi(const std::vector& prices, size_t window_size); -``` - -## Parameters - -- `prices` (std::vector): Historical price data. -- `window_size` (size_t): The period length used for the RSI calculation. - -## Returns - -- (std::vector): A list of RSI values for each eligible index in the original price array. - -## Example Usage - -```cpp -#include "finmath/TimeSeries/rsi.h" -// ...existing code... -std::vector prices = {44.34, 44.09, 44.15, 43.61, 44.33}; -std::vector rsi_vals = compute_smoothed_rsi(prices, 14); -// ...existing code... -``` - -## Python Usage - -```python -import finmath -# ...existing code... -prices = [44.34, 44.09, 44.15, 43.61, 44.33] -rsi_vals = finmath.smoothed_rsi(prices, 14) -# ...existing code... -``` - -## Mathematical Formula - -RSI is commonly calculated as follows: -RS = (Avg. of gains over N periods) / (Avg. of losses over N periods) - -RSI = 100 - (100 / (1 + RS)) diff --git a/docs/TimeSeries/simple_moving_average.md b/docs/TimeSeries/simple_moving_average.md deleted file mode 100644 index 9533f6a..0000000 --- a/docs/TimeSeries/simple_moving_average.md +++ /dev/null @@ -1,48 +0,0 @@ -# Simple Moving Average (SMA) - -## Overview - -A simple moving average (SMA) is calculated by summing a series of data points and dividing by the number of points in the series. This technique smooths out short-term fluctuations and highlights longer-term trends. - -## Function Signature - -```cpp -std::vector simple_moving_average(const std::vector& data, size_t window_size); -``` - -## Parameters - -- `data` (std::vector): Historical price or data series. -- `window_size` (size_t): Number of data points used to calculate each average. - -## Returns - -- (std::vector): A list of moving averages for each position where a full window was available. - -## Example Usage - -### C++ Example - -```cpp -#include "finmath/TimeSeries/simple_moving_average.h" -// ...existing code... -std::vector data = {10.0, 11.0, 12.5, 13.0, 12.8}; -// ...existing code... -std::vector sma_vals = simple_moving_average(data, 3); -// ...existing code... -``` - -### Python Example - -```python -import finmath -# ...existing code... -data = [10.0, 11.0, 12.5, 13.0, 12.8] -# ...existing code... -sma_vals = finmath.simple_moving_average(data, 3) -# ...existing code... -``` - -## Mathematical Formula - -SMA = (Sum of N data points) / N diff --git a/docs/template.md b/docs/template.md deleted file mode 100644 index 19fe49b..0000000 --- a/docs/template.md +++ /dev/null @@ -1,21 +0,0 @@ -# Function Documentation Template - -## Overview - -// ...explain what the function does... - -## Function Signature - -// ...provide the function signature... - -## Parameters - -// ...list parameters... - -## Returns - -// ...summarize returned values... - -## Example Usage - -// ...show usage (C++ and/or Python)... diff --git a/include/finmath/GraphAlgos/bellman_arbitrage.h b/include/finmath/GraphAlgos/bellman_arbitrage.h deleted file mode 100644 index 174454a..0000000 --- a/include/finmath/GraphAlgos/bellman_arbitrage.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - -template -using AdjList = std::unordered_map>>; - -template -std::vector detectArbitrageBellman(const AdjList& graph); - diff --git a/include/finmath/Helper/helper.h b/include/finmath/Helper/helper.h deleted file mode 100644 index 4879b87..0000000 --- a/include/finmath/Helper/helper.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef HELPER_H -#define HELPER_H - -double normal_cdf(double x); -double normal_pdf(double x); -double combinations(int n, int k); - -#endif \ No newline at end of file diff --git a/include/finmath/InterestAndAnnuities/compound_interest.h b/include/finmath/InterestAndAnnuities/compound_interest.h deleted file mode 100644 index 9725f0c..0000000 --- a/include/finmath/InterestAndAnnuities/compound_interest.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef COMPOUND_INTEREST_H -#define COMPOUND_INTEREST_H - -double compound_interest(double principal, double rate, int time, int frequency); - -#endif // COMPOUND_INTEREST_H diff --git a/include/finmath/InterestAndAnnuities/simple_interest.h b/include/finmath/InterestAndAnnuities/simple_interest.h deleted file mode 100644 index e1c0e53..0000000 --- a/include/finmath/InterestAndAnnuities/simple_interest.h +++ /dev/null @@ -1,10 +0,0 @@ -// -// Created by Prajwal on 7/18/24. -// - -#ifndef SIMPLE_INTEREST_H -#define SIMPLE_INTEREST_H - -double simple_interest(double principal, double rate, double time); - -#endif // SIMPLE_INTEREST_H diff --git a/include/finmath/MarkovChains/markov_chain.h b/include/finmath/MarkovChains/markov_chain.h new file mode 100644 index 0000000..3de865a --- /dev/null +++ b/include/finmath/MarkovChains/markov_chain.h @@ -0,0 +1,18 @@ +#ifndef MARKOV_CHAIN_H +#define MARKOV_CHAIN_H + +#include +#include +#include + +// TODO: Implement Markov Chain functionality +// Potential features: +// - Transition matrix operations +// - State space modeling +// - Steady-state calculations +// - N-step transition probabilities +// - First passage times +// - Absorbing states analysis + +#endif // MARKOV_CHAIN_H + diff --git a/include/finmath/OptionPricing/binomial_tree.h b/include/finmath/OptionPricing/binomial_tree.h deleted file mode 100644 index 91eaa46..0000000 --- a/include/finmath/OptionPricing/binomial_tree.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef BINOMIAL_TREE_H -#define BINOMIAL_TREE_H - -#include "options_pricing_types.h" - -double binomial_option_pricing(OptionType type, double S0, double K, double T, double r, double sigma, long N); - -namespace Binom { - double compute_delta(OptionType type, double S0, double K, double T, double r, double sigma, long N, double delta_S = -1); - double compute_gamma(OptionType type, double S0, double K, double T, double r, double sigma, long N, double delta_S = -1); - double compute_vega(OptionType type, double S0, double K, double T, double r, double sigma, long N, double delta_sig = -1); - double compute_theta(OptionType type, double S0, double K, double T, double r, double sigma, long N, double delta_T = -1); - double compute_rho(OptionType type, double S0, double K, double T, double r, double sigma, long N, double delta_r = -1); -} - -#endif diff --git a/include/finmath/OptionPricing/black_scholes.h b/include/finmath/OptionPricing/black_scholes.h deleted file mode 100644 index c5be713..0000000 --- a/include/finmath/OptionPricing/black_scholes.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef BLACK_SCHOLES_H -#define BLACK_SCHOLES_H - -#include "options_pricing_types.h" - -double black_scholes(OptionType type, double strike, double price, double time, double rate, double volatility); - -namespace BlackScholes { - double compute_delta(OptionType type, double S0, double K, double t, double r, double q, double sigma); - double compute_gamma(double S0, double K, double t, double r, double q, double sigma); - double compute_vega(double S0, double K, double t, double r, double q, double sigma); - double compute_theta(OptionType type, double S0, double K, double t, double T, double r, double q, double sigma); - double compute_rho(OptionType type, double S0, double K, double t, double r, double q, double sigma); -} - -#endif //BLACK_SCHOLES_H diff --git a/include/finmath/OptionPricing/options_pricing.h b/include/finmath/OptionPricing/options_pricing.h deleted file mode 100644 index ac46242..0000000 --- a/include/finmath/OptionPricing/options_pricing.h +++ /dev/null @@ -1,11 +0,0 @@ -// -// Created by Prajwal on 7/18/24. -// - -#ifndef OPTIONS_PRICING_H -#define OPTIONS_PRICING_H - -#include "finmath/OptionPricing/black_scholes.h" -#include "finmath/OptionPricing/binomial_tree.h" - -#endif //OPTIONS_PRICING_H diff --git a/include/finmath/OptionPricing/options_pricing_types.h b/include/finmath/OptionPricing/options_pricing_types.h deleted file mode 100644 index abd790f..0000000 --- a/include/finmath/OptionPricing/options_pricing_types.h +++ /dev/null @@ -1,10 +0,0 @@ -// -// Created by Prajwal on 7/18/24. -// - -#ifndef OPTIONS_PRICING_TYPES_H -#define OPTIONS_PRICING_TYPES_H - -enum class OptionType {CALL, PUT}; - -#endif //OPTIONS_PRICING_TYPES_H diff --git a/include/finmath/TimeSeries/ema.h b/include/finmath/TimeSeries/ema.h deleted file mode 100644 index ddf80c2..0000000 --- a/include/finmath/TimeSeries/ema.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef EMA_H -#define EMA_H - -#include - -// Function to compute the Exponential Moving Average (EMA) using window size -std::vector compute_ema(const std::vector& prices, size_t window); - -// Function to compute the Exponential Moving Average (EMA) using a smoothing factor -std::vector compute_ema_with_smoothing(const std::vector& prices, double smoothing_factor); - -#endif // EMA_H diff --git a/include/finmath/TimeSeries/rolling_std_dev.h b/include/finmath/TimeSeries/rolling_std_dev.h deleted file mode 100644 index a5fb294..0000000 --- a/include/finmath/TimeSeries/rolling_std_dev.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef ROLLING_STD_DEV -#define ROLLING_STD_DEV -#include -//function to compute rolling_std_dev with a perfect sliding window size -std::vector rolling_std_dev(size_t window_size, const std::vector &prices); -#endif \ No newline at end of file diff --git a/include/finmath/TimeSeries/rolling_volatility.h b/include/finmath/TimeSeries/rolling_volatility.h deleted file mode 100644 index 7385564..0000000 --- a/include/finmath/TimeSeries/rolling_volatility.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef ROLLING_VOLATILITY_H -#define ROLLING_VOLATILITY_H - -#include - -// Function to compute the logarithmic returns from prices -std::vector compute_log_returns(const std::vector& prices); - -// Function to compute the standard deviation of a vector -double compute_std(const std::vector& data); - -// Function to compute the rolling volatility from a time series of prices -std::vector rolling_volatility(const std::vector& prices, size_t window_size); - -#endif // ROLLING_VOLATILITY_H diff --git a/include/finmath/TimeSeries/rsi.h b/include/finmath/TimeSeries/rsi.h deleted file mode 100644 index ac1c6fa..0000000 --- a/include/finmath/TimeSeries/rsi.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef RSI_H -#define RSI_H - -#include - -//function to compute the average gain over a window -double compute_avg_gain(const std::vector& price_changes, size_t window_size); - -// Function to compute the average loss over a window -double compute_avg_loss(const std::vector& price_changes, size_t window_size); - -// Function to compute the RSI from a time series of prices -std::vector compute_smoothed_rsi(const std::vector& prices, size_t window_size); - -#endif // RSI_H diff --git a/include/finmath/TimeSeries/simple_moving_average.h b/include/finmath/TimeSeries/simple_moving_average.h deleted file mode 100644 index 88c7068..0000000 --- a/include/finmath/TimeSeries/simple_moving_average.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef SIMPLE_MOVING_AVERAGE_H -#define SIMPLE_MOVING_AVERAGE_H - -#include - -// Function to compute the moving average from a time series -std::vector simple_moving_average(const std::vector& data, size_t window_size); - -#endif // MOVING_AVERAGE_H diff --git a/include/finmath/finmath.h b/include/finmath/finmath.h index 33bc7a0..a8d9d4c 100644 --- a/include/finmath/finmath.h +++ b/include/finmath/finmath.h @@ -1,14 +1,6 @@ #ifndef FINMATH_H #define FINMATH_H -#include "finmath/Helper/helper.h" -#include "finmath/InterestAndAnnuities/compound_interest.h" -#include "finmath/OptionPricing/options_pricing.h" -#include "finmath/TimeSeries/rolling_volatility.h" -#include "finmath/TimeSeries/simple_moving_average.h" -#include "finmath/TimeSeries/rsi.h" -#include "finmath/TimeSeries/ema.h" -#include "finmath/TimeSeries/rolling_std_dev.h" -// Include other headers as needed +#include "finmath/MarkovChains/markov_chain.h" #endif // FINMATH_H diff --git a/src/cpp/GraphAlgos/bellman_arbitrage.cpp b/src/cpp/GraphAlgos/bellman_arbitrage.cpp deleted file mode 100644 index debd606..0000000 --- a/src/cpp/GraphAlgos/bellman_arbitrage.cpp +++ /dev/null @@ -1,84 +0,0 @@ -#include "finmath/GraphAlgos/bellman_arbitrage.h" - -#include -#include - -// https://cp-algorithms.com/graph/finding-negative-cycle-in-graph.html - -template -std::vector detectArbitrageBellman(const AdjList& graph) { - std::vector cycle; - - // get modified graph which has edge weights of negative log of original graph's edge weights - AdjList logGraph; - for (const auto& [from, neighbors] : graph) { - for (const auto& [to, rate] : neighbors) { - if (rate <= 0.0) { - continue; - } - double weight = -std::log(rate); - logGraph[from].emplace_back(to, weight); - } - } - - if (logGraph.empty()) { - return cycle; - } - - std::unordered_map dist; - std::unordered_map parent; - - for (const auto& [node, _] : logGraph) { - dist[node] = 0.0; // Start all at 0 to catch any negative cycle - parent[node] = node; - } - - int numVertices = static_cast(logGraph.size()); - - // relax edges - Node lastUpdated; - for (int i = 0; i < numVertices; ++i) { - lastUpdated = Node(); // reset - bool anyUpdate = false; - - for (const auto& [node, neighbors] : logGraph) { - for (const auto& [next_node, weight] : neighbors) { - if (dist[node] + weight < dist[next_node]) { - dist[next_node] = dist[node] + weight; - parent[next_node] = node; - lastUpdated = next_node; - anyUpdate = true; - } - } - } - - if (!anyUpdate) { - return cycle; - } - } - - // negative weight cycle if we can still relax an edge - if (lastUpdated != Node()) { - Node cycleStart = lastUpdated; - - for (int i = 0; i < numVertices; ++i) { - cycleStart = parent[cycleStart]; - } - - Node curr = cycleStart; - - do { - cycle.push_back(curr); - curr = parent[curr]; - } while (curr != cycleStart); - - cycle.push_back(cycleStart); - std::reverse(cycle.begin(), cycle.end()); - - return cycle; - } - - return cycle; -} - -template std::vector detectArbitrageBellman(const AdjList& graph); diff --git a/src/cpp/Helper/helper.cpp b/src/cpp/Helper/helper.cpp deleted file mode 100644 index 53b6d98..0000000 --- a/src/cpp/Helper/helper.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include "finmath/Helper/helper.h" - - -// Standard normal cumulative distribution function -double normal_cdf(double x) { - return 0.5 * std::erfc(-x / std::sqrt(2)); -} - -// Standard normal probability density function -double normal_pdf(double x) { - return std::exp(-0.5 * x * x) / std::sqrt(2 * M_PI); -} - -long long combinations(long n, long k) { - // Ensure k <= n - k to minimize operations - if (k > n - k) { - k = n - k; - } - - long long result = 1; // Use long long to handle large numbers - - // Efficiently compute the binomial coefficient - for (long i = 0; i < k; ++i) { - result *= (n - i); // Multiply by (n - i) - result /= (i + 1); // Divide by (i + 1) - } - - return result; -} - diff --git a/src/cpp/InterestAndAnnuities/compound_interest.cpp b/src/cpp/InterestAndAnnuities/compound_interest.cpp deleted file mode 100644 index 901ca91..0000000 --- a/src/cpp/InterestAndAnnuities/compound_interest.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "finmath/InterestAndAnnuities/compound_interest.h" -#include - -double compound_interest(double principal, double rate, int time, int frequency) { - if (time < 0) { - return 0.0; - } - return principal * std::pow((1 + rate / (100 * frequency)), time * frequency); -} diff --git a/src/cpp/InterestAndAnnuities/docs.md b/src/cpp/InterestAndAnnuities/docs.md deleted file mode 100644 index 5fd27cb..0000000 --- a/src/cpp/InterestAndAnnuities/docs.md +++ /dev/null @@ -1,60 +0,0 @@ -# Interest And Annuities Documentation - -This document provides documentation for functions available in InterestAndAnnuities in the `FinMath` library, organized by category. Each function includes its description, syntax, parameters, return values, and usage examples. - ---- - -## Table of Contents - -- [Interest Functions](#interest-functions) - - [compound_interest](#compound_interest) - - [simple_interest](#simple_interest) -- [Annuity Functions](#annuity-functions) - - ---- - -## Interest Functions - -### `compound_interest` - -#### Description - -Calculates the future value based on compound interest, given an initial principal, rate, time period, and compounding frequency. - -#### Syntax - -```cpp -double compound_interest(double principal, double rate, int time, int frequency); -``` - -#### Parameters -- **principal** (`double`): The initial amount of money invested or loaned. -- **rate** (`double`): The interest rate per period (expressed as a decimal, e.g., 0.05 for 5%). -- **time** (`int`): The total time in years that the money is invested or borrowed for. -- **frequency** (`int`): The number of times interest is compounded per year. - -#### Returns -- **double**: The future value after applying compound interest. - ---- - -### `simple_interest` - -#### Description - -Calculates the future value based on simple interest, given an initial principal, rate, and time period. - -#### Syntax - -```cpp -double simple_interest(double principal, double rate, double time); -``` - -#### Parameters -- **principal** (`double`): The initial amount of money invested or loaned. -- **rate** (`double`): The interest rate per period (expressed as a decimal, e.g., 0.05 for 5%). -- **time** (`double`): The total time in years that the money is invested or borrowed for. - -#### Returns -- **double**: The future value after applying simple interest. diff --git a/src/cpp/InterestAndAnnuities/simple_interest.cpp b/src/cpp/InterestAndAnnuities/simple_interest.cpp deleted file mode 100644 index 941d063..0000000 --- a/src/cpp/InterestAndAnnuities/simple_interest.cpp +++ /dev/null @@ -1,10 +0,0 @@ -// -// Created by Prajwal on 7/18/24. -// - -#include "finmath/InterestAndAnnuities/simple_interest.h" -#include - -double simple_interest(double principal, double rate, double time) { - return principal * (1 + rate * time); -} diff --git a/src/cpp/MarkovChains/markov_chain.cpp b/src/cpp/MarkovChains/markov_chain.cpp new file mode 100644 index 0000000..f2fade4 --- /dev/null +++ b/src/cpp/MarkovChains/markov_chain.cpp @@ -0,0 +1,13 @@ +#include "finmath/MarkovChains/markov_chain.h" +#include +#include + +// TODO: Implement Markov Chain functions + +// Example function signatures (placeholder): +// +// std::vector> compute_transition_matrix(const std::vector& states); +// std::vector compute_steady_state(const std::vector>& transition_matrix); +// std::vector> matrix_power(const std::vector>& matrix, int n); +// double compute_first_passage_time(const std::vector>& transition_matrix, int from_state, int to_state); + diff --git a/src/cpp/OptionPricing/binomial_tree.cpp b/src/cpp/OptionPricing/binomial_tree.cpp deleted file mode 100644 index 00243af..0000000 --- a/src/cpp/OptionPricing/binomial_tree.cpp +++ /dev/null @@ -1,85 +0,0 @@ -#include -#include -#include -#include "finmath/OptionPricing/binomial_tree.h" -#include "finmath/Helper/helper.h" - -double binomial_option_pricing(OptionType type, double S0, double K, double T, double r, double sigma, long N) { - double dt = T / N; - double u = std::exp(sigma * std::sqrt(dt)); - double d = std::exp(-sigma * std::sqrt(dt)); - double p = (std::exp(r * dt) - d) / (u - d); - double value = 0.0; - - // Start with the initial binomial coefficient C(N, 0) = 1 - double binomial_coeff = 1.0; - - for (long i = 0; i <= N; ++i) { - double node_prob = binomial_coeff * std::pow(p, i) * std::pow(1 - p, N - i); - double ST = S0 * std::pow(u, i) * std::pow(d, N - i); - - if (type == OptionType::CALL) { - value += std::max(ST - K, 0.0) * node_prob; - } else if (type == OptionType::PUT) { - value += std::max(K - ST, 0.0) * node_prob; - } - - // Update binomial coefficient for next iteration: C(N, i+1) - if (i < N) { - binomial_coeff *= (N - i) / double(i + 1); - } - } - - return value * std::exp(-r * T); -} - -namespace Binom { - double compute_delta(OptionType type, double S0, double K, double T, double r, double sigma, long N, double delta_S) { - if (delta_S < 0) { - delta_S = 0.001 * S0; - } - - double orig_option_price = binomial_option_pricing(type, S0, K, T, r, sigma, N); - double new_option_price = binomial_option_pricing(type, S0 + delta_S, K, T, r, sigma, N); - return (new_option_price - orig_option_price) / delta_S; - } - - double compute_gamma(OptionType type, double S0, double K, double T, double r, double sigma, long N, double delta_S) { - if (delta_S < 0) { - delta_S = 0.001 * S0; - } - double price_up = binomial_option_pricing(type, S0 + delta_S, K, T, r, sigma, N); - double price_base = binomial_option_pricing(type, S0, K, T, r, sigma, N); - double price_down = binomial_option_pricing(type, S0 - delta_S, K, T, r, sigma, N); - return (price_up - 2 * price_base + price_down) / (delta_S * delta_S); - } - - double compute_vega(OptionType type, double S0, double K, double T, double r, double sigma, long N, double delta_sig) { - if (delta_sig == -1) { - delta_sig = 0.001 * sigma; - } - double price_up = binomial_option_pricing(type, S0, K, T, r, sigma + delta_sig, N); - double price_base = binomial_option_pricing(type, S0, K, T, r, sigma, N); - return 0.01 * (price_up - price_base) / delta_sig; - } - - double compute_theta(OptionType type, double S0, double K, double T, double r, double sigma, long N, double delta_T) { - if (delta_T == -1) { - delta_T = 0.001 * T; - } - - double price_up = binomial_option_pricing(type, S0, K, T + delta_T, r, sigma, N); - double price_base = binomial_option_pricing(type, S0, K, T, r, sigma, N); - return (price_up - price_base) / delta_T; - } - - double compute_rho(OptionType type, double S0, double K, double T, double r, double sigma, long N, double delta_r) { - if (delta_r == -1) { - delta_r = 0.001 * r; - } - - double price_up = binomial_option_pricing(type, S0, K, T, r + delta_r, sigma, N); - double price_base = binomial_option_pricing(type, S0, K, T, r, sigma, N); - return 0.01 * (price_up - price_base) / delta_r; - } -} diff --git a/src/cpp/OptionPricing/black_scholes.cpp b/src/cpp/OptionPricing/black_scholes.cpp deleted file mode 100644 index fb233be..0000000 --- a/src/cpp/OptionPricing/black_scholes.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include -#include "finmath/OptionPricing/black_scholes.h" -#include "finmath/Helper/helper.h" - -double black_scholes(OptionType type, double strike, double price, double time, double rate, double volatility){ - double d1 = (std::log(price / strike) + ((rate + volatility*volatility/2) * time)) / (volatility * std::sqrt(time)); - double d2 = d1 - (volatility * std::sqrt(time)); - - if (type == OptionType::CALL) { - return price * normal_cdf(d1) - std::exp(-rate * time) * strike * normal_cdf(d2); - } else { - return strike * std::exp(-rate * time) * normal_cdf(-d2) - price * normal_cdf(-d1); - } -} - -namespace BlackScholes { - - // S0 is underlying price, K = strike price, t = time until expiration (percent of year) - // r = continuously compounded risk-free interest rate, q = continuously compounded dividend rate, T = unit of time (can be calendar days, trading days, etc.) - // referred to: https://www.macroption.com/black-scholes-formula/ - - double compute_delta(OptionType type, double S0, double K, double t, double r, double q, double sigma) { - double d1 = (std::log(S0 / K) + (r - q + 0.5 * sigma * sigma) * t) / (sigma * std::sqrt(t)); - return (type == OptionType::CALL) ? std::exp(-q * t) * normal_cdf(d1) : std::exp(-q * t) * (normal_cdf(d1) - 1); - } - - double compute_gamma(double S0, double K, double t, double r, double q, double sigma) { - double d1 = (std::log(S0 / K) + (r - q + 0.5 * sigma * sigma) * t) / (sigma * std::sqrt(t)); - return (std::exp(-q * t) * normal_pdf(d1)) / (S0 * sigma * std::sqrt(t)); - } - - double compute_vega(double S0, double K, double t, double r, double q, double sigma) { - double d1 = (std::log(S0 / K) + (r - q + 0.5 * sigma * sigma) * t) / (sigma * std::sqrt(t)); - return 0.01 * S0 * std::exp(-q * t) * std::sqrt(t) * normal_pdf(d1); - } - - double compute_theta(OptionType type, double S0, double K, double t, double T, double r, double q, double sigma) { - double d1 = (std::log(S0 / K) + (r - q + 0.5 * sigma * sigma) * t) / (sigma * std::sqrt(t)); - double d2 = d1 - sigma * std::sqrt(t); - double term1 = -1 * (S0 * sigma * std::exp(-q * t) * normal_pdf(d1)) / (2 * std::sqrt(t)); - double term2 = r * K * std::exp(-r * t); - double term3 = q * S0 * std::exp(-q * t); - return (type == OptionType::CALL) ? 1 / T * (term1 - term2 * normal_cdf(d2) + term3 * normal_cdf(d1)) : 1 / T * (term1 + term2 * normal_cdf(-d2) - term3 * normal_cdf(-d1)); - } - - double compute_rho(OptionType type, double S0, double K, double t, double r, double q, double sigma) { - double d1 = (std::log(S0 / K) + (r - q + 0.5 * sigma * sigma) * t) / (sigma * std::sqrt(t)); - double d2 = d1 - sigma * std::sqrt(t); - return (type == OptionType::CALL) ? 0.01 * K * t * std::exp(-r * t) * normal_cdf(d2) : -0.01 * K * t * std::exp(-r * t) * normal_cdf(-d2); - } -} - diff --git a/src/cpp/TimeSeries/docs.md b/src/cpp/TimeSeries/docs.md deleted file mode 100644 index 3c15fb8..0000000 --- a/src/cpp/TimeSeries/docs.md +++ /dev/null @@ -1,167 +0,0 @@ -# TimeSeries Functions Documentation - -This document provides documentation for functions available in the `TimeSeries` module of the `FinMath` library, organized by category. Each function includes its description, syntax, parameters, return values, and usage examples. - ---- - -## Table of Contents - -- [Exponential Moving Average (EMA) Functions](#exponential-moving-average-ema-functions) - - [ema_window](#ema_window) - - [ema_smoothing](#ema_smoothing) -- [Relative Strength Index (RSI) Functions](#relative-strength-index-rsi-functions) - - [rsi](#rsi) -- [Simple Moving Average (SMA) Functions](#simple-moving-average-sma-functions) - - [simple_moving_average](#simple_moving_average) - ---- - -## Exponential Moving Average (EMA) Functions - -### `ema_window` - -#### Description - -Calculates the Exponential Moving Average (EMA) of a given price series over a specified window size. EMA gives more weight to recent prices, making it more responsive to new information. - -#### Syntax - -```python -def ema_window(prices: List[float], window_size: int) -> List[float]: -``` - -#### Parameters - -- **prices** (`List[float]`): A list containing the price series data. -- **window_size** (`int`): The number of periods over which to calculate the EMA. - -#### Returns - -- **List[float]**: A list containing the EMA values corresponding to the input price series. - -#### Usage Example - -```python -from finmath.TimeSeries import ema_window - -prices = [22.27, 22.19, 22.08, 22.17, 22.18, 22.13, 22.23, 22.43, 22.24, 22.29] -window_size = 10 -ema = ema_window(prices, window_size) - -print(ema) -# Output: [22.27, 22.19, 22.08, 22.17, 22.18, 22.13, 22.23, 22.43, 22.24, 22.29] -``` - ---- - -### `ema_smoothing` - -#### Description - -Calculates the Exponential Moving Average (EMA) of a given price series using a specified smoothing factor. This allows for customized weighting of the price data. - -#### Syntax - -```python -def ema_smoothing(prices: List[float], smoothing_factor: float) -> List[float]: -``` - -#### Parameters - -- **prices** (`List[float]`): A list containing the price series data. -- **smoothing_factor** (`float`): The smoothing factor used in EMA calculation, typically `2.0 / (window_size + 1)`. - -#### Returns - -- **List[float]**: A list containing the EMA values corresponding to the input price series. - -#### Usage Example - -```python -from finmath.TimeSeries import ema_smoothing - -prices = [22.27, 22.19, 22.08, 22.17, 22.18, 22.13, 22.23, 22.43, 22.24, 22.29] -smoothing_factor = 2.0 / (10 + 1) -ema = ema_smoothing(prices, smoothing_factor) - -print(ema) -# Output: [22.27, 22.19, 22.08, 22.17, 22.18, 22.13, 22.23, 22.43, 22.24, 22.29] -``` - ---- - -## Relative Strength Index (RSI) Functions - -### `rsi` - -#### Description - -Calculates the Relative Strength Index (RSI) for a given price series and window size. RSI is a momentum oscillator that measures the speed and change of price movements, typically used to identify overbought or oversold conditions. - -#### Syntax - -```python -def rsi(prices: List[float], window_size: int) -> List[float]: -``` - -#### Parameters - -- **prices** (`List[float]`): A list containing the price series data. -- **window_size** (`int`): The number of periods over which to calculate the RSI. - -#### Returns - -- **List[float]**: A list containing the RSI values corresponding to the input price series. - -#### Usage Example - -```python -from finmath.TimeSeries import rsi - -prices = [44.34, 44.09, 44.15, 43.61, 44.33, 44.83, 45.10, 45.42, 45.84, 46.08] -window_size = 14 -rsi_values = rsi(prices, window_size) - -print(rsi_values) -# Output: [70.53, 66.24, 66.48, ...] -``` - ---- - -## Simple Moving Average (SMA) Functions - -### `simple_moving_average` - -#### Description - -Calculates the Simple Moving Average (SMA) of a given data series over a specified window size. SMA is the unweighted mean of the previous n data points. - -#### Syntax - -```python -def simple_moving_average(prices: List[float], window_size: int) -> List[float]: -``` - -#### Parameters - -- **prices** (`List[float]`): A list containing the price series data. -- **window_size** (`int`): The number of periods over which to calculate the SMA. - -#### Returns - -- **List[float]**: A list containing the SMA values corresponding to the input price series. - -#### Usage Example - -```python -from finmath.TimeSeries import simple_moving_average - -prices = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100] -window_size = 3 -sma = simple_moving_average(prices, window_size) - -print(sma) -# Output: [20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0] -``` - ---- diff --git a/src/cpp/TimeSeries/ema.cpp b/src/cpp/TimeSeries/ema.cpp deleted file mode 100644 index cdbbab2..0000000 --- a/src/cpp/TimeSeries/ema.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "finmath/TimeSeries/ema.h" - -std::vector compute_ema(const std::vector& prices, size_t window) -{ - std::vector ema(prices.size(), 0.0); - double multiplier = 2.0 / (window + 1); - - ema = compute_ema_with_smoothing(prices, multiplier); - return ema; -} - -// Compute EMA using a specified smoothing factor -std::vector compute_ema_with_smoothing(const std::vector& prices, double smoothing_factor) -{ - std::vector ema(prices.size(), 0.0); - ema[0] = prices[0]; // Initialize the first EMA value - - for (size_t i = 1; i < prices.size(); ++i) { - ema[i] = ((prices[i] - ema[i - 1]) * smoothing_factor) + ema[i - 1]; - } - - return ema; -} diff --git a/src/cpp/TimeSeries/rolling_std_dev.cpp b/src/cpp/TimeSeries/rolling_std_dev.cpp deleted file mode 100644 index 50cbdf9..0000000 --- a/src/cpp/TimeSeries/rolling_std_dev.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include "finmath/TimeSeries/rolling_std_dev.h" -#include -#include -#include - -std::vector rolling_std_dev(size_t window, const std::vector &prices) -{ - if (window == 0) { - throw std::invalid_argument("Window size cannot be zero."); - } - - std::vector result(prices.size(),0.0); - if(window > prices.size()) window = prices.size(); - - double mean = 0.0; - double squared_sum = 0.0; - for(size_t i = 0; i < window; i++) - { - double old_mean = mean; - mean = mean + (prices[i] - mean)/(i+1); - squared_sum = squared_sum + (prices[i] - old_mean)*(prices[i] - mean); - } - result[window - 1] = std::sqrt(squared_sum/window); - double price_out = prices[0]; - for(size_t i = window; i < prices.size() ; i++) - { - double price_in = prices[i]; - double old_mean = mean; - mean += (price_in - price_out)/window; - squared_sum += (price_in - mean) * (price_in - old_mean) - - (price_out - mean) * (price_out - old_mean); - result[i] = std::sqrt(squared_sum/window); - price_out = prices[i - window + 1]; - } - - return result; - - -} \ No newline at end of file diff --git a/src/cpp/TimeSeries/rolling_volatility.cpp b/src/cpp/TimeSeries/rolling_volatility.cpp deleted file mode 100644 index 509e9c0..0000000 --- a/src/cpp/TimeSeries/rolling_volatility.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include "finmath/TimeSeries/rolling_volatility.h" - -#include -#include -#include -#include -#include - -// Function to compute the logarithmic returns -std::vector compute_log_returns(const std::vector& prices) { - std::vector log_returns; - for (size_t i = 1; i < prices.size(); ++i) { - log_returns.push_back(std::log(prices[i] / prices[i - 1])); - } - return log_returns; -} - -// Function to compute the standard deviation of a vector -double compute_std(const std::vector& data) { - double mean = std::accumulate(data.begin(), data.end(), 0.0) / data.size(); - double sq_sum = std::inner_product(data.begin(), data.end(), data.begin(), 0.0); - return std::sqrt(sq_sum / data.size() - mean * mean); -} - -// Function to compute rolling volatility -std::vector rolling_volatility(const std::vector& prices, size_t window_size) { - std::vector volatilities; - - // Compute log returns - std::vector log_returns = compute_log_returns(prices); - - // Rolling window calculation - for (size_t i = 0; i <= log_returns.size() - window_size; ++i) { - // Get the window of log returns - std::vector window(log_returns.begin() + i, log_returns.begin() + i + window_size); - - // Compute the standard deviation - double std_dev = compute_std(window); - - // Annualize the standard deviation (multiply by sqrt(252)) - double annualized_vol = std_dev * std::sqrt(252); - - // Store the result - volatilities.push_back(annualized_vol); - } - - return volatilities; -} \ No newline at end of file diff --git a/src/cpp/TimeSeries/rsi.cpp b/src/cpp/TimeSeries/rsi.cpp deleted file mode 100644 index bebbd67..0000000 --- a/src/cpp/TimeSeries/rsi.cpp +++ /dev/null @@ -1,88 +0,0 @@ -#include "finmath/TimeSeries/rsi.h" - -#include -#include -#include - -double compute_avg_gain(const std::vector& price_changes, size_t start, size_t window_size) -{ - double total_gain = 0.0; - - for (size_t i = start; i < start + window_size; i++) - { - double price_change = price_changes[i]; - - if (price_change > 0) - { - total_gain += price_change; - } - } - return total_gain / window_size; -} - -double compute_avg_loss(const std::vector& price_changes, size_t start, size_t window_size) -{ - double total_loss = 0.0; - - for (size_t i = start; i < start + window_size; i++) - { - double price_change = price_changes[i]; - - if (price_change < 0) - { - total_loss += (-1 * price_change); - } - } - return total_loss / window_size; -} - -std::vector compute_smoothed_rsi(const std::vector& prices, size_t window_size) -{ - if (prices.size() < window_size) { - return {}; - } - - std::vector rsi_values; - std::vector price_changes; - - for(size_t i = 1; i < prices.size(); i++) - { - price_changes.push_back(prices[i] - prices[i-1]); - } - - size_t price_ch_window = window_size - 1; - - double avg_gain = compute_avg_gain(price_changes, 0, window_size); - double avg_loss = compute_avg_loss(price_changes, 0, window_size); - - double rsi = 100; - double rs; - - if (avg_loss != 0) - { - rs = avg_gain / avg_loss; - rsi = 100.0 - (100.0 / (1.0 + rs)); - } - - rsi_values.push_back(rsi); - - for(size_t i = window_size - 1; i < price_changes.size(); i++) - { - double change = price_changes[i]; - - avg_gain = (avg_gain * (window_size - 1) + (change > 0 ? change : 0)) / window_size; - avg_loss = (avg_loss * (window_size - 1) - (change < 0 ? change : 0)) / window_size; - - if (avg_loss == 0) - { - rsi_values.push_back(100.0); - continue; - } - - rs = avg_gain / avg_loss; - rsi = 100.0 - (100.0 / (1.0 + rs)); - rsi_values.push_back(rsi); - } - - return rsi_values; -} diff --git a/src/cpp/TimeSeries/simple_moving_average.cpp b/src/cpp/TimeSeries/simple_moving_average.cpp deleted file mode 100644 index aa923bd..0000000 --- a/src/cpp/TimeSeries/simple_moving_average.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include "finmath/TimeSeries/simple_moving_average.h" - -#include -#include -#include -#include -#include - -std::vector simple_moving_average(const std::vector& data, size_t window_size) { - std::vector averages; - - // Check for valid window size - if (window_size == 0) { - std::cerr << "Window size must be greater than 0." << std::endl; - return averages; - } - - if (data.size() < window_size) { - std::cerr << "Data size is smaller than the window size." << std::endl; - return averages; - } - - // Compute moving averages using a sliding window - for (size_t i = 0; i <= data.size() - window_size; ++i) { - // Calculate the sum of the current window - double sum = std::accumulate(data.begin() + i, data.begin() + i + window_size, 0.0); - - // Compute the average and store it - double avg = sum / static_cast(window_size); - averages.push_back(avg); - } - - return averages; -} diff --git a/src/python_bindings.cpp b/src/python_bindings.cpp deleted file mode 100644 index 0f4030d..0000000 --- a/src/python_bindings.cpp +++ /dev/null @@ -1,90 +0,0 @@ -#include -#include // Automatic conversion between Python lists and std::vector - -#include "finmath/InterestAndAnnuities/compound_interest.h" -#include "finmath/OptionPricing/black_scholes.h" -#include "finmath/OptionPricing/binomial_tree.h" -#include "finmath/TimeSeries/rolling_volatility.h" -#include "finmath/TimeSeries/simple_moving_average.h" -#include "finmath/TimeSeries/rsi.h" -#include "finmath/TimeSeries/ema.h" -#include "finmath/GraphAlgos/bellman_arbitrage.h" - -namespace py = pybind11; - -PYBIND11_MODULE(finmath, m) { - m.doc() = "Financial Math Library"; - - // Expose the OptionType enum class - py::enum_(m, "OptionType") - .value("CALL", OptionType::CALL) - .value("PUT", OptionType::PUT) - .export_values(); - - // Bind compound interest function - m.def("compound_interest", &compound_interest, "Calculate compound interest", - py::arg("principal"), py::arg("rate"), py::arg("time"), py::arg("frequency")); - - // Bind Black-Scholes function - m.def("black_scholes", &black_scholes, "Black Scholes Option Pricing", - py::arg("type"), py::arg("strike"), py::arg("price"), py::arg("time"), py::arg("rate"), py::arg("volatility")); - - // Bind binomial option pricing function - m.def("binomial_option_pricing", &binomial_option_pricing, "Binomial Option Pricing", - py::arg("type"), py::arg("S0"), py::arg("K"), py::arg("T"), py::arg("r"), py::arg("sigma"), py::arg("N")); - - // Bind binomial greeks - m.def("binom_delta", &Binom::compute_delta, "Calculate the Delta of a Binomial Option", - py::arg("type"), py::arg("S0"), py::arg("K"), py::arg("T"), py::arg("r"), py::arg("sigma"), py::arg("N"), py::arg("delta_S") = -1); - - m.def("binom_gamma", &Binom::compute_gamma, "Calculate the Gamma of a Binomial Option", - py::arg("type"), py::arg("S0"), py::arg("K"), py::arg("T"), py::arg("r"), py::arg("sigma"), py::arg("N"), py::arg("delta_S") = -1); - - m.def("binom_vega", &Binom::compute_vega, "Calculate the Vega of a Binomial Option", - py::arg("type"), py::arg("S0"), py::arg("K"), py::arg("T"), py::arg("r"), py::arg("sigma"), py::arg("N"), py::arg("delta_sig") = -1); - - m.def("binom_theta", &Binom::compute_theta, "Calculate the Theta of a Binomial Option", - py::arg("type"), py::arg("S0"), py::arg("K"), py::arg("T"), py::arg("r"), py::arg("sigma"), py::arg("N"), py::arg("delta_T") = -1); - - m.def("binom_rho", &Binom::compute_rho, "Calculate the Rho of a Binomial Option", - py::arg("type"), py::arg("S0"), py::arg("K"), py::arg("T"), py::arg("r"), py::arg("sigma"), py::arg("N"), py::arg("delta_r") = -1); - - - // Bind black scholes greeks - m.def("black_scholes_delta", &BlackScholes::compute_delta, "Calculate the Delta of a Black Scholes Option", - py::arg("type"), py::arg("S0"), py::arg("K"), py::arg("t"), py::arg("r"), py::arg("q"), py::arg("sigma")); - - m.def("black_scholes_gamma", &BlackScholes::compute_gamma, "Calculate the Gamma of a Black Scholes Option", - py::arg("S0"), py::arg("K"), py::arg("t"), py::arg("r"), py::arg("q"), py::arg("sigma")); - - m.def("black_scholes_vega", &BlackScholes::compute_vega, "Calculate the Vega of a Black Scholes Option", - py::arg("S0"), py::arg("K"), py::arg("t"), py::arg("r"), py::arg("q"), py::arg("sigma")); - - m.def("black_scholes_theta", &BlackScholes::compute_theta, "Calculate the Theta of a Black Scholes Option", - py::arg("type"), py::arg("S0"), py::arg("K"), py::arg("t"), py::arg("T"), py::arg("r"), py::arg("q"), py::arg("sigma")); - - m.def("black_scholes_rho", &BlackScholes::compute_rho, "Calculate the Rho of a Black Scholes Option", - py::arg("type"), py::arg("S0"), py::arg("K"), py::arg("t"), py::arg("r"), py::arg("q"), py::arg("sigma")); - - // Bind rolling volatility - m.def("rolling_volatility", &rolling_volatility, "Rolling Volatility", - py::arg("prices"), py::arg("window_size")); - - m.def("simple_moving_average", &simple_moving_average, "Simple Moving Average", - py::arg("prices"), py::arg("window_size")); - - m.def("smoothed_rsi", &compute_smoothed_rsi, "Relative Strength Index(RSI)", -// m.def("rsi", &compute_rsi, "Relative Strength Index", - py::arg("prices"), py::arg("window_size")); - - m.def("ema_window", &compute_ema, "Exponential Moving Average - Window", - py::arg("prices"), py::arg("window_size")); - - m.def("ema_smoothing", &compute_ema_with_smoothing, "Exponential Moving Average - Smoothing Factor", - py::arg("prices"), py::arg("smoothing_factor")); - - m.def("detect_arbitrage", &detectArbitrageBellman, - "Detect arbitrage opportunities in a currency graph", - py::arg("graph")); - -} diff --git a/test/GraphAlgos/bellman_arbitrage_test.cpp b/test/GraphAlgos/bellman_arbitrage_test.cpp deleted file mode 100644 index cf32c96..0000000 --- a/test/GraphAlgos/bellman_arbitrage_test.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include -#include -#include "finmath/GraphAlgos/bellman_arbitrage.h" - -static bool contains(const std::vector& v, const std::string& x) { - return std::find(v.begin(), v.end(), x) != v.end(); -} - -int bellman_arbitrage_tests() { - - { - AdjList adjList = { - {"USD", {{"EUR", 0.9}}}, - {"EUR", {{"USD", 1.2}}} - }; - auto cycle = detectArbitrageBellman(adjList); - std::vector expected = {"USD", "EUR", "USD"}; - - assert(cycle.size() == expected.size()); - for (const auto& n : expected) { - assert(contains(cycle, n)); - } - } - - { - AdjList adjList = { - {"A", {{"B", 1.1}, {"D", 0.5}}}, - {"B", {{"C", 1.05}, {"A", 0.7}}}, - {"C", {{"A", 0.9}, {"E", 0.3}}}, - {"D", {{"C", 1.0}}}, - {"E", {{"B", 0.2}}} - }; - - auto cycle = detectArbitrageBellman(adjList); - std::vector expected = {"A", "B", "C", "A"}; - - assert(cycle.size() == expected.size()); - for (const auto& n : expected) { - assert(contains(cycle, n)); - } - } - - { - AdjList adjList = { - {"USD", {{"EUR", 0.9}}}, - {"EUR", {{"JPY", 130}}}, - {"JPY", {{"USD", 0.006}}} - }; - - assert(detectArbitrageBellman(adjList).empty()); - } - - { - AdjList adjList = { - {"A", {{"B", -1.0}, {"C", 2.0}}}, - {"C", {{"A", 0.4}}} - }; - - assert(detectArbitrageBellman(adjList).empty()); - } - - return 0; -} - -int main() { - return bellman_arbitrage_tests(); -} diff --git a/test/InterestAndAnnuities/compound_interest_test.cpp b/test/InterestAndAnnuities/compound_interest_test.cpp deleted file mode 100644 index 4039c90..0000000 --- a/test/InterestAndAnnuities/compound_interest_test.cpp +++ /dev/null @@ -1,136 +0,0 @@ -#include -#include -#include -#include "finmath/finmath.h" - -// Helper Function -bool almost_equal(double a, double b, double tolerance) -{ - return std::abs(a - b) <= tolerance * std::max(std::abs(a), std::abs(b)); -} - -int compound_interest_tests() -{ - double expected = 0.0; - double tolerance = 0.001; - - // Test 1: Basic test with yearly compounding - { - double result = compound_interest(1000, 5, 10, 1); - expected = 1628.89; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 2: Different rate - { - double result = compound_interest(1000, 10, 10, 1); - expected = 2593.74; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 3: Different time period - { - double result = compound_interest(1000, 5, 5, 1); - expected = 1276.28; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 4: Different compounding frequency (quarterly) - { - double result = compound_interest(1000, 5, 10, 4); - expected = 1643.62; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 5: Different compounding frequency (monthly) - { - double result = compound_interest(1000, 5, 10, 12); - expected = 1647.01; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 6: Different compounding frequency (daily) - { - double result = compound_interest(1000, 5, 10, 365); - expected = 1648.66; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 7: Zero principal - { - double result = compound_interest(0, 5, 10, 1); - expected = 0.0; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 8: Zero rate - { - double result = compound_interest(1000, 0, 10, 1); - expected = 1000.0; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 9: Zero time - { - double result = compound_interest(1000, 5, 0, 1); - expected = 1000.0; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 10: Zero frequency - { - double result = compound_interest(1000, 5, 10, 0); - expected = 1000.0; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 11: Negative principal (should handle or reject) - { - double result = compound_interest(-1000, 5, 10, 1); - expected = -1628.89; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 12: Negative rate (deflation) - { - double result = compound_interest(1000, -5, 10, 1); - expected = 598.74; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 13: Negative time (should reject) - { - double result = compound_interest(1000, 5, -10, 1); - expected = 0.0; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 14: Large principal - { - double result = compound_interest(1e6, 5, 10, 1); - expected = 1628890.0; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 15: Large rate - { - double result = compound_interest(1000, 100, 1, 1); - expected = 2000.0; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 16: Large time - { - double result = compound_interest(1000, 5, 100, 1); - expected = 131501.26; - assert(almost_equal(result, expected, tolerance)); - } - - std::cout << "Compound Interest Tests Passed!" << std::endl; - return 0; -} - -int main() -{ - return compound_interest_tests(); -} diff --git a/test/MarkovChains/C++/markov_chain_test.cpp b/test/MarkovChains/C++/markov_chain_test.cpp new file mode 100644 index 0000000..5455fd2 --- /dev/null +++ b/test/MarkovChains/C++/markov_chain_test.cpp @@ -0,0 +1,21 @@ +#include "finmath/MarkovChains/markov_chain.h" +#include +#include +#include + +// TODO: Implement test cases for Markov Chain functionality + +int main() { + std::cout << "Markov Chain tests - TODO: Implement" << std::endl; + + // Example test structure: + // - Test transition matrix creation + // - Test steady state calculations + // - Test matrix operations + // - Test first passage times + // - Test absorbing states + + std::cout << "All Markov Chain tests passed (placeholder)." << std::endl; + return 0; +} + diff --git a/test/OptionPricing/binomial_option_pricing_test.cpp b/test/OptionPricing/binomial_option_pricing_test.cpp deleted file mode 100644 index 2d98089..0000000 --- a/test/OptionPricing/binomial_option_pricing_test.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include -#include -#include "finmath/OptionPricing/options_pricing.h" - -// Helper Function -bool almost_equal(double a, double b, double tolerance) -{ - return std::abs(a - b) <= tolerance * std::max(std::abs(a), std::abs(b)); -} - -int binomial_option_pricing_tests() -{ - double tolerance = 0.001; - - std::cout << "Binomial-Tree Tests Passed!" << std::endl; - return 0; -} - -int main() -{ - return binomial_option_pricing_tests(); -} diff --git a/test/OptionPricing/black_scholes_test.cpp b/test/OptionPricing/black_scholes_test.cpp deleted file mode 100644 index 423ef5c..0000000 --- a/test/OptionPricing/black_scholes_test.cpp +++ /dev/null @@ -1,94 +0,0 @@ -#include -#include -#include -#include "finmath/OptionPricing/black_scholes.h" - -// Helper Function -bool almost_equal(double a, double b, double tolerance) -{ - return std::abs(a - b) <= tolerance * std::max(std::abs(a), std::abs(b)); -} - -int black_scholes_tests() -{ - double expected = 0.0; - double tolerance = 0.001; - - // Test 1: Call option, basic parameters - { - double result = black_scholes(OptionType::CALL, 100, 105, 1, 0.05, 0.2); - expected = 13.8579; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 2: Put option, basic parameters - { - double result = black_scholes(OptionType::PUT, 100, 95, 1, 0.05, 0.2); - expected = 7.6338; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 3: At-the-money call option - { - double result = black_scholes(OptionType::CALL, 100, 100, 1, 0.05, 0.2); - expected = 10.4506; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 4: At-the-money put option - { - double result = black_scholes(OptionType::PUT, 100, 100, 1, 0.05, 0.2); - expected = 5.5735; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 5: Long time to maturity - { - double result = black_scholes(OptionType::CALL, 100, 100, 10, 0.05, 0.2); - expected = 45.1930; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 6: High volatility - { - double result = black_scholes(OptionType::CALL, 100, 100, 1, 0.05, 1.0); - expected = 39.8402; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 7: Near zero volatility - { - double result = black_scholes(OptionType::CALL, 100, 100, 1, 0.05, 0.01); - expected = 4.8771; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 8: Near zero interest rate - { - double result = black_scholes(OptionType::CALL, 100, 100, 1, 0.01, 0.2); - expected = 8.4333; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 9: Deep in-the-money call option - { - double result = black_scholes(OptionType::CALL, 50, 100, 1, 0.05, 0.2); - expected = 52.4389; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 10: Deep out-of-the-money call option - { - double result = black_scholes(OptionType::CALL, 150, 100, 1, 0.05, 0.2); - expected = 0.3596; - assert(almost_equal(result, expected, tolerance)); - } - - std::cout << "Black-Scholes Tests Passed!" << std::endl; - return 0; -} - -int main() -{ - return black_scholes_tests(); -} diff --git a/test/TimeSeries/rolling_std_dev_test.cpp b/test/TimeSeries/rolling_std_dev_test.cpp deleted file mode 100644 index 62ce4d7..0000000 --- a/test/TimeSeries/rolling_std_dev_test.cpp +++ /dev/null @@ -1,100 +0,0 @@ -#include -#include -#include -#include "finmath/TimeSeries/rolling_std_dev.h" - -// Helper Function -bool almost_equal(double a, double b, double tolerance) -{ - return std::abs(a - b) <= tolerance * std::max(std::abs(a), std::abs(b)); -} - -int rolling_std_dev_tests() -{ - double expected = 0.0; - double tolerance = 0.001; - - //Test 1: Test Basic Standard Deviation Calculation(no rolling calculation) - { - std::vector prices = {12.3,15.4,12.7,17.8,12.8}; - std::vector std_val_values = rolling_std_dev(prices.size(),prices); - expected = 2.108; - assert(almost_equal(std_val_values.back(), expected, tolerance)); - - } - - //Test 2: Test Basic Window Size to minizize computation - { - std::vector prices = {1,2,3,4,5,6}; - std::vector std_val_values = rolling_std_dev(2,prices); - expected = 0.5000; - assert(almost_equal(std_val_values.back(), expected, tolerance)); - } - - //Test 3: Test Singular Window Size(should be all zeros) - { - std::vector prices = {3.3,4.4,5.5,6.6,7.7,8.8,9.9,10.10,2.2}; - std::vector std_val_values = rolling_std_dev(1,prices); - expected = 0.000; - assert(almost_equal(std_val_values.back(), expected, tolerance)); - } - - // Test 4: Test Window Size Larger than Array (Should return single value std dev) - { - std::vector prices = {5, 10, 15}; - std::vector std_val_values = rolling_std_dev(5, prices); - expected = 4.082; // Since entire array is used - assert(almost_equal(std_val_values.back(), expected, tolerance)); - } - - // Test 6: Test Window Size of 3 (Sliding effect) - { - std::vector prices = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; - std::vector std_val_values = rolling_std_dev(3, prices); - expected = 0.816; // For last three numbers (8,9,10) - assert(almost_equal(std_val_values.back(), expected, tolerance)); - } - - // Test 7: Test All Elements Same (Should be zero) - { - std::vector prices = {4, 4, 4, 4, 4, 4, 4, 4, 4, 4}; - std::vector std_val_values = rolling_std_dev(3, prices); - expected = 0.000; - assert(almost_equal(std_val_values.back(), expected, tolerance)); - } - - // Test 8: Test Decreasing Series - { - std::vector prices = {100, 90, 80, 70, 60, 50, 40, 30, 20, 10}; - std::vector std_val_values = rolling_std_dev(4, prices); - expected = 11.180; // Precomputed expected value - assert(almost_equal(std_val_values.back(), expected, tolerance)); - } - - // Test 9: Test Small Values (Close to Zero) - { - std::vector prices = {0.001, 0.002, 0.003, 0.004, 0.005}; - std::vector std_val_values = rolling_std_dev(3, prices); - double mean = (0.003 + 0.004 + 0.005) / 3.0; - double variance = ((0.003 - mean) * (0.003 - mean) + - (0.004 - mean) * (0.004 - mean) + - (0.005 - mean) * (0.005 - mean)) / 3.0; - expected = std::sqrt(variance); - assert(almost_equal(std_val_values.back(), expected, tolerance)); - } - - // Test 10: Test Large Numbers - { - std::vector prices = {1000000, 1000001, 1000002, 1000003, 1000004}; - std::vector std_val_values = rolling_std_dev(3, prices); - expected = 0.816; - assert(almost_equal(std_val_values.back(), expected, tolerance)); - } - std::cout << "Rolling Std. Deviation Tests Pass!" << std::endl; - return 0; -} - -int main() -{ - return rolling_std_dev_tests(); -} diff --git a/test/TimeSeries/rsi_test.cpp b/test/TimeSeries/rsi_test.cpp deleted file mode 100644 index 8e09b9d..0000000 --- a/test/TimeSeries/rsi_test.cpp +++ /dev/null @@ -1,88 +0,0 @@ -#include -#include -#include -#include -#include "finmath/TimeSeries/rsi.h" - -// Helper Function -bool almost_equal(double a, double b, double tolerance) -{ - return std::abs(a - b) <= tolerance * std::max(std::abs(a), std::abs(b)); -} - -int rsi_tests() -{ - double expected = 0.0; - double tolerance = 0.001; - - // Test 1: Basic test with a sample price list - { - std::vector prices = {44.34, 44.09, 44.15, 43.61, 44.33, 44.83, 45.10, 45.42, 45.84, 46.08, 45.89, 46.03, 45.61, 46.28, 46.28}; - std::vector rsi_values = compute_smoothed_rsi(prices, 14); - expected = 70.53; - assert(almost_equal(rsi_values.back(), expected, tolerance)); - } - - // Test 2: Zero price change (RSI should be 50 after the first window size is reached) - { - std::vector prices = {50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50}; - std::vector rsi_values = compute_smoothed_rsi(prices, 14); - expected = 50.0; - assert(almost_equal(rsi_values.back(), expected, tolerance)); - } - - // Test 3: Increasing prices (RSI should approach 100) - { - std::vector prices = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; - std::vector rsi_values = compute_smoothed_rsi(prices, 14); - expected = 100.0; - assert(almost_equal(rsi_values.back(), expected, tolerance)); - } - - // Test 4: Decreasing prices (RSI should approach 0) - { - std::vector prices = {15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; - std::vector rsi_values = compute_smoothed_rsi(prices, 14); - expected = 0.0; - assert(almost_equal(rsi_values.back(), expected, tolerance)); - } - - // Test 5: Shorter period RSI calculation - { - std::vector prices = {44.34, 44.09, 44.15, 43.61, 44.33, 44.83, 45.10, 45.42, 45.84, 46.08, 45.89, 46.03, 45.61, 46.28, 46.28}; - std::vector rsi_values = compute_smoothed_rsi(prices, 7); - expected = 66.23; - assert(almost_equal(rsi_values.back(), expected, tolerance)); - } - - // Test 6: Constant rise then drop (RSI should adjust accordingly) - { - std::vector prices = {1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2}; - std::vector rsi_values = compute_smoothed_rsi(prices, 14); - expected = 50.0; - assert(almost_equal(rsi_values.back(), expected, tolerance)); - } - - // Test 7: Short price list (should handle or reject properly) - { - std::vector prices = {100, 102}; - std::vector rsi_values = compute_smoothed_rsi(prices, 14); - assert(rsi_values.empty()); - } - - // Test 8: Large price movements (RSI should handle well) - { - std::vector prices = {1, 1000, 1001, 500, 2000, 3000, 1500, 3500, 3000, 2500, 2000}; - std::vector rsi_values = compute_smoothed_rsi(prices, 14); - expected = 80.0; - assert(almost_equal(rsi_values.back(), expected, tolerance)); - } - - std::cout << "RSI Tests Passed!" << std::endl; - return 0; -} - -int main() -{ - return rsi_tests(); -} diff --git a/test/test_finmath.cpp b/test/test_finmath.cpp deleted file mode 100644 index a9016f4..0000000 --- a/test/test_finmath.cpp +++ /dev/null @@ -1,391 +0,0 @@ -#include -#include -#include -#include -#include "finmath/finmath.h" -#include "finmath/OptionPricing/black_scholes.h" - -int compound_interest_tests(); -int black_scholes_tests(); -int rsi_tests(); -int rolling_std_dev_tests(); - -int main() { - std::cout << "Starting Unit Tests\n"; - compound_interest_tests(); - black_scholes_tests(); - rsi_tests(); - rolling_std_dev_tests(); - return 0; -} -// Helper Function - -bool almost_equal(double a, double b, double tolerance) { - return std::abs(a - b) <= tolerance * std::max(std::abs(a), std::abs(b)); -} - -// Unit Tests - -int compound_interest_tests() { - double expected = 0.0; - double tolerance = 0.001; - - // Test 1: Basic test with yearly compounding - { - double result = compound_interest(1000, 5, 10, 1); - expected = 1628.89; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 2: Different rate - { - double result = compound_interest(1000, 10, 10, 1); - expected = 2593.74; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 3: Different time period - { - double result = compound_interest(1000, 5, 5, 1); - expected = 1276.28; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 4: Different compounding frequency (quarterly) - { - double result = compound_interest(1000, 5, 10, 4); - expected = 1643.62; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 5: Different compounding frequency (monthly) - { - double result = compound_interest(1000, 5, 10, 12); - expected = 1647.01; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 6: Different compounding frequency (daily) - { - double result = compound_interest(1000, 5, 10, 365); - expected = 1648.66; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 7: Zero principal - { - double result = compound_interest(0, 5, 10, 1); - expected = 0.0; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 8: Zero rate - { - double result = compound_interest(1000, 0, 10, 1); - expected = 1000.0; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 9: Zero time - { - double result = compound_interest(1000, 5, 0, 1); - expected = 1000.0; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 10: Zero frequency - { - double result = compound_interest(1000, 5, 10, 0); - expected = 1000.0; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 11: Negative principal (should handle or reject) - { - double result = compound_interest(-1000, 5, 10, 1); - expected = -1628.89; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 12: Negative rate (deflation) - { - double result = compound_interest(1000, -5, 10, 1); - expected = 598.74; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 13: Negative time (should reject) - { - double result = compound_interest(1000, 5, -10, 1); - expected = 0.0; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 14: Large principal - { - double result = compound_interest(1e6, 5, 10, 1); - expected = 1628890.0; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 15: Large rate - { - double result = compound_interest(1000, 100, 1, 1); - expected = 2000.0; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 16: Large time - { - double result = compound_interest(1000, 5, 100, 1); - expected = 131501.26; - assert(almost_equal(result, expected, tolerance)); - } - - std::cout << "Compound Interest Tests Passed!" << std::endl; - return 0; -} - -int black_scholes_tests() { - double expected = 0.0; - double tolerance = 0.001; - - - // Test 1: Call option, basic parameters - { - double result = black_scholes(OptionType::CALL, 100, 105, 1, 0.05, 0.2); - expected = 13.8579; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 2: Put option, basic parameters - { - double result = black_scholes(OptionType::PUT, 100, 95, 1, 0.05, 0.2); - expected = 7.6338; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 3: At-the-money call option - { - double result = black_scholes(OptionType::CALL, 100, 100, 1, 0.05, 0.2); - expected = 10.4506; - assert(almost_equal(result, expected, tolerance)); - } - - // Test 4: At-the-money put option - { - double result = black_scholes(OptionType::PUT, 100, 100, 1, 0.05, 0.2); - expected = 5.5735; - assert(almost_equal(result, expected, tolerance)); - } - - - // Test 5: Long time to maturity - { - double result = black_scholes(OptionType::CALL, 100, 100, 10, 0.05, 0.2); - expected = 45.1930; // Placeholder value, should be replaced with correct expected value - assert(almost_equal(result, expected, tolerance)); - } - - // Test 6: High volatility - { - double result = black_scholes(OptionType::CALL, 100, 100, 1, 0.05, 1.0); - expected = 39.8402; // Placeholder value, should be replaced with correct expected value - assert(almost_equal(result, expected, tolerance)); - } - - // Test 7: Near zero volatility - { - double result = black_scholes(OptionType::CALL, 100, 100, 1, 0.05, 0.01); - expected = 4.8771; // Placeholder value, should be replaced with correct expected value - assert(almost_equal(result, expected, tolerance)); - } - - // Test 8: Near zero interest rate - { - double result = black_scholes(OptionType::CALL, 100, 100, 1, 0.01, 0.2); - expected = 8.4333; // Placeholder value, should be replaced with correct expected value - assert(almost_equal(result, expected, tolerance)); - } - - // Test 9: Deep in-the-money call option - { - double result = black_scholes(OptionType::CALL, 50, 100, 1, 0.05, 0.2); - expected = 52.4389; // Placeholder value, should be replaced with correct expected value - assert(almost_equal(result, expected, tolerance)); - } - - // Test 10: Deep out-of-the-money call option - { - double result = black_scholes(OptionType::CALL, 150, 100, 1, 0.05, 0.2); - expected = 0.3596; // Placeholder value, should be replaced with correct expected value - assert(almost_equal(result, expected, tolerance)); - } - - std::cout << "Black-Scholes Tests Passed!" << std::endl; - return 0; -} - -int binomial_option_pricing_tests() { - double tolerance = 0.001; - - - std::cout << "Binomial-Tree Tests Passed!" << std::endl; - return 0; -} - -int rsi_tests() { - double expected = 0.0; - double tolerance = 0.001; - - // Test 1: Basic test with a sample price list - { - std::vector prices = {44.34, 44.09, 44.15, 43.61, 44.33, 44.83, 45.10, 45.42, 45.84, 46.08, 45.89, 46.03, 45.61, 46.28, 46.28}; - std::vector rsi_values = compute_smoothed_rsi(prices, 14); - expected = 70.53; - assert(almost_equal(rsi_values.back(), expected, tolerance)); - } - - // Test 2: Zero price change (RSI should be 50 after the first window size is reached) - { - std::vector prices = {50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50}; - std::vector rsi_values = compute_smoothed_rsi(prices, 14); - expected = 50.0; - assert(almost_equal(rsi_values.back(), expected, tolerance)); - } - - // Test 3: Increasing prices (RSI should approach 100) - { - std::vector prices = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; - std::vector rsi_values = compute_smoothed_rsi(prices, 14); - expected = 100.0; - assert(almost_equal(rsi_values.back(), expected, tolerance)); - } - - // Test 4: Decreasing prices (RSI should approach 0) - { - std::vector prices = {15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; - std::vector rsi_values = compute_smoothed_rsi(prices, 14); - expected = 0.0; - assert(almost_equal(rsi_values.back(), expected, tolerance)); - } - - // Test 5: Shorter period RSI calculation - { - std::vector prices = {44.34, 44.09, 44.15, 43.61, 44.33, 44.83, 45.10, 45.42, 45.84, 46.08, 45.89, 46.03, 45.61, 46.28, 46.28}; - std::vector rsi_values = compute_smoothed_rsi(prices, 7); - expected = 66.23; // Adjust based on the expected shorter period RSI - assert(almost_equal(rsi_values.back(), expected, tolerance)); - } - - // Test 6: Constant rise then drop (RSI should adjust accordingly) - { - std::vector prices = {1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2}; - std::vector rsi_values = compute_smoothed_rsi(prices, 14); - expected = 50.0; // Expected RSI midpoint due to equal gains and losses - assert(almost_equal(rsi_values.back(), expected, tolerance)); - } - - // Test 7: Short price list (should handle or reject properly) - { - std::vector prices = {100, 102}; - std::vector rsi_values = compute_smoothed_rsi(prices, 14); - assert(rsi_values.empty()); // Not enough data to calculate RSI, list should be empty - } - - // Test 8: Large price movements (RSI should handle well) - { - std::vector prices = {1, 1000, 1001, 500, 2000, 3000, 1500, 3500, 3000, 2500, 2000}; - std::vector rsi_values = compute_smoothed_rsi(prices, 14); - expected = 80.0; // Estimate RSI based on large price movements - assert(almost_equal(rsi_values.back(), expected, tolerance)); - } - - std::cout << "RSI Tests Passed!" << std::endl; - return 0; -} - -int rolling_std_dev_tests() -{ - double expected = 0.0; - double tolerance = 0.001; - - //Test 1: Test Basic Standard Deviation Calculation(no rolling calculation) - { - std::vector prices = {12.3,15.4,12.7,17.8,12.8}; - std::vector std_val_values = rolling_std_dev(prices.size(),prices); - expected = 2.108; - assert(almost_equal(std_val_values.back(), expected, tolerance)); - - } - - //Test 2: Test Basic Window Size to minizize computation - { - std::vector prices = {1,2,3,4,5,6}; - std::vector std_val_values = rolling_std_dev(2,prices); - expected = 0.5000; - assert(almost_equal(std_val_values.back(), expected, tolerance)); - } - - //Test 3: Test Singular Window Size(should be all zeros) - { - std::vector prices = {3.3,4.4,5.5,6.6,7.7,8.8,9.9,10.10,2.2}; - std::vector std_val_values = rolling_std_dev(1,prices); - expected = 0.000; - assert(almost_equal(std_val_values.back(), expected, tolerance)); - } - - // Test 4: Test Window Size Larger than Array (Should return single value std dev) - { - std::vector prices = {5, 10, 15}; - std::vector std_val_values = rolling_std_dev(5, prices); - expected = 4.082; // Since entire array is used - assert(almost_equal(std_val_values.back(), expected, tolerance)); - } - - // Test 6: Test Window Size of 3 (Sliding effect) - { - std::vector prices = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; - std::vector std_val_values = rolling_std_dev(3, prices); - expected = 0.816; // For last three numbers (8,9,10) - assert(almost_equal(std_val_values.back(), expected, tolerance)); - } - - // Test 7: Test All Elements Same (Should be zero) - { - std::vector prices = {4, 4, 4, 4, 4, 4, 4, 4, 4, 4}; - std::vector std_val_values = rolling_std_dev(3, prices); - expected = 0.000; - assert(almost_equal(std_val_values.back(), expected, tolerance)); - } - - // Test 8: Test Decreasing Series - { - std::vector prices = {100, 90, 80, 70, 60, 50, 40, 30, 20, 10}; - std::vector std_val_values = rolling_std_dev(4, prices); - expected = 11.180; // Precomputed expected value - assert(almost_equal(std_val_values.back(), expected, tolerance)); - } - - // Test 9: Test Small Values (Close to Zero) - { - std::vector prices = {0.001, 0.002, 0.003, 0.004, 0.005}; - std::vector std_val_values = rolling_std_dev(3, prices); - double mean = (0.003 + 0.004 + 0.005) / 3.0; - double variance = ((0.003 - mean) * (0.003 - mean) + - (0.004 - mean) * (0.004 - mean) + - (0.005 - mean) * (0.005 - mean)) / 3.0; - expected = std::sqrt(variance); - assert(almost_equal(std_val_values.back(), expected, tolerance)); - } - - // Test 10: Test Large Numbers - { - std::vector prices = {1000000, 1000001, 1000002, 1000003, 1000004}; - std::vector std_val_values = rolling_std_dev(3, prices); - expected = 0.816; - assert(almost_equal(std_val_values.back(), expected, tolerance)); - } - std::cout << "Rolling Std. Deviation Tests Pass!" << std::endl; - return 0; -} \ No newline at end of file diff --git a/test/test_runner.cpp b/test/test_runner.cpp deleted file mode 100644 index 3b48097..0000000 --- a/test/test_runner.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include -#include -#include -#include - -// This file serves as a coordinator to run all individual test executables -int main() -{ - std::cout << "Running all tests...\n"; - - std::vector testExecutables = { - "./compound_interest_test", - "./black_scholes_test", - "./binomial_option_pricing_test", - "./rsi_test", - "./bellman_arbitrage_test"}; - - int failedTests = 0; - - for (const auto &testExe : testExecutables) - { - std::cout << "Running " << testExe << "...\n"; - int result = std::system(testExe.c_str()); - if (result != 0) - { - std::cout << "Test failed: " << testExe << std::endl; - failedTests++; - } - } - - if (failedTests == 0) - { - std::cout << "All tests passed successfully!\n"; - return 0; - } - else - { - std::cout << failedTests << " test(s) failed.\n"; - return 1; - } -}