1Financial instruments(3) QuantLib Financial instruments(3)
2
3
4
6 Financial instruments -
7
9 Since version 0.3.4, the Instrument class was reworked as shown in the
10 following figure.
11
12 On the one hand, the checking of the expiration condition is now
13 performed in a method isExpired() separated from the actual
14 calculation, and a setupExpired() method is provided. The latter sets
15 the NPV to 0.0 and can be extended in derived classes should any other
16 results be returned.
17
18 On the other hand, the pricing-engine machinery previously contained in
19 the Option class was moved upwards to the Instrument class. Also, the
20 setupEngine() method was replaced by a setupArguments(Arguments*)
21 method. This allows one to cleanly implement containment of instruments
22 with code such as:
23
24 class FooArguments : public Arguments { ... };
25
26 class Foo : public Instrument {
27 public:
28 void setupArguments(Arguments*);
29 ...
30 };
31
32 class FooOptionArguments : public FooArguments { ... };
33
34 class FooOption : public Option {
35 private:
36 Foo underlying_;
37 public:
38 void setupArguments(Arguments* args) {
39 underlying_.setupArguments(args);
40 // set the option-specific part
41 }
42 ...
43 };
44
45 which was more difficult to write with setupEngine().
46
47 Therefore, there are now two ways to inherit from Instrument, namely:
48
49 1. implement the isExpired method, and completely override the
50 performCalculations method so that it bypasses the pricing-engine
51 machinery. If the class declared any other results beside NPV_ and
52 errorEstimate_, the setupExpired method should also be extended so
53 that those results are set to a value suitable for an expired
54 instrument. This was the migration path taken for all instruments
55 not previously deriving from the Option class.
56
57 2. define suitable argument and result classes for the instrument and
58 implement the isExpired and setupArguments methods, reusing the
59 pricing-engine machinery provided by the default
60 performCalculations method. The latter can be extended by first
61 calling the default implementation and then performing any
62 additional tasks required by the instrument---most often, copying
63 additional results from the pricing engine results to the
64 corresponding data members of the instrument. As in the previous
65 case, the setupExpired method can be extended to account for such
66 extra data members.
67
68 Classes
69 class ContinuousAveragingAsianOption
70 Continuous-averaging Asian option.
71 class DiscreteAveragingAsianOption
72 Discrete-averaging Asian option.
73 class AssetSwap
74 Bullet bond vs Libor swap.
75 class BarrierOption
76 Barrier option on a single asset.
77 class BasketOption
78 Basket option on a number of assets.
79 class Bond
80 Base bond class.
81 class CapFloor
82 Base class for cap-like instruments.
83 class Cap
84 Concrete cap class.
85 class Floor
86 Concrete floor class.
87 class Collar
88 Concrete collar class.
89 class CliquetOption
90 cliquet (Ratchet) option
91 class CmsRateBond
92 CMS-rate bond.
93 class CompositeInstrument
94 Composite instrument
95 class DividendVanillaOption
96 Single-asset vanilla option (no barriers) with discrete dividends.
97 class EuropeanOption
98 European option on a single asset.
99 class FixedRateBond
100 fixed-rate bond
101 class FixedRateBondForward
102 Forward contract on a fixed-rate bond
103 class FloatingRateBond
104 floating-rate bond (possibly capped and/or floored)
105 class Forward
106 Abstract base forward class.
107 class ForwardRateAgreement
108 Forward rate agreement (FRA) class
109 class ForwardVanillaOption
110 Forward version of a vanilla option
111 class ContinuousFloatingLookbackOption
112 Continuous-floating lookback option.
113 class ContinuousFixedLookbackOption
114 Continuous-fixed lookback option.
115 class QuantoForwardVanillaOption
116 Quanto version of a forward vanilla option.
117 class QuantoVanillaOption
118 quanto version of a vanilla option
119 class Stock
120 Simple stock class.
121 class Swap
122 Interest rate swap.
123 class Swaption
124 Swaption class
125 class VanillaOption
126 Vanilla option (no discrete dividends, no barriers) on a single
127 asset.
128 class VarianceSwap
129 Variance swap.
130 class ZeroCouponBond
131 zero-coupon bond
132
133
134
135Version 0.8.1 29 Oct 2007 Financial instruments(3)