diff options
author | Alexander Wilms <f.alexander.wilms@gmail.com> | 2014-02-25 20:03:56 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-02-26 08:43:20 -0600 |
commit | ca884aab652b2eba6e05e7fae0f2d2d9a8dae5db (patch) | |
tree | acaafe5a201c952ab49530c45929e772f8560b0e /scaddins/source/pricing | |
parent | 2e9f7694b4c02e7dd592890d87b4710b45ce588b (diff) |
Remove visual noise from scaddins
Change-Id: I533b172ae62b6a2056109c0e6cf854ec89de8391
Reviewed-on: https://gerrit.libreoffice.org/8302
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'scaddins/source/pricing')
-rw-r--r-- | scaddins/source/pricing/black_scholes.cxx | 26 | ||||
-rw-r--r-- | scaddins/source/pricing/black_scholes.hxx | 2 | ||||
-rw-r--r-- | scaddins/source/pricing/pricing.cxx | 2 | ||||
-rw-r--r-- | scaddins/source/pricing/pricing.hxx | 38 |
4 files changed, 34 insertions, 34 deletions
diff --git a/scaddins/source/pricing/black_scholes.cxx b/scaddins/source/pricing/black_scholes.cxx index cf5087cf6a3b..c6d989f541c7 100644 --- a/scaddins/source/pricing/black_scholes.cxx +++ b/scaddins/source/pricing/black_scholes.cxx @@ -20,21 +20,21 @@ // options prices and greeks in the Black-Scholes model // also known as TV (theoretical value) -// + // the code is structured as follows: -// + // (1) basic assets // - cash-or-nothing option: bincash() // - asset-or-nothing option: binasset() -// + // (2) derived basic assets, can all be priced based on (1) // - vanilla put/call: putcall() = +/- ( binasset() - K*bincash() ) // - truncated put/call (barriers active at maturity only) -// + // (3) write a wrapper function to include all vanilla pricers // - this is so we don't duplicate code when pricing barriers // as this is derived from vanillas -// + // (4) single barrier options (knock-out), priced based on truncated vanillas // - it follows from the reflection principle that the price W(S) of a // single barrier option is given by @@ -44,28 +44,28 @@ // - to reduce code duplication and in anticipation of double barrier // options we write the following function // barrier_term(S,c) = V(c*S) - (B/S)^a V(c*B^2/S) -// + // (5) double barrier options (knock-out) // - value is an infinite sum over option prices of the corresponding // truncated vanillas (truncated at both barriers): -// + // W(S)=sum (B2/B1)^(i*a) (V(S(B2/B1)^(2i)) - (B1/S)^a V(B1^2/S (B2/B1)^(2i)) -// + // (6) write routines for put/call barriers and touch options which // mainly call the general double barrier pricer // the main routines are touch() and barrier() // both can price in/out barriers, double/single barriers as well as // vanillas -// -// + + // the framework allows any barriers to be priced as long as we define // the value/greek functions for the corresponding truncated vanilla // and wrap them into internal::vanilla() and internal::vanilla_trunc() -// + // disadvantage of that approach is that due to the rules of // differentiations the formulas for greeks become long and possible // simplifications in the formulas won't be made -// + // other code inefficiency due to multiplication with pm (+/- 1) // cvtsi2sd: int-->double, 6/3 cycles // mulsd: double-double multiplication, 5/1 cycles @@ -73,7 +73,7 @@ // which are efficient // note this is tiny anyway as compared to exp/log (100 cycles), // pow (200 cycles), erf (70 cycles) -// + // this code is not tested for numerical instability, ie overruns, // underruns, accuracy, etc diff --git a/scaddins/source/pricing/black_scholes.hxx b/scaddins/source/pricing/black_scholes.hxx index 5e665c535471..ae243950b854 100644 --- a/scaddins/source/pricing/black_scholes.hxx +++ b/scaddins/source/pricing/black_scholes.hxx @@ -24,7 +24,7 @@ namespace bs { namespace types { enum Greeks { - Value = 0, // + Value = 0, Delta = 1, // d/dS Gamma = 2, // d^2/dS^2 Theta = 3, // d/dt diff --git a/scaddins/source/pricing/pricing.cxx b/scaddins/source/pricing/pricing.cxx index 24c66092d76f..b079942e7213 100644 --- a/scaddins/source/pricing/pricing.cxx +++ b/scaddins/source/pricing/pricing.cxx @@ -18,7 +18,7 @@ */ // pricing functions add in -// + // all of the UNO add-in technical details have been copied from // ../datefunc/datefunc.cxx diff --git a/scaddins/source/pricing/pricing.hxx b/scaddins/source/pricing/pricing.hxx index 7a5673efa8cc..5f9a066f172f 100644 --- a/scaddins/source/pricing/pricing.hxx +++ b/scaddins/source/pricing/pricing.hxx @@ -17,16 +17,16 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -//------------------------------------------------------------------ -// + + // option pricing functions add in -// + // most parts of this files are technical UNO details which are // all copied from ../datefunc/datefunc.hxx // to avoid having to rename all classes to do with UNO // technicalities we use our own namespace -// -//------------------------------------------------------------------ + + #ifndef _SCA_PRICING_HXX #define _SCA_PRICING_HXX @@ -47,7 +47,7 @@ -//------------------------------------------------------------------ + namespace sca { namespace pricing { @@ -95,7 +95,7 @@ inline void ScaList::Append( void* pNew ) } -//------------------------------------------------------------------ + class ScaStringList : protected ScaList { @@ -142,7 +142,7 @@ inline void ScaStringList::Append( const OUString& rNew ) } -//------------------------------------------------------------------ + class ScaResId : public ResId { @@ -151,7 +151,7 @@ public: }; -//------------------------------------------------------------------ + class ScaResStringLoader : public Resource { @@ -174,7 +174,7 @@ inline ScaResStringLoader::ScaResStringLoader( sal_uInt16 nResId, sal_uInt16 nSt } -//------------------------------------------------------------------ + class ScaResStringArrLoader : public Resource { @@ -197,7 +197,7 @@ inline ScaResStringArrLoader::ScaResStringArrLoader( sal_uInt16 nResId, sal_uInt } -//------------------------------------------------------------------ + class ScaResPublisher : public Resource { @@ -211,7 +211,7 @@ public: }; -//------------------------------------------------------------------ + class ScaFuncRes : public Resource { @@ -220,7 +220,7 @@ public: }; -//------------------------------------------------------------------ + enum ScaCategory { @@ -276,7 +276,7 @@ public: }; -//------------------------------------------------------------------ + class ScaFuncDataList : private ScaList { @@ -319,8 +319,8 @@ inline ScaFuncData* ScaFuncDataList::Next() -//------------------------------------------------------------------ -//------------------------------------------------------------------ + + css::uno::Reference< css::uno::XInterface > SAL_CALL PricingFunctionAddIn_CreateInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& ); @@ -381,9 +381,9 @@ public: virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw( css::uno::RuntimeException ); virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException ); - // ---------------------------------------- + // methods from own interfaces start here - // ---------------------------------------- + virtual double SAL_CALL getOptBarrier( double spot, double vol, double r, double rf, double T, double strike, @@ -407,7 +407,7 @@ public: const css::uno::Any& strikeval, const css::uno::Any& put_call ) throw( css::uno::RuntimeException, css::lang::IllegalArgumentException ); }; -//------------------------------------------------------------------ + #endif |