Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Measure that we need for calculating prices
Synopsis
- data Mean = Mean {}
- getMean ∷ Mean → Maybe Double
- countOne ∷ Integer → Mean
- countMany ∷ Natural → Integer → Mean
- data ExponentialWeightedMean = ExponentialWeightedMean {}
- countExponentialWeightedMean ∷ Double → ExponentialWeightedMean → Mean → ExponentialWeightedMean
- getExponentialWeightedMean ∷ ExponentialWeightedMean → Maybe Double
- emptyEwm ∷ ExponentialWeightedMean
- data Variance = Variance {}
- emptyVariance ∷ Variance
- observe ∷ Variance → Mean → Variance
- getVariance ∷ Variance → Maybe Double
Measures
Mean
Arithmetic mean
Instances
FromJSON Mean Source # | |
ToJSON Mean Source # | |
Monoid Mean Source # | |
Semigroup Mean Source # | |
Generic Mean Source # | |
Show Mean Source # | |
Eq Mean Source # | |
Ord Mean Source # | |
type Rep Mean Source # | |
Defined in Convex.Measures type Rep Mean = D1 ('MetaData "Mean" "Convex.Measures" "convex-base-0.2.0.0-inplace" 'False) (C1 ('MetaCons "Mean" 'PrefixI 'True) (S1 ('MetaSel ('Just "mCount") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Natural) :*: S1 ('MetaSel ('Just "mSum") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Integer))) |
countMany ∷ Natural → Integer → Mean Source #
Count many observations of the same value (ie. count the value with a higher weight)
Exponential weighted mean
data ExponentialWeightedMean Source #
Instances
countExponentialWeightedMean ∷ Double → ExponentialWeightedMean → Mean → ExponentialWeightedMean Source #
Add an observation of the Mean
to the exp. weighted mean,
discounting the past observations by a factor.
A good factor is 0.9 or 0.95
getExponentialWeightedMean ∷ ExponentialWeightedMean → Maybe Double Source #
Get the exp. weighted mean if at least one value has been observed
Variance
Instances
FromJSON Variance Source # | |
ToJSON Variance Source # | |
Generic Variance Source # | |
Show Variance Source # | |
Eq Variance Source # | |
Ord Variance Source # | |
type Rep Variance Source # | |
Defined in Convex.Measures type Rep Variance = D1 ('MetaData "Variance" "Convex.Measures" "convex-base-0.2.0.0-inplace" 'False) (C1 ('MetaCons "Variance" 'PrefixI 'True) (S1 ('MetaSel ('Just "vMean") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Mean) :*: (S1 ('MetaSel ('Just "vN") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Natural) :*: S1 ('MetaSel ('Just "vM2") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Double)))) |