-- 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.3.3
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 where isBusinessDay m d = not (isHoliday m $ toGregorian d) hBusinessDayBetween m (fd, td) = foldl countDays 0 listOfDates where countDays counter x = counter + fromEnum (isBusinessDay m x) listOfDates = getDaysBetween (fd, td)
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
-- | Name of day counter
dcName :: DayCounter m => m -> String
-- | Number of business days inbetween
dcCount :: DayCounter m => m -> Date -> Date -> Int
-- | Year fraction
dcYearFraction :: DayCounter m => m -> Date -> Date -> Double
-- | Thirty day counters as in QuantLib
data Thirty360
ThirtyUSA :: Thirty360
ThirtyEuropean :: Thirty360
ThirtyItalian :: Thirty360
intGregorian :: Day -> (Int, Int, Int)
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 GHC.Classes.Eq QuantLib.Prices.IntervalPrice
instance GHC.Show.Show QuantLib.Prices.IntervalPrice
instance GHC.Classes.Ord QuantLib.Prices.CallPrice
instance GHC.Classes.Eq QuantLib.Prices.CallPrice
instance GHC.Show.Show QuantLib.Prices.CallPrice
instance GHC.Classes.Eq QuantLib.Prices.PriceType
instance GHC.Show.Show QuantLib.Prices.PriceType
module QuantLib.TimeSeries
-- | Time series
type TimeSeries m = Map LocalTime m
-- | Interval price time series
type IntervalPriceSeries = TimeSeries IntervalPrice
module QuantLib.Priceable
-- | All instruments and events have a net present value
class Priceable a
npv :: Priceable a => a -> Double
errorEstimate :: Priceable a => a -> Double
module QuantLib.Position
-- | Position types
data Position
Long :: Position
Short :: Position
instance GHC.Classes.Eq QuantLib.Position.Position
instance GHC.Show.Show QuantLib.Position.Position
module QuantLib.Options
data OptionType
Call :: OptionType
Put :: OptionType
toInt :: OptionType -> Int
toDouble :: OptionType -> Double
instance GHC.Classes.Eq QuantLib.Options.OptionType
instance GHC.Show.Show QuantLib.Options.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 where pureValue x = fromMaybe 0.0 (qValue x)
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 GHC.Show.Show a => GHC.Show.Show (QuantLib.Quotes.EurodollarFutureQuote a)
instance GHC.Show.Show a => GHC.Show.Show (QuantLib.Quotes.ImpliedStdDevQuote a)
instance GHC.Classes.Eq QuantLib.Quotes.SimpleQuote
instance GHC.Show.Show QuantLib.Quotes.SimpleQuote
instance QuantLib.Quotes.Quote QuantLib.Quotes.SimpleQuote
instance QuantLib.Quotes.Quote (QuantLib.Quotes.CompositeQuote a)
instance QuantLib.Quotes.Quote (QuantLib.Quotes.DerivedQuote a)
instance QuantLib.Quotes.Quote a => QuantLib.Quotes.Quote (QuantLib.Quotes.ImpliedStdDevQuote a)
instance QuantLib.Quotes.Quote a => QuantLib.Quotes.Quote (QuantLib.Quotes.EurodollarFutureQuote a)
module QuantLib.Models.Volatility
-- | Volatility type
type Volatility = Double
-- | Estimation type with strictness as it is usually required only one
-- Double to process
data Estimation
Estimation :: {-# UNPACK #-} !Volatility -> Estimation
-- | Type class of volatility estimators
class VolatilityEstimator algorithm
-- | The estimation procedure that takes a series of IntervalPrice
estimate :: VolatilityEstimator algorithm => algorithm -> IntervalPriceSeries -> Estimation
data VolatilityEstimatorAlgorithm
-- | Simple estimator with drift
SimpleEstimator :: VolatilityEstimatorAlgorithm
-- | Simple estimator without drift
SimpleDriftLessEstimator :: VolatilityEstimatorAlgorithm
-- | Parkinson number
ParkinsonEstimator :: VolatilityEstimatorAlgorithm
-- | Garman-Klass estimator
GarmanKlass5Estimator :: VolatilityEstimatorAlgorithm
-- | Rogers-Stachel estimator
RogersSatchelEstimator :: VolatilityEstimatorAlgorithm
-- | Yang-Zhang estimator
YangZhangEstimator :: VolatilityEstimatorAlgorithm
instance GHC.Enum.Enum QuantLib.Models.Volatility.VolatilityEstimatorAlgorithm
instance GHC.Classes.Eq QuantLib.Models.Volatility.VolatilityEstimatorAlgorithm
instance GHC.Show.Show QuantLib.Models.Volatility.VolatilityEstimatorAlgorithm
instance GHC.Classes.Eq QuantLib.Models.Volatility.Estimation
instance GHC.Show.Show QuantLib.Models.Volatility.Estimation
instance QuantLib.Models.Volatility.VolatilityEstimator QuantLib.Models.Volatility.VolatilityEstimatorAlgorithm
module QuantLib.Models
module QuantLib.Methods.MonteCarlo
-- | Summary type class aggregates all priced values of paths
class PathPricer p => Summary m p | m -> p
-- | Updates summary with given priced pathes
sSummarize :: Summary m p => m -> [p] -> m
-- | Defines a metric, i.e. calculate distance between 2 summaries
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, PathGenerator g) => PathMonteCarlo s p g -> Int -> IO s
-- | Monte Carlo engine function. Parallelized version
monteCarloParallel :: (Summary s p, PathGenerator g) => PathMonteCarlo s p g -> Int -> IO s
-- | Path-dependant Monte Carlo engine
data 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
newtype LastPointPricer
LastPointPricer :: Dot -> LastPointPricer
-- | Stochastic process generator
data 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 QuantLib.Methods.MonteCarlo.PathPricer QuantLib.Methods.MonteCarlo.LastPointPricer
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)
module QuantLib.Stochastic
module QuantLib.Math.Copulas
-- | 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
class Copula a where copula t = precheckRange (copulaFunc t)
copula :: Copula a => a -> Double -> Double -> Maybe Double
copulaFunc :: Copula a => a -> Double -> Double -> Maybe Double
-- | Copula data types with parameters required by the concrete copula
-- definition
data Copulas
-- | Clayton copula
ClaytonCopula :: Double -> Copulas
-- | Min copula
MinCopula :: Copulas
-- | Max copula
MaxCopula :: Copulas
-- | Ali-Mikhail-Haq copula
AliMikhailHaqCopula :: Double -> Copulas
-- | Farlie-Gumbel-Morgenstern copula
FarlieGumbelMorgensternCopula :: Double -> Copulas
-- | Frank copula
FrankCopula :: Double -> Copulas
-- | Galambos copula
GalambosCopula :: Double -> Copulas
-- | Gaussian copula Not implemented yet!
GaussianCopula :: Double -> Copulas
-- | Gumbel copula
GumbelCopula :: Double -> Copulas
-- | Husler-Reiss copula Not implemented yet!
HuslerReissCopula :: Double -> Copulas
-- | Independent copula
IndependentCopula :: Copulas
-- | Marshall-Olkin copula
MarshallOlkinCopula :: Double -> Double -> Copulas
-- | Plackett copula
PlackettCopula :: Double -> Copulas
instance QuantLib.Math.Copulas.Copula QuantLib.Math.Copulas.Copulas
module QuantLib.Math
-- | Computes the inverse cumulative standard normal distribution N(0, 1)
inverseNormal :: Double -> Double
module QuantLib.Instruments
-- | Instrument type class
class Instrument a
iDate :: Instrument a => a -> LocalTime
iIsExpired :: Instrument a => a -> Bool
-- | Composite instrument is an aggregate of other instruments.
data CompositeInstrument
CompositeInstrument :: (Map a Double) -> CompositeInstrument
-- | Single stock instrument
data Stock
Stock :: Double -> LocalTime -> Stock
[sQuote] :: Stock -> Double
[sDate] :: Stock -> LocalTime
module QuantLib.Event
class Event a where evOccured event date = evDate event < date evOccuredInclude event date = evDate event <= date evCompare x y | evDate x == evDate y = EQ | evDate x <= evDate y = LT | otherwise = GT evEqual x y = evDate x == evDate y
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 GHC.Show.Show QuantLib.Event.Callability
instance GHC.Show.Show QuantLib.Event.CashFlow
instance QuantLib.Event.Event QuantLib.Event.CashFlow
instance GHC.Classes.Eq QuantLib.Event.CashFlow
instance GHC.Classes.Ord QuantLib.Event.CashFlow
instance QuantLib.Event.Event QuantLib.Event.Callability
instance GHC.Classes.Eq QuantLib.Event.Callability
instance GHC.Classes.Ord QuantLib.Event.Callability
module QuantLib.PricingEngines
class Event e => PricingEngine a e
peCalculate :: PricingEngine a e => e -> a -> e
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 GHC.Classes.Eq QuantLib.Money.Money
instance GHC.Show.Show QuantLib.Money.Money
instance GHC.Num.Num QuantLib.Money.Money
module QuantLib.Currencies
module QuantLib