diff --git a/scaddins/idl/com/sun/star/sheet/addin/XPricingFunctions.idl b/scaddins/idl/com/sun/star/sheet/addin/XPricingFunctions.idl index 495891a6dd93..1b0dab5a3a76 100644 --- a/scaddins/idl/com/sun/star/sheet/addin/XPricingFunctions.idl +++ b/scaddins/idl/com/sun/star/sheet/addin/XPricingFunctions.idl @@ -38,34 +38,36 @@ module addin */ interface XPricingFunctions : com::sun::star::uno::XInterface { - /// opt_barrier() - double getOpt_barrier( [in] double spot, [in] double vol, - [in] double r, [in] double rf, [in] double T, [in] double strike, - [in] double barrier_low, [in] double barrier_up, + /// OPT_BARRIER(), pricing of a barrier option. + double getOptBarrier( [in] double spot, [in] double vol, + [in] double rate, [in] double rateForeign, + [in] double maturity, [in] double strike, + [in] double barrierLow, [in] double barrierUp, [in] double rebate, - [in] string put_call, [in] string in_out, + [in] string putCall, [in] string inOut, [in] string continuous, [in] any greek ) raises( com::sun::star::lang::IllegalArgumentException ); - /// opt_touch() - double getOpt_touch( [in] double spot, [in] double vol, - [in] double r, [in] double rf, [in] double T, - [in] double barrier_low, [in] double barrier_up, - [in] string for_dom, [in] string in_out, + /// OPT_TOUCH(), pricing of a touch/no-touch option. + double getOptTouch( [in] double spot, [in] double vol, + [in] double rate, [in] double rateForeign, + [in] double maturity, + [in] double barrierLow, [in] double barrierUp, + [in] string foreignDomestic, [in] string inOut, [in] string continuous, [in] any greek ) raises( com::sun::star::lang::IllegalArgumentException ); - /// opt_prob_hit() - double getOpt_prob_hit( [in] double spot, [in] double vol, - [in] double mu, [in] double T, - [in] double barrier_low, [in] double barrier_up ) + /// OPT_PROB_HIT(), probability of hitting a barrier. + double getOptProbHit( [in] double spot, [in] double vol, + [in] double mu, [in] double maturity, + [in] double barrierLow, [in] double barrierUp ) raises( com::sun::star::lang::IllegalArgumentException ); - /// opt_prob_inmoney() - double getOpt_prob_inmoney( [in] double spot, [in] double vol, - [in] double mu, [in] double T, - [in] double barrier_low, [in] double barrier_up, - [in] any strike, [in] any put_call ) + /// OPT_PROB_INMONEY(), probability of ending up in-the-money. + double getOptProbInMoney( [in] double spot, [in] double vol, + [in] double mu, [in] double maturity, + [in] double barrierLow, [in] double barrierUp, + [in] any strike, [in] any putCall ) raises( com::sun::star::lang::IllegalArgumentException ); }; diff --git a/scaddins/source/pricing/pricing.cxx b/scaddins/source/pricing/pricing.cxx index ba4cb31a9e4d..cf657874f8db 100644 --- a/scaddins/source/pricing/pricing.cxx +++ b/scaddins/source/pricing/pricing.cxx @@ -110,10 +110,10 @@ ScaResId::ScaResId( sal_uInt16 nId, ResMgr& rResMgr ) : const ScaFuncDataBase pFuncDataArr[] = { - FUNCDATA( Opt_barrier, 13, ScaCat_Finance, UNIQUE, STDPAR), - FUNCDATA( Opt_touch, 11, ScaCat_Finance, UNIQUE, STDPAR), - FUNCDATA( Opt_prob_hit, 6, ScaCat_Finance, UNIQUE, STDPAR), - FUNCDATA( Opt_prob_inmoney, 8, ScaCat_Finance, UNIQUE, STDPAR) + FUNCDATA( OptBarrier, 13, ScaCat_Finance, UNIQUE, STDPAR), + FUNCDATA( OptTouch, 11, ScaCat_Finance, UNIQUE, STDPAR), + FUNCDATA( OptProbHit, 6, ScaCat_Finance, UNIQUE, STDPAR), + FUNCDATA( OptProbInMoney, 8, ScaCat_Finance, UNIQUE, STDPAR) }; #undef FUNCDATA @@ -645,7 +645,7 @@ bool getinput_greek(bs::types::Greeks& greek, const ANY& anyval) { // OPT_BARRIER(...) -double SAL_CALL ScaPricingAddIn::getOpt_barrier( double spot, double vol, +double SAL_CALL ScaPricingAddIn::getOptBarrier( double spot, double vol, double r, double rf, double T, double strike, double barrier_low, double barrier_up, double rebate, const STRING& put_call, const STRING& in_out, @@ -671,7 +671,7 @@ double SAL_CALL ScaPricingAddIn::getOpt_barrier( double spot, double vol, } // OPT_TOUCH(...) -double SAL_CALL ScaPricingAddIn::getOpt_touch( double spot, double vol, +double SAL_CALL ScaPricingAddIn::getOptTouch( double spot, double vol, double r, double rf, double T, double barrier_low, double barrier_up, const STRING& for_dom, const STRING& in_out, @@ -697,7 +697,7 @@ double SAL_CALL ScaPricingAddIn::getOpt_touch( double spot, double vol, } // OPT_PRB_HIT(...) -double SAL_CALL ScaPricingAddIn::getOpt_prob_hit( double spot, double vol, +double SAL_CALL ScaPricingAddIn::getOptProbHit( double spot, double vol, double mu, double T, double barrier_low, double barrier_up ) THROWDEF_RTE_IAE { @@ -711,13 +711,13 @@ double SAL_CALL ScaPricingAddIn::getOpt_prob_hit( double spot, double vol, RETURN_FINITE( fRet ); } -// OPT_PRB_INMONEY(...) -double SAL_CALL ScaPricingAddIn::getOpt_prob_inmoney( double spot, double vol, +// OPT_PROB_INMONEY(...) +double SAL_CALL ScaPricingAddIn::getOptProbInMoney( double spot, double vol, double mu, double T, double barrier_low, double barrier_up, const ANY& strikeval, const ANY& put_call ) THROWDEF_RTE_IAE { - bs::types::PutCall pc; + bs::types::PutCall pc=bs::types::Call; double K; // read and check input values diff --git a/scaddins/source/pricing/pricing.hrc b/scaddins/source/pricing/pricing.hrc index bf4df2183847..1f7cf3cfda0b 100644 --- a/scaddins/source/pricing/pricing.hrc +++ b/scaddins/source/pricing/pricing.hrc @@ -22,33 +22,33 @@ #define PRICING_RESOURCE_START 1000 -#define RID_PRICING_FUNCTION_DESCRIPTIONS PRICING_RESOURCE_START -#define RID_PRICING_FUNCTION_NAMES (PRICING_RESOURCE_START+1000) -#define RID_PRICING_DEFFUNCTION_NAMES (PRICING_RESOURCE_START+2000) +#define RID_PRICING_FUNCTION_DESCRIPTIONS PRICING_RESOURCE_START +#define RID_PRICING_FUNCTION_NAMES (PRICING_RESOURCE_START+1000) +#define RID_PRICING_DEFFUNCTION_NAMES (PRICING_RESOURCE_START+2000) -#define PRICING_FUNCDESC_START (RID_PRICING_FUNCTION_DESCRIPTIONS+1) +#define PRICING_FUNCDESC_START (RID_PRICING_FUNCTION_DESCRIPTIONS+1) -#define PRICING_FUNCDESC_Opt_barrier (PRICING_FUNCDESC_START) -#define PRICING_FUNCDESC_Opt_touch (PRICING_FUNCDESC_START+1) -#define PRICING_FUNCDESC_Opt_prob_hit (PRICING_FUNCDESC_START+2) -#define PRICING_FUNCDESC_Opt_prob_inmoney (PRICING_FUNCDESC_START+3) +#define PRICING_FUNCDESC_OptBarrier (PRICING_FUNCDESC_START) +#define PRICING_FUNCDESC_OptTouch (PRICING_FUNCDESC_START+1) +#define PRICING_FUNCDESC_OptProbHit (PRICING_FUNCDESC_START+2) +#define PRICING_FUNCDESC_OptProbInMoney (PRICING_FUNCDESC_START+3) -#define PRICING_FUNCNAME_START (RID_PRICING_FUNCTION_NAMES+1) +#define PRICING_FUNCNAME_START (RID_PRICING_FUNCTION_NAMES+1) -#define PRICING_FUNCNAME_Opt_barrier (PRICING_FUNCNAME_START) -#define PRICING_FUNCNAME_Opt_touch (PRICING_FUNCNAME_START+1) -#define PRICING_FUNCNAME_Opt_prob_hit (PRICING_FUNCNAME_START+2) -#define PRICING_FUNCNAME_Opt_prob_inmoney (PRICING_FUNCNAME_START+3) +#define PRICING_FUNCNAME_OptBarrier (PRICING_FUNCNAME_START) +#define PRICING_FUNCNAME_OptTouch (PRICING_FUNCNAME_START+1) +#define PRICING_FUNCNAME_OptProbHit (PRICING_FUNCNAME_START+2) +#define PRICING_FUNCNAME_OptProbInMoney (PRICING_FUNCNAME_START+3) #define PRICING_DEFFUNCNAME_START (RID_PRICING_DEFFUNCTION_NAMES+1) -#define PRICING_DEFFUNCNAME_Opt_barrier (PRICING_DEFFUNCNAME_START) -#define PRICING_DEFFUNCNAME_Opt_touch (PRICING_DEFFUNCNAME_START+1) -#define PRICING_DEFFUNCNAME_Opt_prob_hit (PRICING_DEFFUNCNAME_START+2) -#define PRICING_DEFFUNCNAME_Opt_prob_inmoney (PRICING_DEFFUNCNAME_START+3) +#define PRICING_DEFFUNCNAME_OptBarrier (PRICING_DEFFUNCNAME_START) +#define PRICING_DEFFUNCNAME_OptTouch (PRICING_DEFFUNCNAME_START+1) +#define PRICING_DEFFUNCNAME_OptProbHit (PRICING_DEFFUNCNAME_START+2) +#define PRICING_DEFFUNCNAME_OptProbInMoney (PRICING_DEFFUNCNAME_START+3) #endif diff --git a/scaddins/source/pricing/pricing.hxx b/scaddins/source/pricing/pricing.hxx index 66d2d26618b0..ca02f9c87bad 100644 --- a/scaddins/source/pricing/pricing.hxx +++ b/scaddins/source/pricing/pricing.hxx @@ -389,23 +389,23 @@ public: // methods from own interfaces start here // ---------------------------------------- - virtual double SAL_CALL getOpt_barrier( double spot, double vol, + virtual double SAL_CALL getOptBarrier( double spot, double vol, double r, double rf, double T, double strike, double barrier_low, double barrier_up, double rebate, const STRING& put_call, const STRING& in_out, const STRING& continuous, const ANY& greek ) THROWDEF_RTE_IAE; - virtual double SAL_CALL getOpt_touch( double spot, double vol, + virtual double SAL_CALL getOptTouch( double spot, double vol, double r, double rf, double T, double barrier_low, double barrier_up, const STRING& for_dom, const STRING& in_out, const STRING& barriercont, const ANY& greekstr ) THROWDEF_RTE_IAE; - virtual double SAL_CALL getOpt_prob_hit( double spot, double vol, + virtual double SAL_CALL getOptProbHit( double spot, double vol, double mu, double T, double barrier_low, double barrier_up ) THROWDEF_RTE_IAE; - virtual double SAL_CALL getOpt_prob_inmoney( double spot, double vol, + virtual double SAL_CALL getOptProbInMoney( double spot, double vol, double mu, double T, double barrier_low, double barrier_up, const ANY& strikeval, const ANY& put_call ) THROWDEF_RTE_IAE; diff --git a/scaddins/source/pricing/pricing.src b/scaddins/source/pricing/pricing.src index c85a5d59aec5..6aa1675925b2 100644 --- a/scaddins/source/pricing/pricing.src +++ b/scaddins/source/pricing/pricing.src @@ -23,7 +23,7 @@ // function and parameter description Resource RID_PRICING_FUNCTION_DESCRIPTIONS { - Resource PRICING_FUNCDESC_Opt_barrier + Resource PRICING_FUNCDESC_OptBarrier { String 1 // description { @@ -150,7 +150,7 @@ Resource RID_PRICING_FUNCTION_DESCRIPTIONS - Resource PRICING_FUNCDESC_Opt_touch + Resource PRICING_FUNCDESC_OptTouch { String 1 // description { @@ -258,7 +258,7 @@ Resource RID_PRICING_FUNCTION_DESCRIPTIONS }; - Resource PRICING_FUNCDESC_Opt_prob_hit + Resource PRICING_FUNCDESC_OptProbHit { String 1 // description { @@ -321,7 +321,7 @@ Resource RID_PRICING_FUNCTION_DESCRIPTIONS }; - Resource PRICING_FUNCDESC_Opt_prob_inmoney + Resource PRICING_FUNCDESC_OptProbInMoney { String 1 // description { @@ -410,19 +410,19 @@ Resource RID_PRICING_FUNCTION_DESCRIPTIONS // function names as accessible from cells Resource RID_PRICING_FUNCTION_NAMES { - String PRICING_FUNCNAME_Opt_barrier + String PRICING_FUNCNAME_OptBarrier { Text [ en-US ] = "OPT_BARRIER"; }; - String PRICING_FUNCNAME_Opt_touch + String PRICING_FUNCNAME_OptTouch { Text [ en-US ] = "OPT_TOUCH"; }; - String PRICING_FUNCNAME_Opt_prob_hit + String PRICING_FUNCNAME_OptProbHit { Text [ en-US ] = "OPT_PROB_HIT"; }; - String PRICING_FUNCNAME_Opt_prob_inmoney + String PRICING_FUNCNAME_OptProbInMoney { Text [ en-US ] = "OPT_PROB_INMONEY"; };