QuantLib: a free/open-source library for quantitative finance
Reference manual - version 1.40
Loading...
Searching...
No Matches
PerpetualFutures Class Reference

Perpetual Futures. More...

#include <ql/instruments/perpetualfutures.hpp>

Inheritance diagram for PerpetualFutures:

Classes

class  arguments
 Arguments for perpetual futures calculation More...
class  engine
 Perpetual futures engine base class More...

Public Types

enum  PayoffType { Linear , Inverse , Quanto }
enum  FundingType { FundingWithPreviousSpot , FundingWithCurrentSpot }
Public Types inherited from Observer
typedef set_type::iterator iterator

Public Member Functions

 PerpetualFutures (PerpetualFutures::PayoffType payoffType, PerpetualFutures::FundingType fundingType=PerpetualFutures::FundingWithCurrentSpot, Period fundingFrequency=Period(8, Hours), Calendar cal=NullCalendar(), DayCounter dc=ActualActual(ActualActual::ISDA))
bool isExpired () const override
 returns whether the instrument might have value greater than zero.
void setupArguments (PricingEngine::arguments *) const override
Public Member Functions inherited from Instrument
Real NPV () const
 returns the net present value of the instrument.
Real errorEstimate () const
 returns the error estimate on the NPV when available.
const DatevaluationDate () const
 returns the date the net present value refers to.
template<typename T>
result (const std::string &tag) const
 returns any additional result returned by the pricing engine.
const std::map< std::string, ext::any > & additionalResults () const
 returns all additional result returned by the pricing engine.
void setPricingEngine (const ext::shared_ptr< PricingEngine > &)
 set the pricing engine to be used.
virtual void fetchResults (const PricingEngine::results *) const
Public Member Functions inherited from LazyObject
void update () override
bool isCalculated () const
void forwardFirstNotificationOnly ()
void alwaysForwardNotifications ()
void recalculate ()
void freeze ()
void unfreeze ()
Public Member Functions inherited from Observable
 Observable (const Observable &)
Observableoperator= (const Observable &)
 Observable (Observable &&)=delete
Observableoperator= (Observable &&)=delete
void notifyObservers ()
Public Member Functions inherited from Observer
 Observer (const Observer &)
Observeroperator= (const Observer &)
std::pair< iterator, bool > registerWith (const ext::shared_ptr< Observable > &)
void registerWithObservables (const ext::shared_ptr< Observer > &)
Size unregisterWith (const ext::shared_ptr< Observable > &)
void unregisterWithAll ()
virtual void deepUpdate ()

Additional Inherited Members

Protected Member Functions inherited from Instrument
void calculate () const override
virtual void setupExpired () const
void performCalculations () const override
Protected Attributes inherited from Instrument
Real NPV_
Real errorEstimate_
Date valuationDate_
std::map< std::string, ext::any > additionalResults_
ext::shared_ptr< PricingEngineengine_
bool calculated_ = false
bool frozen_ = false
bool alwaysForward_

Detailed Description

Perpetual Futures.

PayoffType is:

  • Linear: underlying is FOR/DOM pair and margin and settlement are done in DOM;
  • Inverse: underlying is FOR/DOM pair and margin and settlement are done in FOR;
  • Quanto: underlying is FOR/DOM pair and margin and settlement are done in Quanto currency;

FundingType is:

  • FundingWithPreviousSpot: (cashflow at day t+1) = f_t+1 - f_t - fr_t * (f_t - x_t) - i_diff_t * x_t;
  • FundingWithCurrentSpot: (cashflow at day t+1) = f_t+1 - f_t - fr_t * x_t+1 * (f_t - x_t)/x_t - i_diff_t * x_t+1; where x_t, f_t, fr_t and i_diff_t are a spot and a future price, a funding rate, an interest rate differential at t.

fundingFrequency:

  • 0 length: Continuous
  • otherwise: Discrete

For more details, refer to Perpetual Futures Pricing, Damien Ackerer, Julien Hugonnier, Urban Jermann, 2024 https://finance.wharton.upenn.edu/~jermann/AHJ-main-10.pdf

Member Function Documentation

◆ isExpired()

bool isExpired ( ) const
overridevirtual

returns whether the instrument might have value greater than zero.

Implements Instrument.

◆ setupArguments()

void setupArguments ( PricingEngine::arguments * ) const
overridevirtual

When a derived argument structure is defined for an instrument, this method should be overridden to fill it. This is mandatory in case a pricing engine is used.

Reimplemented from Instrument.