instruments (3) - Linux Manuals


Financial instruments -


class DigitalCoupon
Digital-payoff coupon.
class CallableBond
Callable bond base class.
class CallableFixedRateBond
callable/puttable fixed rate bond
class CallableZeroCouponBond
callable/puttable zero coupon bond
class Commodity
Commodity base class.
class EnergyCommodity
Energy commodity class.
class EnergyFuture
Energy future.
class DividendBarrierOption
Single-asset barrier option with discrete dividends.
class VarianceOption
Variance option.
class ContinuousAveragingAsianOption
Continuous-averaging Asian option.
class DiscreteAveragingAsianOption
Discrete-averaging Asian option.
class AssetSwap
Bullet bond vs Libor swap.
class BarrierOption
Barrier option on a single asset.
class BasketOption
Basket option on a number of assets.
class Bond
Base bond class.
class CmsRateBond
CMS-rate bond.
class FixedRateBond
fixed-rate bond
class FloatingRateBond
floating-rate bond (possibly capped and/or floored)
class ZeroCouponBond
zero-coupon bond
class CapFloor
Base class for cap-like instruments.
class Cap
Concrete cap class.
class Floor
Concrete floor class.
class Collar
Concrete collar class.
class CliquetOption
cliquet (Ratchet) option
class CompositeInstrument
Composite instrument
class CreditDefaultSwap
Credit default swap.
class DividendVanillaOption
Single-asset vanilla option (no barriers) with discrete dividends.
class EuropeanOption
European option on a single asset.
class FixedRateBondForward
Forward contract on a fixed-rate bond
class Forward
Abstract base forward class.
class ForwardVanillaOption
Forward version of a vanilla option
class InflationSwap
Abstract base class for inflation swaps.
class ContinuousFloatingLookbackOption
Continuous-floating lookback option.
class ContinuousFixedLookbackOption
Continuous-fixed lookback option.
class PagodaOption
Roofed Asian option on a number of assets.
class QuantoBarrierOption
Quanto version of a barrier option.
class QuantoForwardVanillaOption
Quanto version of a forward vanilla option.
class QuantoVanillaOption
quanto version of a vanilla option
class Stock
Simple stock class.
class Swap
Interest rate swap.
class Swaption
Swaption class
class VanillaOption
Vanilla option (no discrete dividends, no barriers) on a single asset.
class VanillaSwap
Plain-vanilla swap.
class VarianceSwap
Variance swap.

Detailed Description

Since version 0.3.4, the Instrument class was reworked as shown in the following figure.

On the one hand, the checking of the expiration condition is now performed in a method isExpired() separated from the actual calculation, and a setupExpired() method is provided. The latter sets the NPV to 0.0 and can be extended in derived classes should any other results be returned.

On the other hand, the pricing-engine machinery previously contained in the Option class was moved upwards to the Instrument class. Also, the setupEngine() method was replaced by a setupArguments(Arguments*) method. This allows one to cleanly implement containment of instruments with code such as:

    class FooArguments : public Arguments { ... };

    class Foo : public Instrument {
        void setupArguments(Arguments*);

    class FooOptionArguments : public FooArguments { ... };

    class FooOption : public Option {
        Foo underlying_;
        void setupArguments(Arguments* args) {
            // set the option-specific part

which was more difficult to write with setupEngine().

Therefore, there are now two ways to inherit from Instrument, namely:

implement the isExpired method, and completely override the performCalculations method so that it bypasses the pricing-engine machinery. If the class declared any other results beside NPV_ and errorEstimate_, the setupExpired method should also be extended so that those results are set to a value suitable for an expired instrument. This was the migration path taken for all instruments not previously deriving from the Option class.
define suitable argument and result classes for the instrument and implement the isExpired and setupArguments methods, reusing the pricing-engine machinery provided by the default performCalculations method. The latter can be extended by first calling the default implementation and then performing any additional tasks required by the instrument---most often, copying additional results from the pricing engine results to the corresponding data members of the instrument. As in the previous case, the setupExpired method can be extended to account for such extra data members.


Generated automatically by Doxygen for QuantLib from the source code.