Login  Register

Swig Wrapers for DeltaVolQuote

Posted by DPaulino on Nov 26, 2015; 5:31pm
URL: http://quantlib.414.s1.nabble.com/Swig-Wrapers-for-DeltaVolQuote-tp17124.html

Could someone please help me with the Swig wrapers for the DeltaVolQuote class?

I tried (and failed):

%{
using QuantLib::DeltaVolQuote;
%}

%ignore DeltaVolQuote;
class DeltaVolQuote : public Quote {};

%template(DeltaVolQuote) boost::shared_ptr<DeltaVolQuote>;
IsObservable(boost::shared_ptr<DeltaVolQuote>);

%{
using QuantLib::DeltaVolQuote;
typedef boost::shared_ptr<DeltaVolQuote> DeltaVolQuotePtr;
%}

%rename(DeltaVolQuote) DeltaVolQuotePtr;
class DeltaVolQuotePtr : public boost::shared_ptr<Quote> {
        public:
                %extend {
                        DeltaVolQuotePtr(Real delta,
                                                 const Handle<Quote>& vol,
                                                 Time maturity,
                                                 DeltaVolQuote::DeltaType deltatype) {
                                        return new  public boost::shared_ptr<DeltaVolQuote>(
                                                new DeltaVolQuote(delta,
                                                                            vol,
                                                                            maturity,
                                                                            deltatype));
                                                                                }

                        DeltaVolQuotePtr(const Handle<Quote>& vol,
                                                         DeltaVolQuote::DeltaType deltatype,
                                                         Time maturity,
                                                         DeltaVolQuote::AtmType atmtype) {

                                        return new  public boost::shared_ptr<DeltaVolQuote>(
                                                new DeltaVolQuote(vol,
                                                                           deltatype,
                                                                           maturity,
                                                                           atmtype));
                                                                                                }
                }
};