-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | HQuantLib is a port of essencial parts of QuantLib to Haskell
--
-- HQuantLib is intended to be a functional style port of QuantLib
-- (http:quantlib.org)
@package hquantlib
@version 0.0.2.0
module QuantLib.Options
data OptionType
Call :: OptionType
Put :: OptionType
toInt :: OptionType -> Int
toDouble :: OptionType -> Double
instance Show OptionType
instance Eq OptionType
module QuantLib.PricingEngines.BlackFormula
blackFormulaImpliedStdDev :: OptionType -> Double -> Double -> Double -> Double -> Double -> Maybe Double -> Double -> Int -> Maybe Double
module QuantLib.Quotes
-- | Base type class for market observables
class Quote a
qValue :: Quote a => a -> Maybe Double
pureValue :: Quote a => a -> Double
-- | Market element returning a stored value
data SimpleQuote
SimpleQuote :: (Maybe Double) -> SimpleQuote
-- | Market element whose value depends on two other market elements
data CompositeQuote a
CompositeQuote :: a -> a -> (a -> a -> Maybe Double) -> CompositeQuote a
-- | First element
cqQuote1 :: CompositeQuote a -> a
-- | Second element
cqQuote2 :: CompositeQuote a -> a
-- | Composition function
cqComposite :: CompositeQuote a -> a -> a -> Maybe Double
-- | Market element whose value depends on another quote
data DerivedQuote a
DerivedQuote :: a -> (a -> Maybe Double) -> DerivedQuote a
dqQuote :: DerivedQuote a -> a
dqDerivateFunc :: DerivedQuote a -> a -> Maybe Double
-- | Quote for the implied standard deviation of an underlying
data ImpliedStdDevQuote a
ImpliedStdDevQuote :: OptionType -> a -> a -> Double -> Maybe Double -> ImpliedStdDevQuote a
isdqOptionType :: ImpliedStdDevQuote a -> OptionType
isdqForward :: ImpliedStdDevQuote a -> a
isdqPrice :: ImpliedStdDevQuote a -> a
isdqStrike :: ImpliedStdDevQuote a -> Double
isdqGuess :: ImpliedStdDevQuote a -> Maybe Double
-- | Quote for the Eurodollar-future implied standard deviation
data EurodollarFutureQuote a
EurodollarFutureQuote :: a -> a -> a -> Double -> Maybe Double -> EurodollarFutureQuote a
efqForward :: EurodollarFutureQuote a -> a
efqCallPrice :: EurodollarFutureQuote a -> a
efqPutPrice :: EurodollarFutureQuote a -> a
efqStrike :: EurodollarFutureQuote a -> Double
efqGuess :: EurodollarFutureQuote a -> Maybe Double
instance Show SimpleQuote
instance Eq SimpleQuote
instance Show a => Show (ImpliedStdDevQuote a)
instance Show a => Show (EurodollarFutureQuote a)
instance Quote a => Quote (EurodollarFutureQuote a)
instance Quote a => Quote (ImpliedStdDevQuote a)
instance Quote (DerivedQuote a)
instance Quote (CompositeQuote a)
instance Quote SimpleQuote
module QuantLib.Methods.MonteCarlo
-- | Summary type class aggregates all priced values of paths
class PathPricer p => Summary m p | m -> p
sSummarize :: Summary m p => m -> [p] -> m
sNorm :: Summary m p => m -> m -> Double
-- | Path generator is a stochastic path generator
class PathGenerator m
pgMkNew :: PathGenerator m => m -> IO m
pgGenerate :: PathGenerator m => m -> IO Path
-- | Path pricer provides a price for given path
class PathPricer m
ppPrice :: PathPricer m => m -> Path -> m
-- | Monte Carlo engine function
monteCarlo :: (Summary s p, PathPricer p, PathGenerator g) => PathMonteCarlo s p g -> Int -> IO s
-- | Monte Carlo engine function. Parallelized version
monteCarloParallel :: (Summary s p, PathPricer p, PathGenerator g) => PathMonteCarlo s p g -> Int -> IO s
-- | Path-dependant Monte Carlo engine
data (Summary s p, PathPricer p, PathGenerator g) => PathMonteCarlo s p g
PathMonteCarlo :: s -> p -> g -> PathMonteCarlo s p g
pmcSummary :: PathMonteCarlo s p g -> s
pmcPricer :: PathMonteCarlo s p g -> p
pmcGenerator :: PathMonteCarlo s p g -> g
-- | This pricer gets the last point of path
data LastPointPricer
LastPointPricer :: Dot -> LastPointPricer
-- | Stochastic process generator
data (StochasticProcess sp, NormalGenerator b, Discretize d) => ProcessGenerator sp b d
ProcessGenerator :: Dot -> Int -> sp -> b -> d -> ProcessGenerator sp b d
pgStart :: ProcessGenerator sp b d -> Dot
pgLength :: ProcessGenerator sp b d -> Int
pgProcess :: ProcessGenerator sp b d -> sp
pgGenerator :: ProcessGenerator sp b d -> b
pgDiscretize :: ProcessGenerator sp b d -> d
instance (StochasticProcess sp, NormalGenerator b, Discretize d) => PathGenerator (ProcessGenerator sp b d)
instance PathPricer LastPointPricer
module QuantLib.Currencies
-- | Currency specification
data Currency
Currency :: String -> String -> Integer -> Integer -> Currency
-- | currency name, e.g. U.S. dollar
cName :: Currency -> String
-- | ISO 4217 three-letter code, e.g. USD
cCode :: Currency -> String
-- | ISO 4217 numeric code, e.g. 840
cIsoCode :: Currency -> Integer
-- | number of fractionary parts in a unit
cFracsPerUnit :: Currency -> Integer
-- | Swiss france
chf :: Currency
-- | Czech koruna
czk :: Currency
-- | Danish krone
dkk :: Currency
-- | European Euro
eur :: Currency
-- | British pound sterling
gbp :: Currency
-- | Canadian dollar
cad :: Currency
-- | U.S. dollar
usd :: Currency
module QuantLib.Instruments
-- | Instrument type class
class Instrument a
iNPV :: Instrument a => a -> Double
iErrorEstimate :: Instrument a => a -> Double
iDate :: Instrument a => a -> LocalTime
iIsExpired :: Instrument a => a -> Bool
-- | Composite instrument is an aggregate of other instruments.
data Instrument a => CompositeInstrument a
CompositeInstrument :: (Map a Double) -> CompositeInstrument a
-- | Single stock instrument
data Stock
Stock :: Double -> LocalTime -> Stock
sQuote :: Stock -> Double
sDate :: Stock -> LocalTime
module QuantLib.Time
-- | Business Day conventions - These conventions specify the algorithm
-- used to adjust a date in case it is not a valid business day.
data BusinessDayConvention
Following :: BusinessDayConvention
ModifiedFollowing :: BusinessDayConvention
Preceding :: BusinessDayConvention
ModifiedPreceding :: BusinessDayConvention
Unadjusted :: BusinessDayConvention
-- | Week days
data WeekDay
Monday :: WeekDay
Tuesday :: WeekDay
Wednesday :: WeekDay
Thursday :: WeekDay
Friday :: WeekDay
Saturday :: WeekDay
Sunday :: WeekDay
-- | Date
type Date = Day
-- | Defines a holidays for given calendar. Corresponds to calendar class
-- in QuantLib
class Holiday m
isHoliday :: Holiday m => m -> (Integer, Int, Int) -> Bool
isBusinessDay :: Holiday m => m -> Date -> Bool
hBusinessDayBetween :: Holiday m => m -> (Date, Date) -> Int
-- | Gets a week day
getWeekDay :: Date -> WeekDay
-- | Generate a list of all dates inbetween
getDaysBetween :: (Day, Day) -> [Day]
-- | Checks if the day is a weekend, i.e. Saturday or Sunday
isWeekEnd :: Date -> Bool
-- | Gets the next working day
getNextBusinessDay :: Holiday a => a -> Date -> Date
-- | Day counter type class
class DayCounter m
dcName :: DayCounter m => m -> String
dcCount :: DayCounter m => m -> Date -> Date -> Int
dcYearFraction :: DayCounter m => m -> Date -> Date -> Double
-- | Thirty day counters as in QuantLib
data Thirty360
ThirtyUSA :: Thirty360
ThirtyEuropean :: Thirty360
ThirtyItalian :: Thirty360
module QuantLib.Prices
-- | Price types
data PriceType
Bid :: PriceType
Ask :: PriceType
Last :: PriceType
Close :: PriceType
Mid :: PriceType
MidEq :: PriceType
MidSafe :: PriceType
-- | Call price
data CallPrice
DirtyPrice :: Double -> CallPrice
cpPrice :: CallPrice -> Double
CleanPrice :: Double -> CallPrice
cpPrice :: CallPrice -> Double
-- | Interval price
data IntervalPrice
IntervalPrice :: Double -> Double -> Double -> Double -> IntervalPrice
ipOpen :: IntervalPrice -> Double
ipHigh :: IntervalPrice -> Double
ipLow :: IntervalPrice -> Double
ipClose :: IntervalPrice -> Double
instance Show PriceType
instance Eq PriceType
instance Show CallPrice
instance Eq CallPrice
instance Ord CallPrice
instance Show IntervalPrice
instance Eq IntervalPrice
module QuantLib.Event
class Event a
evDate :: Event a => a -> Date
evOccured :: Event a => a -> Date -> Bool
evOccuredInclude :: Event a => a -> Date -> Bool
evCompare :: Event a => a -> a -> Ordering
evEqual :: Event a => a -> a -> Bool
-- | Cash flows data type
data CashFlow
CashFlow :: Date -> Double -> CashFlow
cfDate :: CashFlow -> Date
cfAmount :: CashFlow -> Double
-- | Sequence of cash-flows
type Leg = [CashFlow]
data Callability
Call :: CallPrice -> Date -> Callability
cPrice :: Callability -> CallPrice
cDate :: Callability -> Date
Put :: CallPrice -> Date -> Callability
cPrice :: Callability -> CallPrice
cDate :: Callability -> Date
instance Show CashFlow
instance Show Callability
instance Ord Callability
instance Eq Callability
instance Event Callability
instance Ord CashFlow
instance Eq CashFlow
instance Event CashFlow
module QuantLib.PricingEngines
class Event e => PricingEngine a e
peCalculate :: PricingEngine a e => e -> a -> e
module QuantLib.TimeSeries
-- | Time series
type TimeSeries m = Map LocalTime m
module QuantLib.VolatilityModel
-- | Volatility type
type Volatility = Double
-- | Volatility time series
type VolatilitySeries = TimeSeries Volatility
-- | The estimator of time series of doubles
class DoubleVolatilityEstimator a
dveCalculate :: DoubleVolatilityEstimator a => a -> TimeSeries Double -> VolatilitySeries
-- | The calculator of volatility for interval price
class IntervalPointCalculator a
ipcCalculatePoint :: IntervalPointCalculator a => a -> IntervalPrice -> Volatility
-- | Interval price volatility estimator
class IntervalVolatilityEstimator a
iveCalculate :: (IntervalVolatilityEstimator a, IntervalPointCalculator b) => a -> b -> TimeSeries IntervalPrice -> VolatilitySeries
-- | Simple local estimator
data SimpleLocalEstimator
SimpleLocalEstimator :: Double -> SimpleLocalEstimator
sleYearFraction :: SimpleLocalEstimator -> Double
-- | Garman-Klass interval estimators
data GarmanKlass
GarmanKlass :: Double -> GarmanKlass
gkYearFraction :: GarmanKlass -> Double
-- | Types of Garman-Klass estimators
data GarmanKlassPoint
GarmanKlassSimpleSigma :: GarmanKlassPoint
ParkinsonSigma :: GarmanKlassPoint
instance Show SimpleLocalEstimator
instance Eq SimpleLocalEstimator
instance Show GarmanKlass
instance Eq GarmanKlass
instance IntervalPointCalculator GarmanKlassPoint
instance IntervalVolatilityEstimator GarmanKlass
instance DoubleVolatilityEstimator SimpleLocalEstimator
module QuantLib.Position
-- | Position types
data Position
Long :: Position
Short :: Position
instance Show Position
instance Eq Position
module QuantLib.Money
-- | Amount of cash. Please, note that currency conversion is not
-- implemented yet.
data Money
Money :: Double -> Currency -> Money
mValue :: Money -> Double
mCurrency :: Money -> Currency
instance Eq Money
instance Num Money
instance Show Money
module QuantLib.Stochastic
-- | Discretization of stochastic process over given interval
class Discretize b
dDrift :: (Discretize b, StochasticProcess a) => a -> b -> Dot -> Double
dDiff :: (Discretize b, StochasticProcess a) => a -> b -> Dot -> Double
dDt :: (Discretize b, StochasticProcess a) => a -> b -> Dot -> Double
-- | 1D Stochastic process
class StochasticProcess a
drift :: StochasticProcess a => a -> Dot -> Double
diff :: StochasticProcess a => a -> Dot -> Double
evolve :: (StochasticProcess a, Discretize b) => b -> a -> Dot -> Double -> Dot
-- | Dot. t and x pair
data Dot
Dot :: Double -> Double -> Dot
getT :: Dot -> Double
getX :: Dot -> Double
-- | Path as list of Dots
type Path = [Dot]
-- | Generates sample path for given stochastic process under
-- discretization and normal generator for given amount of steps,
-- starting from x0
generatePath :: (StochasticProcess a, NormalGenerator b, Discretize c) => b -> c -> a -> Int -> Dot -> IO Path
-- | Geometric Brownian motion
data GeometricBrownian
GeometricBrownian :: Double -> Double -> GeometricBrownian
gbDrift :: GeometricBrownian -> Double
gbDiff :: GeometricBrownian -> Double
-- | Ito process
data ItoProcess
ItoProcess :: (Dot -> Double) -> (Dot -> Double) -> ItoProcess
ipDrift :: ItoProcess -> Dot -> Double
ipDiff :: ItoProcess -> Dot -> Double
-- | Square-root process
data SquareRootProcess
SquareRootProcess :: Double -> Double -> Double -> SquareRootProcess
srpSpeed :: SquareRootProcess -> Double
srpMean :: SquareRootProcess -> Double
srpSigma :: SquareRootProcess -> Double
-- | Ornstein-Uhlenbeck process
data OrnsteinUhlenbeckProcess
OrnsteinUhlenbeckProcess :: Double -> Double -> Double -> OrnsteinUhlenbeckProcess
oupSpeed :: OrnsteinUhlenbeckProcess -> Double
oupLevel :: OrnsteinUhlenbeckProcess -> Double
oupSigma :: OrnsteinUhlenbeckProcess -> Double
-- | Generalized Black-Scholes process
data BlackScholesProcess
BlackScholesProcess :: (Double -> Double) -> (Double -> Double) -> (Dot -> Double) -> BlackScholesProcess
bspRiskFree :: BlackScholesProcess -> Double -> Double
bspDividend :: BlackScholesProcess -> Double -> Double
bspBlackVol :: BlackScholesProcess -> Dot -> Double
-- | Euler discretization of stochastic processes
data Euler
Euler :: Double -> Euler
eDt :: Euler -> Double
-- | Euler end-point discretization of stochastic processes
data EndEuler
EndEuler :: Double -> EndEuler
eeDt :: EndEuler -> Double
-- | Box-Muller method
data BoxMuller
-- | Creates normally distributed generator
createNormalGen :: RNG -> BoxMuller
mkNormalGen :: IO BoxMuller
-- | Normally distributed generator
class NormalGenerator a
ngGetNext :: NormalGenerator a => a -> IO (Double, a)
ngMkNew :: NormalGenerator a => a -> IO a
module QuantLib