models

package
v0.73.0-preview.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func (f *LogNormal) GetProjectionHorizon() num.Decimal

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

func (f *Simple) GetProjectionHorizon() num.Decimal

GetProjectionHorizon returns 0 and the simple model doesn't rely on any proabilistic calculations.

func (*Simple) PriceRange

func (f *Simple) PriceRange(currentP, _, _ num.Decimal) (num.Decimal, num.Decimal)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL