Class InterestRateCurve

Class Documentation

class InterestRateCurve

Manages a collection of interest rate instruments (spots, futures, swaps) and builds a yield curve.

The InterestRateCurve class allows for the creation and storage of different types of interest rate instruments, such as spot rates, futures, and swaps. It provides functionality to construct a piecewise yield curve based on these instruments. The yield curve is automatically updated when new instruments are added.

Public Functions

inline InterestRateCurve()

Constructs an empty InterestRateCurve.

std::shared_ptr<InterestRateSpot> create_interest_rate_spot(double days, double rate)

Creates and adds an interest rate spot.

Parameters:
  • days – Maturity in days.

  • rate – Interest rate.

Returns:

A shared pointer to the created InterestRateSpot.

std::shared_ptr<InterestRateFuture> create_interest_rate_future(const boost::gregorian::date &expiration, double bid, double ask)

Creates and adds an interest rate future.

Parameters:
  • expiration – Expiration date of the future.

  • bid – Bid price of the future.

  • ask – Ask price of the future.

Returns:

A shared pointer to the created InterestRateFuture.

std::shared_ptr<InterestRateSwap> create_interest_rate_swap(double years, double bid, double ask)

Creates and adds an interest rate swap.

Parameters:
  • years – Maturity of the swap in years.

  • bid – Bid rate of the swap.

  • ask – Ask rate of the swap.

Returns:

A shared pointer to the created InterestRateSwap.

inline void set_valuation_time(const boost::posix_time::ptime &time)

Sets the valuation time (date only) for the interest rate curve.

Parameters:

time – Valuation time.

inline virtual InterestRateCurve *clone() const

Creates a copy of the InterestRateCurve.

Returns:

A pointer to a new InterestRateCurve cloned from this instance.

inline virtual InterestRateCurve *create() const

Creates a new empty InterestRateCurve instance.

Returns:

A pointer to a new InterestRateCurve.

inline std::shared_ptr<PieceWiseYieldCurve> get_yield_curve()

Returns the constructed piecewise yield curve.

Returns:

A shared pointer to the PieceWiseYieldCurve.

Friends

friend std::ostream &operator<<(std::ostream &out, const InterestRateCurve &obj)

Outputs the InterestRateCurve to a stream.