Documentation ¶
Index ¶
- Variables
- type LogNormal
- func (f *LogNormal) CalculateRiskFactors() *types.RiskFactor
- func (f *LogNormal) DefaultRiskFactors() *types.RiskFactor
- func (f *LogNormal) GetProjectionHorizon() num.Decimal
- func (f *LogNormal) PriceRange(currentP, yFrac, probabilityLevel num.Decimal) (num.Decimal, num.Decimal)
- func (f *LogNormal) ProbabilityOfTrading(currentP, orderP num.Decimal, minP, maxP num.Decimal, yFrac num.Decimal, ...) num.Decimal
- type Simple
- func (f *Simple) CalculateRiskFactors() *types.RiskFactor
- func (f *Simple) DefaultRiskFactors() *types.RiskFactor
- func (f *Simple) GetProjectionHorizon() num.Decimal
- func (f *Simple) PriceRange(currentP, _, _ num.Decimal) (num.Decimal, num.Decimal)
- func (f *Simple) ProbabilityOfTrading(currentP, orderP, minP, maxP, yFrac num.Decimal, isBid, applyMinMax bool) num.Decimal
Constants ¶
This section is empty.
Variables ¶
var ErrMissingLogNormalParameter = errors.New("missing log normal parameters")
Functions ¶
This section is empty.
Types ¶
type LogNormal ¶
type LogNormal struct {
// contains filtered or unexported fields
}
LogNormal represent a future risk model.
func NewBuiltinFutures ¶
func NewBuiltinFutures(pf *types.LogNormalRiskModel, asset string) (*LogNormal, error)
NewBuiltinFutures instantiate a new builtin future.
func (*LogNormal) CalculateRiskFactors ¶
func (f *LogNormal) CalculateRiskFactors() *types.RiskFactor
CalculateRiskFactors calls the risk model in order to get the new risk models.
func (*LogNormal) DefaultRiskFactors ¶
func (f *LogNormal) DefaultRiskFactors() *types.RiskFactor
func (*LogNormal) GetProjectionHorizon ¶
GetProjectionHorizon returns the projection horizon used by the model for margin calculation pruposes.
func (*LogNormal) PriceRange ¶
func (f *LogNormal) PriceRange(currentP, yFrac, probabilityLevel num.Decimal) (num.Decimal, num.Decimal)
PriceRange returns the minimum and maximum price as implied by the model's probability distribution with horizon given by yearFraction (e.g. 0.5 for half a year) and probability level (e.g. 0.95 for 95%).
func (*LogNormal) ProbabilityOfTrading ¶
func (f *LogNormal) ProbabilityOfTrading(currentP, orderP num.Decimal, minP, maxP num.Decimal, yFrac num.Decimal, isBid, applyMinMax bool) num.Decimal
ProbabilityOfTrading of trading returns the probability of trading given current mark price, projection horizon expressed as year fraction, order price and side (isBid). Additional arguments control optional truncation of probability density outside the [minPrice,maxPrice] range.
type Simple ¶
type Simple struct {
// contains filtered or unexported fields
}
Simple represents a dummy risk model with fixed risk params.
func NewSimple ¶
func NewSimple(ps *types.SimpleRiskModel, asset string) (*Simple, error)
NewSimple instantiates a new simple/dummy risk model with fixed risk params.
func (*Simple) CalculateRiskFactors ¶
func (f *Simple) CalculateRiskFactors() *types.RiskFactor
CalculateRiskFactors returns the fixed risk factors for the simple risk model.
func (*Simple) DefaultRiskFactors ¶
func (f *Simple) DefaultRiskFactors() *types.RiskFactor
func (*Simple) GetProjectionHorizon ¶
GetProjectionHorizon returns 0 and the simple model doesn't rely on any proabilistic calculations.
func (*Simple) PriceRange ¶
PriceRange returns the minimum and maximum price as implied by the model's maxMoveUp/minMoveDown parameters and the current price.
func (*Simple) ProbabilityOfTrading ¶
func (f *Simple) ProbabilityOfTrading(currentP, orderP, minP, maxP, yFrac num.Decimal, isBid, applyMinMax bool) num.Decimal
ProbabilityOfTrading of trading returns the probability of trading given current mark price, projection horizon expressed as year fraction, order price and side (isBid). Additional arguments control optional truncation of probability density outside the [minPrice,maxPrice] range.