hquantlib 0.0.2.5 → 0.0.3.0
raw patch · 5 files changed
+77/−79 lines, 5 filesdep ~QuickCheckdep ~hmatrixdep ~hmatrix-gslPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: QuickCheck, hmatrix, hmatrix-gsl, hmatrix-special, vector, vector-algorithms
API changes (from Hackage documentation)
- QuantLib.Event: cDate :: Callability -> Date
- QuantLib.Event: cPrice :: Callability -> CallPrice
- QuantLib.Event: cfAmount :: CashFlow -> Double
- QuantLib.Event: cfDate :: CashFlow -> Date
- QuantLib.Event: instance Eq Callability
- QuantLib.Event: instance Eq CashFlow
- QuantLib.Event: instance Event Callability
- QuantLib.Event: instance Event CashFlow
- QuantLib.Event: instance Ord Callability
- QuantLib.Event: instance Ord CashFlow
- QuantLib.Event: instance Show Callability
- QuantLib.Event: instance Show CashFlow
- QuantLib.Instruments: sDate :: Stock -> LocalTime
- QuantLib.Instruments: sQuote :: Stock -> Double
- QuantLib.Math.Copulas: instance Copula Copulas
- QuantLib.Methods.MonteCarlo: instance (StochasticProcess sp, NormalGenerator b, Discretize d) => PathGenerator (ProcessGenerator sp b d)
- QuantLib.Methods.MonteCarlo: instance PathPricer LastPointPricer
- QuantLib.Methods.MonteCarlo: pgDiscretize :: ProcessGenerator sp b d -> d
- QuantLib.Methods.MonteCarlo: pgGenerator :: ProcessGenerator sp b d -> b
- QuantLib.Methods.MonteCarlo: pgLength :: ProcessGenerator sp b d -> Int
- QuantLib.Methods.MonteCarlo: pgProcess :: ProcessGenerator sp b d -> sp
- QuantLib.Methods.MonteCarlo: pgStart :: ProcessGenerator sp b d -> Dot
- QuantLib.Methods.MonteCarlo: pmcGenerator :: PathMonteCarlo s p g -> g
- QuantLib.Methods.MonteCarlo: pmcPricer :: PathMonteCarlo s p g -> p
- QuantLib.Methods.MonteCarlo: pmcSummary :: PathMonteCarlo s p g -> s
- QuantLib.Models.Volatility: instance Enum VolatilityEstimatorAlgorithm
- QuantLib.Models.Volatility: instance Eq Estimation
- QuantLib.Models.Volatility: instance Eq VolatilityEstimatorAlgorithm
- QuantLib.Models.Volatility: instance Show Estimation
- QuantLib.Models.Volatility: instance Show VolatilityEstimatorAlgorithm
- QuantLib.Models.Volatility: instance VolatilityEstimator VolatilityEstimatorAlgorithm
- QuantLib.Money: instance Eq Money
- QuantLib.Money: instance Num Money
- QuantLib.Money: instance Show Money
- QuantLib.Money: mCurrency :: Money -> Currency
- QuantLib.Money: mValue :: Money -> Double
- QuantLib.Options: instance Eq OptionType
- QuantLib.Options: instance Show OptionType
- QuantLib.Position: instance Eq Position
- QuantLib.Position: instance Show Position
- QuantLib.Prices: cpPrice :: CallPrice -> Double
- QuantLib.Prices: instance Eq CallPrice
- QuantLib.Prices: instance Eq IntervalPrice
- QuantLib.Prices: instance Eq PriceType
- QuantLib.Prices: instance Ord CallPrice
- QuantLib.Prices: instance Show CallPrice
- QuantLib.Prices: instance Show IntervalPrice
- QuantLib.Prices: instance Show PriceType
- QuantLib.Prices: ipClose :: IntervalPrice -> Double
- QuantLib.Prices: ipHigh :: IntervalPrice -> Double
- QuantLib.Prices: ipLow :: IntervalPrice -> Double
- QuantLib.Prices: ipOpen :: IntervalPrice -> Double
- QuantLib.Quotes: cqComposite :: CompositeQuote a -> a -> a -> Maybe Double
- QuantLib.Quotes: cqQuote1 :: CompositeQuote a -> a
- QuantLib.Quotes: cqQuote2 :: CompositeQuote a -> a
- QuantLib.Quotes: dqDerivateFunc :: DerivedQuote a -> a -> Maybe Double
- QuantLib.Quotes: dqQuote :: DerivedQuote a -> a
- QuantLib.Quotes: efqCallPrice :: EurodollarFutureQuote a -> a
- QuantLib.Quotes: efqForward :: EurodollarFutureQuote a -> a
- QuantLib.Quotes: efqGuess :: EurodollarFutureQuote a -> Maybe Double
- QuantLib.Quotes: efqPutPrice :: EurodollarFutureQuote a -> a
- QuantLib.Quotes: efqStrike :: EurodollarFutureQuote a -> Double
- QuantLib.Quotes: instance Eq SimpleQuote
- QuantLib.Quotes: instance Quote (CompositeQuote a)
- QuantLib.Quotes: instance Quote (DerivedQuote a)
- QuantLib.Quotes: instance Quote SimpleQuote
- QuantLib.Quotes: instance Quote a => Quote (EurodollarFutureQuote a)
- QuantLib.Quotes: instance Quote a => Quote (ImpliedStdDevQuote a)
- QuantLib.Quotes: instance Show SimpleQuote
- QuantLib.Quotes: instance Show a => Show (EurodollarFutureQuote a)
- QuantLib.Quotes: instance Show a => Show (ImpliedStdDevQuote a)
- QuantLib.Quotes: isdqForward :: ImpliedStdDevQuote a -> a
- QuantLib.Quotes: isdqGuess :: ImpliedStdDevQuote a -> Maybe Double
- QuantLib.Quotes: isdqOptionType :: ImpliedStdDevQuote a -> OptionType
- QuantLib.Quotes: isdqPrice :: ImpliedStdDevQuote a -> a
- QuantLib.Quotes: isdqStrike :: ImpliedStdDevQuote a -> Double
+ QuantLib.Event: [cDate] :: Callability -> Date
+ QuantLib.Event: [cPrice] :: Callability -> CallPrice
+ QuantLib.Event: [cfAmount] :: CashFlow -> Double
+ QuantLib.Event: [cfDate] :: CashFlow -> Date
+ QuantLib.Event: instance GHC.Classes.Eq QuantLib.Event.Callability
+ QuantLib.Event: instance GHC.Classes.Eq QuantLib.Event.CashFlow
+ QuantLib.Event: instance GHC.Classes.Ord QuantLib.Event.Callability
+ QuantLib.Event: instance GHC.Classes.Ord QuantLib.Event.CashFlow
+ QuantLib.Event: instance GHC.Show.Show QuantLib.Event.Callability
+ QuantLib.Event: instance GHC.Show.Show QuantLib.Event.CashFlow
+ QuantLib.Event: instance QuantLib.Event.Event QuantLib.Event.Callability
+ QuantLib.Event: instance QuantLib.Event.Event QuantLib.Event.CashFlow
+ QuantLib.Instruments: [sDate] :: Stock -> LocalTime
+ QuantLib.Instruments: [sQuote] :: Stock -> Double
+ QuantLib.Math.Copulas: copula :: Copula a => a -> Double -> Double -> Maybe Double
+ QuantLib.Math.Copulas: copulaFunc :: Copula a => a -> Double -> Double -> Maybe Double
+ QuantLib.Math.Copulas: instance QuantLib.Math.Copulas.Copula QuantLib.Math.Copulas.Copulas
+ QuantLib.Methods.MonteCarlo: [pgDiscretize] :: ProcessGenerator sp b d -> d
+ QuantLib.Methods.MonteCarlo: [pgGenerator] :: ProcessGenerator sp b d -> b
+ QuantLib.Methods.MonteCarlo: [pgLength] :: ProcessGenerator sp b d -> Int
+ QuantLib.Methods.MonteCarlo: [pgProcess] :: ProcessGenerator sp b d -> sp
+ QuantLib.Methods.MonteCarlo: [pgStart] :: ProcessGenerator sp b d -> Dot
+ QuantLib.Methods.MonteCarlo: [pmcGenerator] :: PathMonteCarlo s p g -> g
+ QuantLib.Methods.MonteCarlo: [pmcPricer] :: PathMonteCarlo s p g -> p
+ QuantLib.Methods.MonteCarlo: [pmcSummary] :: PathMonteCarlo s p g -> s
+ QuantLib.Methods.MonteCarlo: instance (QuantLib.Stochastic.Process.StochasticProcess sp, QuantLib.Stochastic.Random.NormalGenerator b, QuantLib.Stochastic.Process.Discretize d) => QuantLib.Methods.MonteCarlo.PathGenerator (QuantLib.Methods.MonteCarlo.ProcessGenerator sp b d)
+ QuantLib.Methods.MonteCarlo: instance QuantLib.Methods.MonteCarlo.PathPricer QuantLib.Methods.MonteCarlo.LastPointPricer
+ QuantLib.Models.Volatility: instance GHC.Classes.Eq QuantLib.Models.Volatility.Estimation
+ QuantLib.Models.Volatility: instance GHC.Classes.Eq QuantLib.Models.Volatility.VolatilityEstimatorAlgorithm
+ QuantLib.Models.Volatility: instance GHC.Enum.Enum QuantLib.Models.Volatility.VolatilityEstimatorAlgorithm
+ QuantLib.Models.Volatility: instance GHC.Show.Show QuantLib.Models.Volatility.Estimation
+ QuantLib.Models.Volatility: instance GHC.Show.Show QuantLib.Models.Volatility.VolatilityEstimatorAlgorithm
+ QuantLib.Models.Volatility: instance QuantLib.Models.Volatility.VolatilityEstimator QuantLib.Models.Volatility.VolatilityEstimatorAlgorithm
+ QuantLib.Money: [mCurrency] :: Money -> Currency
+ QuantLib.Money: [mValue] :: Money -> Double
+ QuantLib.Money: instance GHC.Classes.Eq QuantLib.Money.Money
+ QuantLib.Money: instance GHC.Num.Num QuantLib.Money.Money
+ QuantLib.Money: instance GHC.Show.Show QuantLib.Money.Money
+ QuantLib.Options: instance GHC.Classes.Eq QuantLib.Options.OptionType
+ QuantLib.Options: instance GHC.Show.Show QuantLib.Options.OptionType
+ QuantLib.Position: instance GHC.Classes.Eq QuantLib.Position.Position
+ QuantLib.Position: instance GHC.Show.Show QuantLib.Position.Position
+ QuantLib.Prices: [cpPrice] :: CallPrice -> Double
+ QuantLib.Prices: [ipClose] :: IntervalPrice -> Double
+ QuantLib.Prices: [ipHigh] :: IntervalPrice -> Double
+ QuantLib.Prices: [ipLow] :: IntervalPrice -> Double
+ QuantLib.Prices: [ipOpen] :: IntervalPrice -> Double
+ QuantLib.Prices: instance GHC.Classes.Eq QuantLib.Prices.CallPrice
+ QuantLib.Prices: instance GHC.Classes.Eq QuantLib.Prices.IntervalPrice
+ QuantLib.Prices: instance GHC.Classes.Eq QuantLib.Prices.PriceType
+ QuantLib.Prices: instance GHC.Classes.Ord QuantLib.Prices.CallPrice
+ QuantLib.Prices: instance GHC.Show.Show QuantLib.Prices.CallPrice
+ QuantLib.Prices: instance GHC.Show.Show QuantLib.Prices.IntervalPrice
+ QuantLib.Prices: instance GHC.Show.Show QuantLib.Prices.PriceType
+ QuantLib.Quotes: [cqComposite] :: CompositeQuote a -> a -> a -> Maybe Double
+ QuantLib.Quotes: [cqQuote1] :: CompositeQuote a -> a
+ QuantLib.Quotes: [cqQuote2] :: CompositeQuote a -> a
+ QuantLib.Quotes: [dqDerivateFunc] :: DerivedQuote a -> a -> Maybe Double
+ QuantLib.Quotes: [dqQuote] :: DerivedQuote a -> a
+ QuantLib.Quotes: [efqCallPrice] :: EurodollarFutureQuote a -> a
+ QuantLib.Quotes: [efqForward] :: EurodollarFutureQuote a -> a
+ QuantLib.Quotes: [efqGuess] :: EurodollarFutureQuote a -> Maybe Double
+ QuantLib.Quotes: [efqPutPrice] :: EurodollarFutureQuote a -> a
+ QuantLib.Quotes: [efqStrike] :: EurodollarFutureQuote a -> Double
+ QuantLib.Quotes: [isdqForward] :: ImpliedStdDevQuote a -> a
+ QuantLib.Quotes: [isdqGuess] :: ImpliedStdDevQuote a -> Maybe Double
+ QuantLib.Quotes: [isdqOptionType] :: ImpliedStdDevQuote a -> OptionType
+ QuantLib.Quotes: [isdqPrice] :: ImpliedStdDevQuote a -> a
+ QuantLib.Quotes: [isdqStrike] :: ImpliedStdDevQuote a -> Double
+ QuantLib.Quotes: instance GHC.Classes.Eq QuantLib.Quotes.SimpleQuote
+ QuantLib.Quotes: instance GHC.Show.Show QuantLib.Quotes.SimpleQuote
+ QuantLib.Quotes: instance GHC.Show.Show a => GHC.Show.Show (QuantLib.Quotes.EurodollarFutureQuote a)
+ QuantLib.Quotes: instance GHC.Show.Show a => GHC.Show.Show (QuantLib.Quotes.ImpliedStdDevQuote a)
+ QuantLib.Quotes: instance QuantLib.Quotes.Quote (QuantLib.Quotes.CompositeQuote a)
+ QuantLib.Quotes: instance QuantLib.Quotes.Quote (QuantLib.Quotes.DerivedQuote a)
+ QuantLib.Quotes: instance QuantLib.Quotes.Quote QuantLib.Quotes.SimpleQuote
+ QuantLib.Quotes: instance QuantLib.Quotes.Quote a => QuantLib.Quotes.Quote (QuantLib.Quotes.EurodollarFutureQuote a)
+ QuantLib.Quotes: instance QuantLib.Quotes.Quote a => QuantLib.Quotes.Quote (QuantLib.Quotes.ImpliedStdDevQuote a)
- QuantLib.Methods.MonteCarlo: monteCarlo :: (Summary s p, PathPricer p, PathGenerator g) => PathMonteCarlo s p g -> Int -> IO s
+ QuantLib.Methods.MonteCarlo: monteCarlo :: (Summary s p, PathGenerator g) => PathMonteCarlo s p g -> Int -> IO s
- QuantLib.Methods.MonteCarlo: monteCarloParallel :: (Summary s p, PathPricer p, PathGenerator g) => PathMonteCarlo s p g -> Int -> IO s
+ QuantLib.Methods.MonteCarlo: monteCarloParallel :: (Summary s p, PathGenerator g) => PathMonteCarlo s p g -> Int -> IO s
Files
- hquantlib.cabal +10/−11
- src/QuantLib/Event.hs +13/−13
- src/QuantLib/Math/Copulas.hs +11/−11
- src/QuantLib/Methods/MonteCarlo.hs +21/−20
- src/QuantLib/Stochastic/Process.hs +22/−24
hquantlib.cabal view
@@ -1,5 +1,5 @@ name: hquantlib-version: 0.0.2.5+version: 0.0.3.0 license: LGPL license-file: LICENSE author: Pavel Ryzhov@@ -48,7 +48,7 @@ QuantLib.Position QuantLib.Options QuantLib.Methods.MonteCarlo- + other-modules: QuantLib.Currencies.America QuantLib.Currencies.Europe@@ -61,19 +61,19 @@ QuantLib.Time.Date QuantLib.Time.DayCounter QuantLib.Math.InverseNormal- - build-depends: ++ build-depends: base >3 && <5, time >= 1.4.0.0 && < 1.7.0.0, containers >= 0.5.0.0 && < 0.6.0.0,- hmatrix >= 0.16.0.0 && < 0.17.0.0,- hmatrix-gsl >= 0.16.0.0 && < 0.17.0.0,- hmatrix-special >= 0.3.0 && < 0.4.0,+ hmatrix >= 0.17.0.0 && < 0.18.0.0,+ hmatrix-gsl >= 0.17.0.0 && < 0.18.0.0,+ hmatrix-special >= 0.4.0 && < 0.5.0, parallel >= 3.2.0.0 && < 3.3.0.0, mersenne-random >= 1.0.0.1 && < 2.0.0.0, statistics >= 0.13.0.0 && < 0.14.0.0,- vector >= 0.10.0.0 && < 0.11.0.0,- vector-algorithms >= 0.6.0.0 && < 0.7.0.0+ vector >= 0.11.0.0 && < 0.12.0.0,+ vector-algorithms >= 0.7.0.0 && < 0.8.0.0 hs-source-dirs: src ghc-options: -Wall@@ -89,6 +89,5 @@ test-framework >= 0.8 && < 0.9, test-framework-hunit >= 0.3.0 && < 0.4.0, test-framework-quickcheck2 >= 0.3.0.0 && < 0.4.0,- QuickCheck >= 2.5.0 && < 2.6.0,+ QuickCheck >= 2.8.0 && < 2.9.0, HUnit >= 1.2.5.2 && < 2.0.0.0-
src/QuantLib/Event.hs view
@@ -2,8 +2,8 @@ (module QuantLib.Event ) where -import QuantLib.Prices-import QuantLib.Time.Date+import QuantLib.Prices+import QuantLib.Time.Date class Event a where evDate :: a->Date@@ -14,18 +14,18 @@ evOccuredInclude event date = evDate event <= date evCompare :: a->a->Ordering- evCompare x y - | evDate x == evDate y = EQ- | evDate x <= evDate y = LT- | otherwise = GT+ evCompare x y+ | evDate x == evDate y = EQ+ | evDate x <= evDate y = LT+ | otherwise = GT evEqual :: a->a->Bool evEqual x y = evDate x == evDate y -- | Cash flows data type data CashFlow = CashFlow {- cfDate :: Date,- cfAmount :: Double+ cfDate :: Date,+ cfAmount :: Double } deriving (Show) instance Event CashFlow where@@ -40,12 +40,12 @@ -- | Sequence of cash-flows type Leg = [CashFlow] -data Callability = Call { - cPrice :: CallPrice,- cDate :: Date+data Callability = Call {+ cPrice :: CallPrice,+ cDate :: Date } | Put {- cPrice :: CallPrice,- cDate :: Date+ cPrice :: CallPrice,+ cDate :: Date } deriving (Show) instance Event Callability where
src/QuantLib/Math/Copulas.hs view
@@ -1,9 +1,9 @@ module QuantLib.Math.Copulas- ( Copula,- Copulas (..) + ( Copula (..),+ Copulas (..) ) where -{-| Copula type class. +{-| Copula type class. -| Normally instance should implement only copulaFunc. -| Method copula provides a precheck for [0..1] range for x and y but real implementation is in copulaFunc -}@@ -47,7 +47,7 @@ copulaFunc (GalambosCopula theta) = galambosCopula theta copulaFunc (GaussianCopula rho) = gaussianCopula rho copulaFunc (GumbelCopula theta) = gumbelCopula theta- copulaFunc (HuslerReissCopula theta) = huslerReissCopula theta + copulaFunc (HuslerReissCopula theta) = huslerReissCopula theta copulaFunc IndependentCopula = independentCopula copulaFunc (MarshallOlkinCopula a b) = marshallOlkinCopula a b copulaFunc (PlackettCopula theta) = plackettCopula theta@@ -69,17 +69,17 @@ = Nothing {-| Original code and algorithm from the Quantlib project- implemented in Haskell by Nicholas Pezolano + implemented in Haskell by Nicholas Pezolano npezolano "at" gmail.com -} claytonCopula :: Double -> Double -> Double -> Maybe Double claytonCopula theta x y- | theta ==0 - || theta < -1.0- = Nothing+ | theta ==0+ || theta < -1.0+ = Nothing - | otherwise - = Just $ max( (x ** (-theta) ) + (y ** (-theta)-1.0) ** (-1.0/theta)) 0+ | otherwise+ = Just $ max( (x ** (-theta) ) + (y ** (-theta)-1.0) ** (-1.0/theta)) 0 minCopula :: Ord a => a -> a -> Maybe a minCopula x y = Just (min x y)@@ -91,7 +91,7 @@ frankCopula theta x y | theta == 0.0 = Nothing | otherwise = Just (-1.0/theta * log (1 + (exp (-theta*x) - 1.0) * (exp (-theta*y) -1.0) / (exp (-theta) - 1.0) ))- + galambosCopula :: (Floating a, Ord a) => a -> a -> a -> Maybe a galambosCopula theta x y | theta <= 0.0 = Nothing
src/QuantLib/Methods/MonteCarlo.hs view
@@ -1,12 +1,14 @@-{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, BangPatterns #-}+{-# LANGUAGE BangPatterns #-}+{-# LANGUAGE FunctionalDependencies #-}+{-# LANGUAGE MultiParamTypeClasses #-} module QuantLib.Methods.MonteCarlo ( module QuantLib.Methods.MonteCarlo ) where -import Control.Monad()-import Control.Parallel.Strategies-import QuantLib.Stochastic.Process-import QuantLib.Stochastic.Random+import Control.Monad ()+import Control.Parallel.Strategies+import QuantLib.Stochastic.Process+import QuantLib.Stochastic.Random -- | Summary type class aggregates all priced values of paths class PathPricer p => Summary m p | m->p where@@ -26,18 +28,18 @@ -- | Monte Carlo engine function-monteCarlo :: (Summary s p, PathPricer p, PathGenerator g) => PathMonteCarlo s p g->Int->IO s+monteCarlo :: (Summary s p, PathGenerator g) => PathMonteCarlo s p g->Int->IO s monteCarlo (PathMonteCarlo s p g) size = do- priced <- mapM (\_ -> pricing) [1..size]+ priced <- mapM (const pricing) [1..size] return $ sSummarize s priced where pricing = do !path <- pgGenerate g return $! ppPrice p path -- | Monte Carlo engine function. Parallelized version-monteCarloParallel :: (Summary s p, PathPricer p, PathGenerator g) => PathMonteCarlo s p g->Int->IO s+monteCarloParallel :: (Summary s p, PathGenerator g) => PathMonteCarlo s p g->Int->IO s monteCarloParallel (PathMonteCarlo s p g) size = do- priced <- mapM (\_ -> pricing) [1..size] `using` rpar+ priced <- mapM (const pricing) [1..size] `using` rpar return $ sSummarize s priced where pricing = do !path <- pgGenerate g@@ -46,25 +48,25 @@ -- | Path-dependant Monte Carlo engine data PathMonteCarlo s p g = PathMonteCarlo {- pmcSummary :: s,- pmcPricer :: p,- pmcGenerator :: g+ pmcSummary :: s,+ pmcPricer :: p,+ pmcGenerator :: g } -- | This pricer gets the last point of path data LastPointPricer = LastPointPricer Dot instance PathPricer LastPointPricer where- ppPrice _ path = LastPointPricer (last path) + ppPrice _ path = LastPointPricer (last path) -- | Stochastic process generator-data ProcessGenerator sp b d = +data ProcessGenerator sp b d = ProcessGenerator {- pgStart :: Dot,- pgLength :: Int,- pgProcess :: sp,- pgGenerator :: b,- pgDiscretize :: d+ pgStart :: Dot,+ pgLength :: Int,+ pgProcess :: sp,+ pgGenerator :: b,+ pgDiscretize :: d } instance (StochasticProcess sp, NormalGenerator b, Discretize d) => PathGenerator (ProcessGenerator sp b d) where@@ -72,4 +74,3 @@ newRnd <- ngMkNew rnd return $! ProcessGenerator start len process newRnd d pgGenerate (ProcessGenerator start len sp b d) = generatePath b d sp len start-
src/QuantLib/Stochastic/Process.hs view
@@ -3,9 +3,9 @@ ( module QuantLib.Stochastic.Process ) where -import Control.Monad (foldM)-import Data.List (foldl')-import QuantLib.Stochastic.Random (NormalGenerator (..))+import Control.Monad (foldM)+import Data.List (foldl')+import QuantLib.Stochastic.Random (NormalGenerator (..)) -- | Discretization of stochastic process over given interval class Discretize b where@@ -21,7 +21,7 @@ evolve discr p dot dw = Dot newT newX where !newT = getT dot + dDt p discr dot !newX = getX dot + dDrift p discr dot + dDiff p discr dot * dw- + -- | Dot. t and x pair data Dot = Dot { getT :: {-# UNPACK #-} !Double, getX :: {-# UNPACK #-} !Double } deriving (Show, Eq)@@ -42,9 +42,9 @@ -- | Geometric Brownian motion-data GeometricBrownian = GeometricBrownian { - gbDrift :: Double, - gbDiff :: Double +data GeometricBrownian = GeometricBrownian {+ gbDrift :: Double,+ gbDiff :: Double } deriving (Show) instance StochasticProcess GeometricBrownian where@@ -52,9 +52,9 @@ diff p (Dot _ x) = gbDiff p * x -- | Ito process-data ItoProcess = ItoProcess { - ipDrift :: Dot->Double, - ipDiff :: Dot->Double +data ItoProcess = ItoProcess {+ ipDrift :: Dot->Double,+ ipDiff :: Dot->Double } instance StochasticProcess ItoProcess where@@ -62,10 +62,10 @@ diff = ipDiff -- | Square-root process-data SquareRootProcess = SquareRootProcess { - srpSpeed :: Double, - srpMean :: Double,- srpSigma :: Double+data SquareRootProcess = SquareRootProcess {+ srpSpeed :: Double,+ srpMean :: Double,+ srpSigma :: Double } deriving (Show) instance StochasticProcess SquareRootProcess where@@ -74,9 +74,9 @@ -- | Ornstein-Uhlenbeck process data OrnsteinUhlenbeckProcess = OrnsteinUhlenbeckProcess {- oupSpeed :: Double,- oupLevel :: Double,- oupSigma :: Double+ oupSpeed :: Double,+ oupLevel :: Double,+ oupSigma :: Double } deriving (Show) instance StochasticProcess OrnsteinUhlenbeckProcess where@@ -85,13 +85,11 @@ -- | Generalized Black-Scholes process data BlackScholesProcess = BlackScholesProcess {- bspRiskFree :: Double->Double,- bspDividend :: Double->Double,- bspBlackVol :: Dot->Double+ bspRiskFree :: Double->Double,+ bspDividend :: Double->Double,+ bspBlackVol :: Dot->Double } instance StochasticProcess BlackScholesProcess where- drift (BlackScholesProcess r q v) dot = r (getT dot) - q ( getT dot) - 0.5 * v dot ** 2 - diff = bspBlackVol--+ drift (BlackScholesProcess r q v) dot = r (getT dot) - q ( getT dot) - 0.5 * v dot ** 2+ diff = bspBlackVol