├── OREAnalytics-SWIG
├── Python
│ ├── Examples
│ │ ├── Notebooks
│ │ │ ├── Example_1
│ │ │ │ ├── Input
│ │ │ │ │ ├── notes
│ │ │ │ │ ├── fixings.txt
│ │ │ │ │ ├── pricingengine.xml
│ │ │ │ │ ├── ore.xml
│ │ │ │ │ ├── portfolio.xml
│ │ │ │ │ ├── market.txt
│ │ │ │ │ └── todaysmarket.xml
│ │ │ │ └── ore.py
│ │ │ ├── Example_6
│ │ │ │ ├── Input
│ │ │ │ │ ├── notes
│ │ │ │ │ ├── fixings.txt
│ │ │ │ │ ├── pricingengine.xml
│ │ │ │ │ ├── ore.xml
│ │ │ │ │ ├── portfolio.xml
│ │ │ │ │ ├── market.txt
│ │ │ │ │ └── todaysmarket.xml
│ │ │ │ ├── run.py
│ │ │ │ └── ore.py
│ │ │ ├── Example_8
│ │ │ │ ├── riskclass.JPG
│ │ │ │ ├── risktype.JPG
│ │ │ │ └── log_structured.json
│ │ │ ├── Example_7
│ │ │ │ ├── Readme.txt
│ │ │ │ ├── Input
│ │ │ │ │ ├── market.txt
│ │ │ │ │ ├── pricingengine.xml
│ │ │ │ │ ├── ore_SIMM2.4_1D.xml
│ │ │ │ │ ├── ore_SIMM2.6_1D.xml
│ │ │ │ │ ├── ore_SIMM2.4_10D.xml
│ │ │ │ │ ├── ore_SIMM2.6_10D.xml
│ │ │ │ │ ├── todaysmarket.xml
│ │ │ │ │ └── crif.csv
│ │ │ │ ├── run.py
│ │ │ │ └── ore.py
│ │ │ ├── Example_4
│ │ │ │ ├── Input
│ │ │ │ │ ├── inputeigenvectors.csv
│ │ │ │ │ ├── portfolio.xml
│ │ │ │ │ ├── simulation.xml
│ │ │ │ │ └── netting.xml
│ │ │ │ └── pca.py
│ │ │ ├── Example_5
│ │ │ │ ├── ore.py
│ │ │ │ └── Input
│ │ │ │ │ ├── pricingengine.xml
│ │ │ │ │ ├── netting.xml
│ │ │ │ │ └── todaysmarket.xml
│ │ │ ├── Example_3
│ │ │ │ ├── ore_amc.py
│ │ │ │ ├── ore_classic.py
│ │ │ │ ├── Input
│ │ │ │ │ ├── netting.xml
│ │ │ │ │ ├── bak
│ │ │ │ │ │ ├── netting.xml
│ │ │ │ │ │ └── portfolio.xml
│ │ │ │ │ ├── todaysmarket.xml
│ │ │ │ │ ├── ore_amc.xml
│ │ │ │ │ ├── ore_bermudans.xml
│ │ │ │ │ ├── ore_classic.xml
│ │ │ │ │ ├── ore_swaps.xml
│ │ │ │ │ └── portfolio.xml
│ │ │ │ └── progress.ipynb
│ │ │ └── Example_2
│ │ │ │ ├── ore.py
│ │ │ │ └── Input
│ │ │ │ ├── netting_mpor.xml
│ │ │ │ ├── netting.xml
│ │ │ │ ├── netting_mta.xml
│ │ │ │ ├── netting_dim.xml
│ │ │ │ ├── netting_threshold.xml
│ │ │ │ └── ore_external_im.xml
│ │ ├── Input
│ │ │ ├── caladj.xml
│ │ │ ├── ore_market.xml
│ │ │ ├── portfolio_swap.xml
│ │ │ └── netting.xml
│ │ ├── runExamples.sh
│ │ ├── testAllNotebooks.sh
│ │ ├── log.py
│ │ ├── dates.py
│ │ ├── market.py
│ │ ├── portfolio.py
│ │ └── commodityforward.py
│ ├── test
│ │ ├── testrunner.py
│ │ ├── OREAnalyticsTestSuite.py
│ │ └── test_marketdatum.py
│ └── ORE
│ │ └── __init__.py
├── Java
│ ├── Manifest.txt
│ └── Examples
│ │ └── ORERunner.java
├── LICENSE.TXT
├── oreanalytics-config
└── SWIG
│ ├── orea.i
│ └── oreanalytics.i
├── .gitmodules
├── CMakeLists.txt
├── runCmake.sh
├── Docker
├── docker-compose-oreswig.yml
├── docker-compose-oreswig-app.yml
├── DockerfileRunORE.sh
├── Dockerfile-ORESWIG
└── Dockerfile-ORESWIG-App
├── runPythonTests.cmd
├── Wheels
├── README.md
├── oreanalytics-config.macos
├── before_all_linux.sh
└── oreanalytics-config.linux
├── tutorials.00.index.md
├── News.txt
├── QuantExt-SWIG
└── SWIG
│ ├── qle_currencies.i
│ ├── qle.i
│ ├── qle_common.i
│ ├── quantext.i
│ ├── qle_averageoisratehelper.i
│ ├── qle_ccyswap.i
│ ├── qle_creditdefaultswap.i
│ ├── qle_equityforward.i
│ ├── qle_cashflows.i
│ ├── qle_crossccyfixfloatswap.i
│ └── qle_oiccbasisswap.i
├── OREData-SWIG
└── SWIG
│ ├── ored.i
│ ├── ored_reports.i
│ ├── ored_calendarAdjustmentConfig.i
│ ├── oredata.i
│ └── ored_loader.i
├── LICENSE.txt
├── runCmakeVS.cmd
├── tutorials.06.notebooks.md
├── .github
└── workflows
│ ├── macosx86_wheels.yml
│ ├── macosARM64_wheels.yml
│ ├── linux_manylinux_wheels_01.yml
│ └── linux_manylinux_wheels_02.yml
├── tutorials.05.wheels.md
├── tutorials.01.install_windows.md
└── tutorials.02.install_posix.md
/OREAnalytics-SWIG/Python/Examples/Notebooks/Example_1/Input/notes:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/Python/Examples/Notebooks/Example_6/Input/notes:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/Java/Manifest.txt:
--------------------------------------------------------------------------------
1 | Class-Path: OREAnalyticsJava.jar
2 |
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/Python/Examples/Notebooks/Example_1/Input/fixings.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/Python/Examples/Notebooks/Example_6/Input/fixings.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "QuantLib-SWIG"]
2 | path = QuantLib-SWIG
3 | url = https://github.com/OpenSourceRisk/QuantLib-SWIG.git
4 |
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/LICENSE.TXT:
--------------------------------------------------------------------------------
1 | QuantExt-SWIG is
2 | Copyright (C) 2018 Quaternion Risk Management Ltd
3 | All rights reserved.
4 |
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.8)
2 |
3 | project(ORE-SWIG)
4 |
5 | add_subdirectory(OREAnalytics-SWIG/Python)
6 |
7 |
--------------------------------------------------------------------------------
/runCmake.sh:
--------------------------------------------------------------------------------
1 | cmake \
2 | -D Python_ROOT_DIR=$PYTHON_ROOT_DIR \
3 | -D ORE_USE_ZLIB=ON \
4 | -D ORE=$ORE \
5 | -D ORE_BUILD=$ORE_BUILD \
6 | -G Ninja ..
7 |
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/Python/Examples/Notebooks/Example_8/riskclass.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OpenSourceRisk/ORE-SWIG/HEAD/OREAnalytics-SWIG/Python/Examples/Notebooks/Example_8/riskclass.JPG
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/Python/Examples/Notebooks/Example_8/risktype.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OpenSourceRisk/ORE-SWIG/HEAD/OREAnalytics-SWIG/Python/Examples/Notebooks/Example_8/risktype.JPG
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/Python/test/testrunner.py:
--------------------------------------------------------------------------------
1 | import os
2 | import sys
3 | import ORE
4 | import nose
5 |
6 | sys.modules["QuantLib"] = ORE
7 |
8 | if __name__=="__main__":
9 | nose.run()
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/Python/Examples/Notebooks/Example_7/Readme.txt:
--------------------------------------------------------------------------------
1 | SIMM Calculator called with an external CRIF file
2 |
3 | The latest supported SIMM version is 2.6 (aka 2.5.6)
4 |
5 | For SIMM version >= 2.2 we provide both MPoR=10d and MPoR=1d versions.
6 |
--------------------------------------------------------------------------------
/Docker/docker-compose-oreswig.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 |
3 | services:
4 | env_ore_plus_swig:
5 | image: env_oreswig:${ORE_TAG}
6 | build:
7 | context: ../../
8 | dockerfile: oreswig/Docker/Dockerfile-ORESWIG
9 | args:
10 | - ore_version=${ORE_TAG}
--------------------------------------------------------------------------------
/Docker/docker-compose-oreswig-app.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 |
3 | services:
4 | ore_plus_app:
5 | image: oreswig_app:${ORE_TAG}
6 | build:
7 | context: ../../
8 | dockerfile: oreswig/Docker/Dockerfile-ORESWIG-App
9 | args:
10 | - ore_version=${ORE_TAG}
11 | - debian_tag=${DEBIAN_TAG}
12 |
--------------------------------------------------------------------------------
/Docker/DockerfileRunORE.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose --env-file ore/Docker/.env -f oreswig/Docker/docker-compose-oreswig.yml build || exit 1
3 | COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose --env-file ore/Docker/.env -f oreswig/Docker/docker-compose-oreswig-app.yml build || exit 1
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/Python/Examples/Notebooks/Example_1/Input/pricingengine.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | DiscountedCashflows
5 |
6 | DiscountingSwapEngineOptimised
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/Python/Examples/Notebooks/Example_6/Input/pricingengine.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | DiscountedCashflows
5 |
6 | DiscountingSwapEngineOptimised
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/Python/Examples/Notebooks/Example_7/Input/market.txt:
--------------------------------------------------------------------------------
1 | 20191230 FX/RATE/EUR/CHF 1.125046
2 | 20191230 FX/RATE/EUR/GBP 0.811938
3 | 20191230 FX/RATE/EUR/JPY 128.15046
4 | 20191230 FX/RATE/EUR/SEK 9.657638
5 | 20191230 FX/RATE/EUR/USD 1.132337
6 | 20191230 FX/RATE/USD/GBP 1.394610179594994
7 | 20191230 FX/RATE/USD/CHF 1.006480623903378
8 |
9 |
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/Python/Examples/Notebooks/Example_7/Input/pricingengine.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | DiscountedCashflows
5 |
6 | DiscountingSwapEngineOptimised
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/Python/Examples/Input/caladj.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 2020-06-01
5 |
6 |
7 | 2020-05-05
8 |
9 |
10 |
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/Python/Examples/runExamples.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | status=0
3 | return_code=0
4 | for file in *.py; do
5 | if [ -f "$file" ]; then
6 | echo RUN $file
7 | python3 "$file" || status=1
8 | return_code=$?
9 | if [ $return_code -gt $status ]; then
10 | status=$return_code
11 | fi
12 | fi
13 | done
14 | exit $status
15 |
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/Python/test/OREAnalyticsTestSuite.py:
--------------------------------------------------------------------------------
1 | """
2 | Copyright (C) 2023 Quaternion Risk Management Ltd
3 | All rights reserved.
4 | """
5 | import sys
6 | import nose
7 | import ORE
8 |
9 | def test():
10 | print('testing ORED ' + ORE.__version__)
11 | result = nose.run()
12 | if result == False:
13 | sys.exit(1)
14 |
15 | if __name__ == '__main__':
16 | test()
17 |
18 |
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/Python/Examples/Notebooks/Example_4/Input/inputeigenvectors.csv:
--------------------------------------------------------------------------------
1 | tenor,eigenvector_1,eigenvector_2
2 | 1,0.353553390593,-0.537955502871
3 | 2,0.353553390593,-0.374924478795
4 | 3,0.353553390593,-0.252916811525
5 | 5,0.353553390593,-0.087587539893
6 | 10,0.353553390593,0.12267800393
7 | 15,0.353553390593,0.240659435416
8 | 20,0.353553390593,0.339148675322
9 | 30,0.353553390593,0.552478951238
10 |
--------------------------------------------------------------------------------
/runPythonTests.cmd:
--------------------------------------------------------------------------------
1 | set PYTHONPATH=%PYTHONPATH%;%~dp0\OREAnalytics-SWIG\Python\build;%~dp0\OREAnalytics-SWIG\Python\build\Release
2 | echo RUN ORE Python Testsuite
3 | cd %~dp0\OREAnalytics-SWIG\Python\Test
4 | python OREAnalyticsTestSuite.py
5 | pause
6 |
7 | echo RUN QuantLib Testsuite
8 | cd %~dp0\QuantLib-SWIG\Python\test
9 | python -c "import sys, ORE; sys.modules['QuantLib']=ORE;import QuantLibTestSuite;QuantLibTestSuite.test()"
10 | pause
11 |
12 | cd %~dp0\
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/Python/Examples/Notebooks/Example_5/ore.py:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2018 Quaternion Risk Manaement Ltd
2 | # All rights reserved.
3 |
4 | from OREPlus import *
5 |
6 | print ("Loading parameters...")
7 | params = Parameters()
8 | print (" params is of type", type(params))
9 | params.fromFile("Input/ore.xml")
10 | print (" setup/asofdate = " + params.get("setup","asofDate"))
11 |
12 | print ("Building ORE+ App...")
13 | ore = OREAppPlus(params)
14 | print (" ore is of type", type(ore))
15 |
16 | print ("Running ORE process...");
17 | # Run it all
18 | ore.run()
19 |
20 | print("Done")
21 |
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/Python/Examples/testAllNotebooks.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | status=0
3 | return_code=0
4 | for dir in $(find ./Notebooks -type d); do
5 | # Loop over all ipynb files in the current subdirectory
6 | for file in "$dir"/*.ipynb; do
7 | # Run nbconvert on the current ipynb file
8 | if test -f "$file"; then
9 | jupyter nbconvert --execute "$file" --to notebook --output-dir=./tmp
10 | return_code=$?
11 | if [ $return_code -gt $status ]; then
12 | status=$return_code
13 | fi
14 | fi
15 | done
16 | done
17 | exit $status
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/Python/Examples/Notebooks/Example_7/run.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | import sys
4 | sys.path.append('../')
5 | from ore_examples_helper import OreExample
6 |
7 | oreex = OreExample(sys.argv[1] if len(sys.argv)>1 else False)
8 |
9 | orexmls = [
10 | ("Input/ore_SIMM2.4_10D.xml", "2.4", "10"),
11 | ("Input/ore_SIMM2.4_1D.xml", "2.4", "1"),
12 | ("Input/ore_SIMM2.6_10D.xml", "2.6", "10"),
13 | ("Input/ore_SIMM2.6_1D.xml", "2.6", "1")
14 | ]
15 | for orexml in orexmls:
16 | oreex.print_headline(f"Run ORE SIMM; version={orexml[1]}; MPOR days={orexml[2]}")
17 | oreex.run(orexml[0])
18 |
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/Python/Examples/Notebooks/Example_8/log_structured.json:
--------------------------------------------------------------------------------
1 | { "category": "Error", "group": "Curve", "message": "No security spread or bond price to imply the spread is given. Will proceed assuming a zero spread.", "sub_fields": [ { "name": "curveId", "value": "Security/ISIN:XS0983610930" }, { "name": "exceptionType", "value": "Missing security spread" } ] }
2 | { "category": "Error", "group": "Curve", "message": "No security spread or bond price to imply the spread is given. Will proceed assuming a zero spread.", "sub_fields": [ { "name": "curveId", "value": "Security/SECURITY_2" }, { "name": "exceptionType", "value": "Missing security spread" } ] }
3 |
--------------------------------------------------------------------------------
/Wheels/README.md:
--------------------------------------------------------------------------------
1 | # ore-wheels
2 |
3 | | | macOS Intel | macOS Apple Silicon | Windows 64bit | Windows 32bit | manylinux
musllinux x86_64 |
4 | |----------------|----|-----|-----|-----|----|
5 | | CPython 3.7 | ✅ | N/A | N/A | N/A | ✅ |
6 | | CPython 3.8 | ✅ | ✅ |✅ | ✅ | ✅ |
7 | | CPython 3.9 | ✅ | ✅ | ✅ | ✅ | ✅ |
8 | | CPython 3.10 | ✅ | ✅ | ✅ | ✅ | ✅ |
9 | | CPython 3.11 | ✅ | ✅ |✅ | ✅ | ✅ |
10 | | CPython 3.12 | ✅ | ✅ | ✅ | ✅ | ✅ |
11 | | PyPy 3.7 v7.3 | ✅ | N/A | ✅ | N/A | ✅¹ |
12 | | PyPy 3.8 v7.3 | ✅ | N/A | ✅ | N/A | ✅¹ |
13 | | PyPy 3.9 v7.3 | ✅ | N/A | ✅ | N/A | ✅¹ |
14 | | PyPy 3.10 v7.3 | ✅ | N/A | ✅ | N/A | ✅¹ |
15 |
16 | ¹ PyPy is only supported for manylinux wheels, not musllinux.
--------------------------------------------------------------------------------
/tutorials.00.index.md:
--------------------------------------------------------------------------------
1 |
2 | # Tutorials Index
3 |
4 | This page serves as the index for a series of tutorials on using and building
5 | ORE python wrappers and wheels.
6 |
7 | [Installing ORE Python Libraries and Example Scripts on Windows](tutorials.01.install_windows.md)
8 |
9 | [Installing ORE Python Libraries and Example Scripts on Posix Systems (e.g. MacOS and Linux)](tutorials.02.install_posix.md)
10 |
11 | [Building ORE Python Wrappers on Windows](tutorials.03.build_windows.md)
12 |
13 | [Building ORE Python Wrappers on Posix Systems (e.g. MacOS and Linux)](tutorials.04.build_posix.md)
14 |
15 | [Managing Wheels](tutorials.05.wheels.md)
16 |
17 | [Run Jupyter Notebook Examples using the published ORE Python module](tutorials.06.notebooks.md)
18 |
19 |
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/Python/Examples/Notebooks/Example_6/run.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | import sys
4 | sys.path.append('../')
5 | from ore_examples_helper import OreExample
6 |
7 | oreex = OreExample(sys.argv[1] if len(sys.argv)>1 else False)
8 |
9 | oreex.print_headline("Run ORE to produce NPV cube and exposures")
10 | oreex.run("Input/ore.xml")
11 | oreex.get_times("Output/log.txt")
12 |
13 | oreex.print_headline("Run ORE again to price European Swaptions")
14 | oreex.run("Input/ore_swaption.xml")
15 |
16 | oreex.print_headline("Plot results: Simulated exposures vs analytical swaption prices")
17 |
18 | oreex.setup_plot("swaptions")
19 | oreex.plot("exposure_trade_Swap_20y.csv", 2, 3, 'b', "Swap EPE")
20 | oreex.plot("exposure_trade_Swap_20y.csv", 2, 4, 'r', "Swap ENE")
21 | oreex.plot_npv("swaption_npv.csv", 6, 'g', "NPV Swaptions", marker='s')
22 | oreex.decorate_plot(title="Example 1 - Simulated exposures vs analytical swaption prices")
23 | oreex.save_plot_to_file()
24 |
25 |
--------------------------------------------------------------------------------
/News.txt:
--------------------------------------------------------------------------------
1 | Changes for the 9th ORE release (1.8.9.0):
2 | ==========================================
3 |
4 | Extended the interface so that we can build all ORE inputs in memory
5 | and run ORE without loading from files
6 |
7 |
8 | Changes for the 8th ORE release (1.8.8.0):
9 | ==========================================
10 |
11 | Updates to work with QuantLib-SWIG 1.28
12 |
13 |
14 | Changes for the 7th ORE release (1.8.7.0):
15 | ==========================================
16 |
17 | Updates to work with QuantLib-SWIG 1.27
18 | Python test cases fixed, thanks to Farah Khashman
19 | Various additional ORE classes wrapped, thanks to Farah Khashman
20 |
21 |
22 | Changes for the 6th ORE release (1.8.6.0):
23 | ==========================================
24 |
25 | Updates to work with QuantLib-SWIG 1.22
26 |
27 |
28 | Changes for the 5th ORE release (1.8.5.0):
29 | ==========================================
30 |
31 | Update almost all interface files to work with QuantLib-SWIG 1.18
32 | and to use the SWIG wrapper of boost::shared_ptr.
33 |
34 |
35 |
--------------------------------------------------------------------------------
/Wheels/oreanalytics-config.macos:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # On your system, the boost_thread lib may have a nonstandard name, e.g. boost_thread-mt.
4 | # If that is the case then set the BOOST_THREAD variable before calling this script, e.g:
5 | # export BOOST_THREAD=boost_thread-mt
6 | BOOST_THREAD="${BOOST_THREAD:=boost_thread}"
7 |
8 | usage="\
9 | Usage: oreanalytics-config [--libs] [--cflags]"
10 |
11 | if test $# -eq 0; then
12 | echo "${usage}" 1>&2
13 | exit 1
14 | fi
15 |
16 | while test $# -gt 0; do
17 | case "$1" in
18 | -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
19 | *) optarg= ;;
20 | esac
21 |
22 | case $1 in
23 | --cflags)
24 | echo -I/usr/local/include
25 | ;;
26 | --libs)
27 | echo -L/usr/local/lib -lboost_date_time -lboost_filesystem -lboost_iostreams -lboost_regex -lboost_serialization -lboost_system -lboost_thread -lOREAnalytics -lOREData -lQuantExt -lQuantLib
28 | ;;
29 | *)
30 | echo "${usage}" 1>&2
31 | exit 1
32 | ;;
33 | esac
34 | shift
35 | done
36 |
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/Python/ORE/__init__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: iso-8859-1 -*-
2 | """
3 | Copyright (C) 2018 Quaternion Risk Management Ltd
4 | All rights reserved.
5 | """
6 |
7 | import sys
8 | if sys.version_info.major >= 3:
9 | from .ORE import *
10 | from .ORE import _ORE
11 | else:
12 | from ORE import *
13 | from ORE import _ORE
14 | del sys
15 |
16 | __author__ = 'Quaternion Risk Management'
17 | __email__ = 'ino@quaternion.com'
18 |
19 | if hasattr(_ORE,'__version__'):
20 | __version__ = _ORE.__version__
21 | elif hasattr(_ORE.cvar,'__version__'):
22 | __version__ = _ORE.cvar.__version__
23 | else:
24 | print('Could not find __version__ attribute')
25 |
26 | if hasattr(_ORE,'__hexversion__'):
27 | __hexversion__ = _ORE.__hexversion__
28 | elif hasattr(_ORE.cvar,'__hexversion__'):
29 | __hexversion__ = _ORE.cvar.__hexversion__
30 | else:
31 | print('Could not find __hexversion__ attribute')
32 |
33 | __license__ = """
34 | COPYRIGHT AND PERMISSION NOTICE
35 |
36 | Copyright (c) 2018 Quaternion Risk Management Ltd
37 | All rights reserved.
38 | """
39 |
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/Python/Examples/Notebooks/Example_3/ore_amc.py:
--------------------------------------------------------------------------------
1 | '''
2 | Copyright (C) 2018-2023 Quaternion Risk Management Ltd
3 |
4 | This file is part of ORE, a free-software/open-source library
5 | for transparent pricing and risk analysis - http://opensourcerisk.org
6 | ORE is free software: you can redistribute it and/or modify it
7 | under the terms of the Modified BSD License. You should have received a
8 | copy of the license along with this program.
9 | The license is also available online at
10 | This program is distributed on the basis that it will form a useful
11 | contribution to risk analytics and model standardisation, but WITHOUT
12 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
14 | '''
15 |
16 | import sys, time
17 | from ORE import *
18 |
19 | print ("Loading parameters...")
20 | params = Parameters()
21 | params.fromFile("Input/ore_amc.xml")
22 |
23 | print ("Creating OREApp...")
24 | ore = OREApp(params)
25 |
26 | print ("Running ORE process...")
27 | ore.run()
28 |
29 | print ("ORE process done")
30 |
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/Python/Examples/Notebooks/Example_3/ore_classic.py:
--------------------------------------------------------------------------------
1 | '''
2 | Copyright (C) 2018-2023 Quaternion Risk Management Ltd
3 |
4 | This file is part of ORE, a free-software/open-source library
5 | for transparent pricing and risk analysis - http://opensourcerisk.org
6 | ORE is free software: you can redistribute it and/or modify it
7 | under the terms of the Modified BSD License. You should have received a
8 | copy of the license along with this program.
9 | The license is also available online at
10 | This program is distributed on the basis that it will form a useful
11 | contribution to risk analytics and model standardisation, but WITHOUT
12 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
14 | '''
15 |
16 | import sys, time
17 | from ORE import *
18 |
19 | print ("Loading parameters...")
20 | params = Parameters()
21 | params.fromFile("Input/ore_classic.xml")
22 |
23 | print ("Creating OREApp...")
24 | ore = OREApp(params, True)
25 |
26 | print ("Running ORE process...")
27 | ore.run()
28 |
29 | print ("ORE process done")
30 |
--------------------------------------------------------------------------------
/Wheels/before_all_linux.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
6 | echo "pwd"
7 | pwd
8 | echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
9 |
10 | CURRENT_DIR=$(pwd)
11 |
12 | #echo "XYZ BEGIN unpack eigen"
13 | #curl -O -L https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz
14 | #tar zxvf eigen-3.4.0.tar.gz
15 | #cd eigen-3.4.0
16 | #mkdir build
17 | #cd build
18 | #cmake ..
19 | #cd ../..
20 | #echo "XYZ END unpack eigen"
21 |
22 | #echo "XYZ BEGIN unpack zlib"
23 | #curl -O -L https://www.zlib.net/zlib-1.3.1.tar.gz
24 | #tar xzvf zlib-1.3.1.tar.gz
25 | #cd zlib-1.3.1
26 | #./configure
27 | #make
28 | #cd ..
29 | #echo "XYZ END unpack zlib"
30 |
31 | echo "XYZ BEGIN unpack boost"
32 | # Setup Boost
33 | curl -O -L https://boostorg.jfrog.io/artifactory/main/release/1.80.0/source/boost_1_80_0.tar.gz
34 | tar xfz boost_1_80_0.tar.gz
35 | cd boost_1_80_0
36 | export Eigen3_DIR=$CURRENT_DIR/eigen-3.4.0
37 | ./bootstrap.sh --with-libraries=date_time,filesystem,iostreams,log,regex,serialization,system,thread,timer
38 | ./b2 install -sZLIB_SOURCE=$CURRENT_DIR/zlib-1.3.1
39 | cd ..
40 | echo "XYZ END unpack boost"
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/Python/Examples/Notebooks/Example_1/ore.py:
--------------------------------------------------------------------------------
1 | '''
2 | Copyright (C) 2018-2023 Quaternion Risk Management Ltd
3 |
4 | This file is part of ORE, a free-software/open-source library
5 | for transparent pricing and risk analysis - http://opensourcerisk.org
6 | ORE is free software: you can redistribute it and/or modify it
7 | under the terms of the Modified BSD License. You should have received a
8 | copy of the license along with this program.
9 | The license is also available online at
10 | This program is distributed on the basis that it will form a useful
11 | contribution to risk analytics and model standardisation, but WITHOUT
12 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
14 | '''
15 |
16 | import sys, time
17 | from ORE import *
18 |
19 | print ("Loading parameters...")
20 | params = Parameters()
21 | params.fromFile("Input/ore.xml")
22 |
23 | print ("Creating OREApp...")
24 | ore = OREApp(params)
25 |
26 | print ("Running ORE process...")
27 | ore.run()
28 |
29 | print("Run time: %.6f sec" % ore.getRunTime())
30 |
31 | print ("ORE process done")
32 |
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/Python/Examples/Notebooks/Example_7/ore.py:
--------------------------------------------------------------------------------
1 | '''
2 | Copyright (C) 2018-2023 Quaternion Risk Management Ltd
3 |
4 | This file is part of ORE, a free-software/open-source library
5 | for transparent pricing and risk analysis - http://opensourcerisk.org
6 | ORE is free software: you can redistribute it and/or modify it
7 | under the terms of the Modified BSD License. You should have received a
8 | copy of the license along with this program.
9 | The license is also available online at
10 | This program is distributed on the basis that it will form a useful
11 | contribution to risk analytics and model standardisation, but WITHOUT
12 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
14 | '''
15 |
16 | #import sys, time
17 | from ORE import *
18 |
19 | print ("Loading parameters...")
20 | params = Parameters()
21 | params.fromFile("Input/ore_SIMM2.4_10D.xml")
22 |
23 | print ("Creating OREApp...")
24 | ore = OREApp(params, True)
25 |
26 | print ("Running ORE process...");
27 | ore.run()
28 |
29 | print ("Running ORE process done");
30 |
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/Python/Examples/log.py:
--------------------------------------------------------------------------------
1 |
2 | # Copyright (C) 2019 Quaternion Risk Manaement Ltd
3 | # All rights reserved.
4 |
5 | from ORE import *
6 |
7 | fileLogger = FileLogger("log.txt")
8 | Log.instance().registerLogger(fileLogger)
9 |
10 | mask = 7
11 | Log.instance().setMask(mask)
12 | assert mask == Log.instance().mask()
13 |
14 | Log.instance().switchOn()
15 |
16 | ALOG("Alert Message")
17 | CLOG("Critical Message")
18 | ELOG("Error Message")
19 | WLOG("Warning Message")
20 | LOG("Notice Message")
21 | DLOG("Debug Message")
22 | TLOG("Data Message")
23 |
24 | bufferLogger = BufferLogger(ORE_NOTICE)
25 | Log.instance().registerLogger(bufferLogger)
26 | mask = 255
27 | Log.instance().setMask(mask)
28 | msg_d = "This is a debug message."
29 | msg_w = "This is a warning message."
30 | msg_e = "This is an error message."
31 | DLOG(msg_d)
32 | WLOG(msg_w)
33 | ELOG(msg_e)
34 | #msg_d_buf = bufferLogger.next() filtered
35 | msg_w_buf = bufferLogger.next()
36 | msg_e_buf = bufferLogger.next()
37 |
38 | print("Printing log message ...")
39 | print(msg_w_buf)
40 | print(msg_e_buf)
41 | print("End of printing log message.")
42 |
43 | # FIFO
44 | assert msg_w in msg_w_buf
45 | assert msg_e in msg_e_buf
46 |
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/Python/Examples/Notebooks/Example_6/ore.py:
--------------------------------------------------------------------------------
1 | '''
2 | Copyright (C) 2018-2023 Quaternion Risk Management Ltd
3 |
4 | This file is part of ORE, a free-software/open-source library
5 | for transparent pricing and risk analysis - http://opensourcerisk.org
6 | ORE is free software: you can redistribute it and/or modify it
7 | under the terms of the Modified BSD License. You should have received a
8 | copy of the license along with this program.
9 | The license is also available online at
10 | This program is distributed on the basis that it will form a useful
11 | contribution to risk analytics and model standardisation, but WITHOUT
12 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
14 | '''
15 |
16 | import sys, time
17 | from OREAnalytics import *
18 |
19 | print ("Loading parameters...")
20 | params = Parameters()
21 | params.fromFile("Input/ore.xml")
22 |
23 | print ("Creating OREApp...")
24 | ore = OREApp(params)
25 |
26 | print ("Running ORE process...")
27 | ore.run()
28 |
29 | print("Run time: %.6f sec" % ore.getRunTime())
30 |
31 | print ("ORE process done")
32 |
--------------------------------------------------------------------------------
/QuantExt-SWIG/SWIG/qle_currencies.i:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2018 Quaternion Risk Management Ltd
3 | All rights reserved.
4 |
5 | This file is part of ORE, a free-software/open-source library
6 | for transparent pricing and risk analysis - http://opensourcerisk.org
7 |
8 | ORE is free software: you can redistribute it and/or modify it
9 | under the terms of the Modified BSD License. You should have received a
10 | copy of the license along with this program.
11 | The license is also available online at
12 |
13 | This program is distributed on the basis that it will form a useful
14 | contribution to risk analytics and model standardisation, but WITHOUT
15 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 | FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17 | */
18 |
19 | #ifndef qle_currencies_i
20 | #define qle_currencies_i
21 |
22 | %include currencies.i
23 |
24 | %{
25 | using QuantLib::Currency;
26 | %}
27 |
28 | namespace QuantExt {
29 | //Metals
30 | class XAUCurrency : public Currency {};
31 | class XAGCurrency : public Currency {};
32 | class XPTCurrency : public Currency {};
33 | class XPDCurrency : public Currency {};
34 |
35 | }
36 |
37 | #endif
38 |
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/oreanalytics-config:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # On your system, the boost_thread lib may have a nonstandard name, e.g. boost_thread-mt.
4 | # If that is the case then set the BOOST_THREAD variable before calling this script, e.g:
5 | # export BOOST_THREAD=boost_thread-mt
6 | BOOST_THREAD="${BOOST_THREAD:=boost_thread}"
7 |
8 | usage="\
9 | Usage: oreanalytics-config [--libs] [--cflags]"
10 |
11 | if test $# -eq 0; then
12 | echo "${usage}" 1>&2
13 | exit 1
14 | fi
15 |
16 | while test $# -gt 0; do
17 | case "$1" in
18 | -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
19 | *) optarg= ;;
20 | esac
21 |
22 | case $1 in
23 | --cflags)
24 | echo -I${ORE}/build/QuantLib -I${ORE}/OREAnalytics -I${ORE}/OREData -I${ORE}/QuantExt -I${ORE}/QuantLib -I${BOOST_INC} -std=c++1z
25 | ;;
26 | --libs)
27 | echo -L${ORE}/build/OREAnalytics/orea -lOREAnalytics -L${ORE}/build/OREData/ored -lOREData -L${ORE}/build/QuantExt/qle -lQuantExt -L${ORE}/build/QuantLib/ql -lQuantLib -L${BOOST_LIB} -l${BOOST_THREAD} -lboost_system -lboost_serialization -lboost_date_time -lboost_regex -lboost_filesystem -std=c++1z
28 | ;;
29 | *)
30 | echo "${usage}" 1>&2
31 | exit 1
32 | ;;
33 | esac
34 | shift
35 | done
36 |
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/Java/Examples/ORERunner.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2018 Quaternion Risk Management
3 | All rights reserved.
4 | */
5 |
6 | /*! Demo Java application */
7 |
8 | package orerunner;
9 |
10 | import oreanalytics.*;
11 | import java.io.*;
12 | import java.nio.*;
13 | import java.util.*;
14 |
15 | public class ORERunner {
16 |
17 | /*! Load wrapper library */
18 |
19 | static {
20 | System.loadLibrary("OREAnalyticsJava");
21 | }
22 |
23 | /*! main method */
24 |
25 | public static void main(String argv[]) {
26 | try {
27 | System.out.println("============================================");
28 | System.out.println("ORE Java started...");
29 | System.out.println("============================================");
30 |
31 | if (argv.length < 1) {
32 | System.out.println("Usage: ORERunner path/to/ore.xml");
33 | System.exit(0);
34 | }
35 |
36 | System.out.println("Load Application Parameters");
37 | Parameters p = new Parameters();
38 | p.fromFile(argv[0]);
39 |
40 | System.out.println("Initialize ORE App");
41 | OREApp app = new OREApp(p);
42 |
43 | System.out.println("Done.");
44 | }
45 | catch(Exception e){
46 | System.out.println("Exception caught: " + e.getMessage());
47 | e.printStackTrace();
48 | }
49 | }
50 |
51 | };
52 |
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/Python/Examples/Notebooks/Example_4/Input/portfolio.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Swap
5 |
6 | CPTY_A
7 | CPTY_A
8 |
9 |
10 |
11 |
12 | Fixed
13 | false
14 | EUR
15 |
16 | 10000000.000000
17 |
18 | 30/360
19 | F
20 |
21 |
22 | 0.02
23 |
24 |
25 |
26 |
27 | 20151028
28 | 20351028
29 | 1Y
30 | TARGET
31 | F
32 | F
33 | Forward
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/Docker/Dockerfile-ORESWIG:
--------------------------------------------------------------------------------
1 | # syntax = nexus3.acadiasoft.net:4445/docker/dockerfile:experimental
2 | ARG ore_version=latest
3 | FROM env_ore:${ore_version}
4 |
5 | MAINTAINER Quaternion Risk Management
6 | LABEL Description="Build OREPlus"
7 |
8 | # Argument for number of cores to use while building
9 | ARG num_cores
10 |
11 | # Install SWIG and python3
12 | RUN apt-get update && apt-get upgrade -y \
13 | && apt-get install -f -y swig python3-dev \
14 | && apt-get clean \
15 | && rm -rf /var/lib/apt/lists/*
16 |
17 | WORKDIR /swig
18 |
19 | # Argument for number of cores to use while building
20 | ARG num_cores=1
21 |
22 | COPY ore/cmake ./cmake
23 | COPY oreswig/OREAnalytics-SWIG ./OREAnalytics-SWIG
24 | COPY oreswig/OREData-SWIG ./OREData-SWIG
25 | COPY oreswig/QuantExt-SWIG ./QuantExt-SWIG
26 | COPY oreswig/QuantLib-SWIG ./QuantLib-SWIG
27 |
28 | ENV PYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/ \
29 | PYTHON_INCLUDE_DIR=/usr/include/x86_64-linux-gnu/python3.9
30 |
31 | RUN find -regex ".*\.\(sh\|in\|ac\|am\)" -exec dos2unix {} ';'
32 | WORKDIR /swig/OREAnalytics-SWIG/Python
33 | RUN mkdir build.release
34 | WORKDIR /swig/OREAnalytics-SWIG/Python/build.release
35 | RUN cmake -DORE_ENABLE_OPENCL=ON -DORE=/swig ..
36 | RUN make -j ${num_cores}
37 | WORKDIR /
38 | RUN mkdir oreswig
39 | RUN mv /swig/OREAnalytics-SWIG/Python/build.release/ORE.py oreswig \
40 | && mv /swig/OREAnalytics-SWIG/Python/build.release/_ORE.so oreswig
41 |
42 | ENV PYTHONPATH=/oreswig
43 |
44 | WORKDIR /swig/OREAnalytics-SWIG/Python/Examples
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/Python/Examples/Notebooks/Example_5/Input/pricingengine.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Generic
5 |
6 | GaussianCam
7 | USD
8 | false
9 | 3M(1W),1Y(1M),5Y(3M),10Y(1Y),50Y(5Y)
10 | 0.0050
11 | 0.0050
12 | true
13 | true
14 |
15 | JY
16 |
17 | Generic
18 |
19 | MC
20 | 10000
21 | 4
22 | 24
23 | false
24 | 1.0
25 | false
26 | false
27 |
28 |
29 |
30 | true
31 |
32 |
33 |
--------------------------------------------------------------------------------
/OREAnalytics-SWIG/Python/Examples/Notebooks/Example_2/ore.py:
--------------------------------------------------------------------------------
1 | '''
2 | Copyright (C) 2018-2023 Quaternion Risk Management Ltd
3 |
4 | This file is part of ORE, a free-software/open-source library
5 | for transparent pricing and risk analysis - http://opensourcerisk.org
6 | ORE is free software: you can redistribute it and/or modify it
7 | under the terms of the Modified BSD License. You should have received a
8 | copy of the license along with this program.
9 | The license is also available online at
10 | This program is distributed on the basis that it will form a useful
11 | contribution to risk analytics and model standardisation, but WITHOUT
12 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
14 | '''
15 |
16 | import sys, time
17 | from ORE import *
18 |
19 | xml = "Input/ore.xml"
20 | params = Parameters()
21 | params.fromFile(xml)
22 | ore = OREApp(params)
23 | print ("Run ORE for", xml)
24 | ore.run()
25 |
26 | xml = "Input/ore_threshold.xml"
27 | params = Parameters()
28 | params.fromFile(xml)
29 | ore_threshold = OREApp(params)
30 | print ("Run ORE for", xml)
31 | ore_threshold.run()
32 |
33 | xml = "Input/ore_mta.xml"
34 | params = Parameters()
35 | params.fromFile(xml)
36 | ore_mta = OREApp(params)
37 | print ("Run ORE for", xml)
38 | ore_mta.run()
39 |
40 | xml = "Input/ore_mpor.xml"
41 | params = Parameters()
42 | params.fromFile(xml)
43 | ore_mpor = OREApp(params)
44 | print ("Run ORE for", xml)
45 | ore_mpor.run()
46 |
47 | print ("ORE process done")
48 |
--------------------------------------------------------------------------------
/OREData-SWIG/SWIG/ored.i:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2018 Quaternion Risk Management Ltd
3 | All rights reserved.
4 |
5 | This file is part of ORE, a free-software/open-source library
6 | for transparent pricing and risk analysis - http://opensourcerisk.org
7 |
8 | ORE is free software: you can redistribute it and/or modify it
9 | under the terms of the Modified BSD License. You should have received a
10 | copy of the license along with this program.
11 | The license is also available online at
12 |
13 | This program is distributed on the basis that it will form a useful
14 | contribution to risk analytics and model standardisation, but WITHOUT
15 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 | FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17 | */
18 |
19 | #ifndef ored_i
20 | #define ored_i
21 |
22 | %{
23 | #include
24 | #include
25 | #include
26 |
27 | #include
28 | #include
29 | #include
30 | #include