-
Notifications
You must be signed in to change notification settings - Fork 285
Expand file tree
/
Copy pathore.cpp
More file actions
94 lines (76 loc) · 2.94 KB
/
ore.cpp
File metadata and controls
94 lines (76 loc) · 2.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
Copyright (C) 2016 Quaternion Risk Management Ltd
All rights reserved.
This file is part of ORE, a free-software/open-source library
for transparent pricing and risk analysis - http://opensourcerisk.org
ORE is free software: you can redistribute it and/or modify it
under the terms of the Modified BSD License. You should have received a
copy of the license along with this program.
The license is also available online at <http://opensourcerisk.org>
This program is distributed on the basis that it will form a useful
contribution to risk analytics and model standardisation, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
*/
#ifdef BOOST_MSVC
// disable warning C4503: '__LINE__Var': decorated name length exceeded, name was truncated
// This pragma statement needs to be at the top of the file - lower and it will not work:
// http://stackoverflow.com/questions/9673504/is-it-possible-to-disable-compiler-warning-c4503
// http://boost.2283326.n4.nabble.com/General-Warnings-and-pragmas-in-MSVC-td2587449.html
#pragma warning(disable : 4503)
#endif
#include <orea/app/oreapp.hpp>
#include <orea/app/initbuilders.hpp>
#include <qle/version.hpp>
#include <qle/gitversion.hpp>
#include <iostream>
#if !defined(BOOST_ALL_NO_LIB) && defined(BOOST_MSVC)
#include <orea/auto_link.hpp>
#include <ored/auto_link.hpp>
#include <ql/auto_link.hpp>
#include <qle/auto_link.hpp>
// Find the name of the correct boost library with which to link.
#define BOOST_LIB_NAME boost_serialization
#include <boost/config/auto_link.hpp>
#define BOOST_LIB_NAME boost_date_time
#include <boost/config/auto_link.hpp>
#define BOOST_LIB_NAME boost_filesystem
#include <boost/config/auto_link.hpp>
#define BOOST_LIB_NAME boost_system
#include <boost/config/auto_link.hpp>
#define BOOST_LIB_NAME boost_timer
#include <boost/config/auto_link.hpp>
#define BOOST_LIB_NAME boost_chrono
#include <boost/config/auto_link.hpp>
#endif
using namespace std;
using namespace ore::data;
using namespace ore::analytics;
int main(int argc, char** argv) {
if (argc == 2 && (string(argv[1]) == "-v" || string(argv[1]) == "--version")) {
cout << "ORE version " << OPEN_SOURCE_RISK_VERSION << endl;
exit(0);
}
if (argc == 2 && (string(argv[1]) == "-h" || string(argv[1]) == "--hash")) {
#ifdef GIT_HASH
cout << "Git hash " << GIT_HASH << endl;
#endif
exit(0);
}
if (argc != 2) {
std::cout << endl << "usage: ORE path/to/ore.xml" << endl << endl;
return -1;
}
ore::analytics::initBuilders();
string inputFile(argv[1]);
try {
auto params = QuantLib::ext::make_shared<Parameters>();
params->fromFile(inputFile);
OREApp ore(params, true);
ore.run();
return 0;
} catch (const exception& e) {
cout << endl << "an error occurred: " << e.what() << endl;
return -1;
}
}