convex-base-0.2.0.0: Base classes and types for working with cardano-api transactions
Safe HaskellSafe-Inferred
LanguageHaskell2010

Convex.Measures

Description

Measure that we need for calculating prices

Synopsis

Measures

Mean

data Mean Source #

Arithmetic mean

Constructors

Mean 

Fields

Instances

Instances details
FromJSON Mean Source # 
Instance details

Defined in Convex.Measures

ToJSON Mean Source # 
Instance details

Defined in Convex.Measures

Monoid Mean Source # 
Instance details

Defined in Convex.Measures

Methods

mempty ∷ Mean Source #

mappend ∷ Mean → Mean → Mean Source #

mconcat ∷ [Mean] → Mean Source #

Semigroup Mean Source # 
Instance details

Defined in Convex.Measures

Methods

(<>) ∷ Mean → Mean → Mean Source #

sconcat ∷ NonEmpty Mean → Mean Source #

stimes ∷ Integral b ⇒ b → Mean → Mean Source #

Generic Mean Source # 
Instance details

Defined in Convex.Measures

Associated Types

type Rep Mean ∷ Type → Type Source #

Methods

from ∷ Mean → Rep Mean x Source #

to ∷ Rep Mean x → Mean Source #

Show Mean Source # 
Instance details

Defined in Convex.Measures

Methods

showsPrec ∷ Int → Mean → ShowS Source #

show ∷ Mean → String Source #

showList ∷ [Mean] → ShowS Source #

Eq Mean Source # 
Instance details

Defined in Convex.Measures

Methods

(==) ∷ Mean → Mean → Bool Source #

(/=) ∷ Mean → Mean → Bool Source #

Ord Mean Source # 
Instance details

Defined in Convex.Measures

Methods

compare ∷ Mean → Mean → Ordering Source #

(<) ∷ Mean → Mean → Bool Source #

(<=) ∷ Mean → Mean → Bool Source #

(>) ∷ Mean → Mean → Bool Source #

(>=) ∷ Mean → Mean → Bool Source #

max ∷ Mean → Mean → Mean Source #

min ∷ Mean → Mean → Mean Source #

type Rep Mean Source # 
Instance details

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)))

getMean ∷ Mean → Maybe Double Source #

Get the mean if at least one value has been observed

countOne ∷ Integer → Mean Source #

Count one observation

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 #

Constructors

ExponentialWeightedMean 

Fields

Instances

Instances details
FromJSON ExponentialWeightedMean Source # 
Instance details

Defined in Convex.Measures

ToJSON ExponentialWeightedMean Source # 
Instance details

Defined in Convex.Measures

Generic ExponentialWeightedMean Source # 
Instance details

Defined in Convex.Measures

Associated Types

type Rep ExponentialWeightedMean ∷ Type → Type Source #

Show ExponentialWeightedMean Source # 
Instance details

Defined in Convex.Measures

Eq ExponentialWeightedMean Source # 
Instance details

Defined in Convex.Measures

Ord ExponentialWeightedMean Source # 
Instance details

Defined in Convex.Measures

type Rep ExponentialWeightedMean Source # 
Instance details

Defined in Convex.Measures

type Rep ExponentialWeightedMean = D1 ('MetaData "ExponentialWeightedMean" "Convex.Measures" "convex-base-0.2.0.0-inplace" 'False) (C1 ('MetaCons "ExponentialWeightedMean" 'PrefixI 'True) (S1 ('MetaSel ('Just "ewmCount") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Double) :*: S1 ('MetaSel ('Just "ewmSum") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Double)))

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

data Variance Source #

Constructors

Variance 

Fields

Instances

Instances details
FromJSON Variance Source # 
Instance details

Defined in Convex.Measures

ToJSON Variance Source # 
Instance details

Defined in Convex.Measures

Generic Variance Source # 
Instance details

Defined in Convex.Measures

Associated Types

type Rep Variance ∷ Type → Type Source #

Show Variance Source # 
Instance details

Defined in Convex.Measures

Eq Variance Source # 
Instance details

Defined in Convex.Measures

Ord Variance Source # 
Instance details

Defined in Convex.Measures

type Rep Variance Source # 
Instance details

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))))