Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
testportfolio.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2016 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 <http://opensourcerisk.org>
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#pragma once
20
21#include <boost/make_shared.hpp>
23
24using namespace QuantLib;
25using namespace ore::data;
26using std::ostringstream;
27using std::pair;
28using std::vector;
29
30namespace testsuite {
31
32//! Utilities to set up simple test trades
33/*!
34 \ingroup tests
35*/
36
37string toString(Date d);
38
39QuantLib::ext::shared_ptr<Trade> buildSwap(string id, string ccy, bool isPayer, Real notional, int start, Size term, Real rate,
40 Real spread, string fixedFreq, string fixedDC, string floatFreq, string floatDC,
41 string index, Calendar cal = TARGET(),
42 QuantLib::Natural fixingDays = 2, bool spotStartLag = false);
43
44QuantLib::ext::shared_ptr<Trade> buildEuropeanSwaption(string id, string longShort, string ccy, bool isPayer, Real notional,
45 int start, Size term, Real rate, Real spread, string fixedFreq,
46 string fixedDC, string floatFreq, string floatDC, string index,
47 string cashPhysical = "Cash", Real premium = 0.0, string premiumCcy = "",
48 string premiumDate = "");
49
50QuantLib::ext::shared_ptr<Trade> buildBermudanSwaption(string id, string longShort, string ccy, bool isPayer, Real notional,
51 Size exercises, int start, Size term, Real rate, Real spread,
52 string fixedFreq, string fixedDC, string floatFreq, string floatDC,
53 string index, string cashPhysical = "Cash", Real premium = 0.0,
54 string premiumCcy = "", string premiumDate = "");
55
56QuantLib::ext::shared_ptr<Trade> buildFxOption(string id, string longShort, string putCall, Size expiry, string boughtCcy,
57 Real boughtAmount, string soldCcy, Real soldAmount, Real premium = 0.0,
58 string premiumCcy = "", string premiumDate = "");
59
60QuantLib::ext::shared_ptr<Trade> buildEquityOption(string id, string longShort, string putCall, Size expiry, string equityName,
61 string currency, Real strike, Real quantity, Real premium = 0.0,
62 string premiumCcy = "", string premiumDate = "");
63
64QuantLib::ext::shared_ptr<Trade> buildEquityForward(string id, string longShort, Size expiry, string equityName,
65 string currency, Real strike, Real quantity);
66
67QuantLib::ext::shared_ptr<Trade> buildCap(string id, string ccy, string longShort, Real capRate, Real notional, int start,
68 Size term, string floatFreq, string floatDC, string index,
69 Calendar cal = TARGET(), QuantLib::Natural fixingDays = 2,
70 bool spotStartLag = false);
71
72QuantLib::ext::shared_ptr<Trade> buildFloor(string id, string ccy, string longShort, Real floorRate, Real notional, int start,
73 Size term, string floatFreq, string floatDC, string index,
74 Calendar cal = TARGET(), QuantLib::Natural fixingDays = 2,
75 bool spotStartLag = false);
76
77QuantLib::ext::shared_ptr<Trade> buildCapFloor(string id, string ccy, string longShort, vector<Real> capRates,
78 vector<Real> floorRates, Real notional, int start, Size term, string floatFreq,
79 string floatDC, string index,
80 Calendar cal = TARGET(), QuantLib::Natural fixingDays = 2,
81 bool spotStartLag = false);
82
83QuantLib::ext::shared_ptr<Trade> buildCrossCcyBasisSwap(
84 string id, string recCcy, Real recNotional, string payCcy, Real payNotional, int start, Size term,
85 Real recLegSpread, Real payLegSpread, string recFreq, string recDC, string recIndex, Calendar recCalendar,
86 string payFreq, string payDC, string payIndex, Calendar payCalendar, QuantLib::Natural spotDays = 2,
87 bool spotStartLag = false, bool notionalInitialExchange = false, bool notionalFinalExchange = false,
88 bool notionalAmortizingExchange = false, bool isRecLegFXResettable = false, bool isPayLegFXResettable = false);
89
90QuantLib::ext::shared_ptr<Trade> buildZeroBond(string id, string ccy, Real notional, Size term, string suffix = "1");
91
92QuantLib::ext::shared_ptr<Trade> buildCreditDefaultSwap(string id, string ccy, string issuerId, string creditCurveId,
93 bool isPayer, Real notional, int start, Size term, Real rate,
94 Real spread, string fixedFreq, string fixedDC);
95
96QuantLib::ext::shared_ptr<Trade> buildSyntheticCDO(string id, string name, vector<string> names, string longShort,
97 string ccy, vector<string> ccys, bool isPayer,
98 vector<Real> notionals, Real notional, int start, Size term,
99 Real rate, Real spread, string fixedFreq, string fixedDC);
100
101QuantLib::ext::shared_ptr<Trade> buildCmsCapFloor(string id, string ccy, string indexId, bool isPayer, Real notional,
102 int start, Size term, Real capRate, Real floorRate, Real spread,
103 string freq, string dc);
104
105QuantLib::ext::shared_ptr<Trade> buildCPIInflationSwap(string id, string ccy, bool isPayer, Real notional, int start, Size term,
106 Real spread, string floatFreq, string floatDC, string index,
107 string cpiFreq, string cpiDC, string cpiIndex, Real baseRate,
108 string observationLag, bool interpolated, Real cpiRate);
109
110QuantLib::ext::shared_ptr<Trade> buildYYInflationSwap(string id, string ccy, bool isPayer, Real notional, int start, Size term,
111 Real spread, string floatFreq, string floatDC, string index,
112 string yyFreq, string yyDC, string yyIndex, string observationLag,
113 Size fixDays);
114
115QuantLib::ext::shared_ptr<Trade> buildYYInflationCapFloor(string id, string ccy, Real notional, bool isCap,
116 bool isLong, Real capFloorRate, int start, Size term,
117 string yyFreq, string yyDC, string yyIndex,
118 string observationLag, Size fixDays);
119
120QuantLib::ext::shared_ptr<Trade> buildCommodityForward(const std::string& id, const std::string& position, Size term,
121 const std::string& commodityName, const std::string& currency,
122 Real strike, Real quantity);
123
124QuantLib::ext::shared_ptr<Trade> buildCommodityOption(const std::string& id, const std::string& longShort,
125 const std::string& putCall, QuantLib::Size term,
126 const std::string& commodityName, const std::string& currency,
127 QuantLib::Real strike, QuantLib::Real quantity,
128 QuantLib::Real premium = 0.0, const std::string& premiumCcy = "",
129 const std::string& premiumDate = "");
130
131} // namespace testsuite
QuantLib::ext::shared_ptr< Trade > buildCreditDefaultSwap(string id, string ccy, string issuerId, string creditCurveId, bool isPayer, Real notional, int start, Size term, Real rate, Real spread, string fixedFreq, string fixedDC)
QuantLib::ext::shared_ptr< Trade > buildSyntheticCDO(string id, string name, vector< string > names, string longShort, string ccy, vector< string > ccys, bool isPayer, vector< Real > notionals, Real notional, int start, Size term, Real rate, Real spread, string fixedFreq, string fixedDC)
QuantLib::ext::shared_ptr< Trade > buildCap(string id, string ccy, string longShort, Real capRate, Real notional, int start, Size term, string floatFreq, string floatDC, string index, Calendar calendar, Natural spotDays, bool spotStartLag)
QuantLib::ext::shared_ptr< Trade > buildFxOption(string id, string longShort, string putCall, Size expiry, string boughtCcy, Real boughtAmount, string soldCcy, Real soldAmount, Real premium, string premiumCcy, string premiumDate)
QuantLib::ext::shared_ptr< Trade > buildCmsCapFloor(string id, string ccy, string indexId, bool isPayer, Real notional, int start, Size term, Real capRate, Real floorRate, Real spread, string freq, string dc)
QuantLib::ext::shared_ptr< Trade > buildSwap(string id, string ccy, bool isPayer, Real notional, int start, Size term, Real rate, Real spread, string fixedFreq, string fixedDC, string floatFreq, string floatDC, string index, Calendar calendar, Natural spotDays, bool spotStartLag)
QuantLib::ext::shared_ptr< Trade > buildCPIInflationSwap(string id, string ccy, bool isPayer, Real notional, int start, Size term, Real spread, string floatFreq, string floatDC, string index, string cpiFreq, string cpiDC, string cpiIndex, Real baseRate, string observationLag, bool interpolated, Real cpiRate)
QuantLib::ext::shared_ptr< Trade > buildZeroBond(string id, string ccy, Real notional, Size term, string suffix)
QuantLib::ext::shared_ptr< Trade > buildBermudanSwaption(string id, string longShort, string ccy, bool isPayer, Real notional, Size exercises, int start, Size term, Real rate, Real spread, string fixedFreq, string fixedDC, string floatFreq, string floatDC, string index, string cashPhysical, Real premium, string premiumCcy, string premiumDate)
QuantLib::ext::shared_ptr< Trade > buildEquityOption(string id, string longShort, string putCall, Size expiry, string equityName, string currency, Real strike, Real quantity, Real premium, string premiumCcy, string premiumDate)
QuantLib::ext::shared_ptr< Trade > buildFloor(string id, string ccy, string longShort, Real floorRate, Real notional, int start, Size term, string floatFreq, string floatDC, string index, Calendar calendar, Natural spotDays, bool spotStartLag)
QuantLib::ext::shared_ptr< Trade > buildCrossCcyBasisSwap(string id, string recCcy, Real recNotional, string payCcy, Real payNotional, int start, Size term, Real recLegSpread, Real payLegSpread, string recFreq, string recDC, string recIndex, Calendar recCalendar, string payFreq, string payDC, string payIndex, Calendar payCalendar, Natural spotDays, bool spotStartLag, bool notionalInitialExchange, bool notionalFinalExchange, bool notionalAmortizingExchange, bool isRecLegFXResettable, bool isPayLegFXResettable)
QuantLib::ext::shared_ptr< Trade > buildYYInflationSwap(string id, string ccy, bool isPayer, Real notional, int start, Size term, Real spread, string floatFreq, string floatDC, string index, string yyFreq, string yyDC, string yyIndex, string observationLag, Size fixDays)
QuantLib::ext::shared_ptr< Trade > buildEquityForward(string id, string longShort, Size expiry, string equityName, string currency, Real strike, Real quantity)
QuantLib::ext::shared_ptr< Trade > buildCapFloor(string id, string ccy, string longShort, vector< Real > capRates, vector< Real > floorRates, Real notional, int start, Size term, string floatFreq, string floatDC, string index, Calendar calendar, Natural spotDays, bool spotStartLag)
QuantLib::ext::shared_ptr< Trade > buildCommodityForward(const std::string &id, const std::string &position, Size term, const std::string &commodityName, const std::string &currency, Real strike, Real quantity)
QuantLib::ext::shared_ptr< Trade > buildEuropeanSwaption(string id, string longShort, string ccy, bool isPayer, Real notional, int start, Size term, Real rate, Real spread, string fixedFreq, string fixedDC, string floatFreq, string floatDC, string index, string cashPhysical, Real premium, string premiumCcy, string premiumDate)
QuantLib::ext::shared_ptr< Trade > buildYYInflationCapFloor(string id, string ccy, Real notional, bool isCap, bool isLong, Real capFloorRate, int start, Size term, string yyFreq, string yyDC, string yyIndex, string observationLag, Size fixDays)
string toString(Date d)
Utilities to set up simple test trades.
QuantLib::ext::shared_ptr< Trade > buildCommodityOption(const string &id, const string &longShort, const string &putCall, Size term, const string &commodityName, const string &currency, Real strike, Real quantity, Real premium, const string &premiumCcy, const string &premiumDate)