Login  Register

QuantLib extension - creating a FedFunds derived class (equivalent of Eonia for USD)

Posted by Ioan F. on May 30, 2014; 8:52pm
URL: http://quantlib.414.s1.nabble.com/QuantLib-extension-creating-a-FedFunds-derived-class-equivalent-of-Eonia-for-USD-tp15344.html

Hello,

I want to duplicate the derived Eonia OvernightIndex class as a derived FedFunds OvernightIndex class directly by adding one header and one source file (see below) to the <ql/indexes/ibor> QuantLib sub-folder.
Additionally, I modified the Makefile.in file to include the two files when building the QuantLib solution (in Visual Studio 11).
I can (re)build the solution without any problems, but when I try to use the FedFunds class in Python (after adding to the indexes.i SWIG interface file in a manner similar to the one which allowed me to successfully expose the Sonia class for GBP), I get the error:

NameError: name 'FedFunds' is not defined

Please note that when the same code with Eonia (instead of FedFunds) works fine (although I need to join the US and European calendars).

Any help / suggestions appreciated.
Also, if the files below are any good, feel free to use them.

Thank you,
Ioan



fedfunds.hpp:



/*! \file fedfunds.hpp
    \brief %FedFunds index
*/

#ifndef quantlib_fedfunds_hpp
#define quantlib_fedfunds_hpp

#include <ql/indexes/iborindex.hpp>

namespace QuantLib {

    //! %Fed Funds (for balances held at the Federal Reserve) rate fixed by the FED.
    class FedFunds : public OvernightIndex {
      public:
        FedFunds(const Handle<YieldTermStructure>& h =
                                    Handle<YieldTermStructure>());
    };

}

#endif



fedfunds.cpp:



#include <ql/indexes/ibor/fedfunds.hpp>
#include <ql/time/calendars/unitedstates.hpp>
#include <ql/time/daycounters/actual365fixed.hpp>
#include <ql/currencies/america.hpp>

namespace QuantLib {

    FedFunds::FedFunds(const Handle<YieldTermStructure>& h)
                : OvernightIndex("FedFunds", 0,
                                                USDCurrency(),
                                                UnitedStates(UnitedStates::Settlement),
                                                Actual365Fixed(), h) {}

}