dynamicrisk

package
v1.60.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: AGPL-3.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DynamicAmpSpread

type DynamicAmpSpread struct {
	types.IntervalWindow

	// AskSpreadScale is used to define the ask spread range with the given percentage.
	AskSpreadScale *bbgo.PercentageScale `json:"askSpreadScale"`

	// BidSpreadScale is used to define the bid spread range with the given percentage.
	BidSpreadScale *bbgo.PercentageScale `json:"bidSpreadScale"`
	// contains filtered or unexported fields
}

DynamicAmpSpread uses kline amplitude to calculate spreads

type DynamicExposure

type DynamicExposure struct {
	// BollBandExposure calculates the max exposure with the Bollinger Band
	BollBandExposure *DynamicExposureBollBand `json:"bollBandExposure"`
}

func (*DynamicExposure) GetMaxExposure

func (d *DynamicExposure) GetMaxExposure(price float64, trend types.Direction) (maxExposure fixedpoint.Value, err error)

GetMaxExposure returns the max exposure

func (*DynamicExposure) Initialize

func (d *DynamicExposure) Initialize(symbol string, session *bbgo.ExchangeSession)

Initialize dynamic exposure

func (*DynamicExposure) IsEnabled

func (d *DynamicExposure) IsEnabled() bool

type DynamicExposureBollBand

type DynamicExposureBollBand struct {
	// DynamicExposureBollBandScale is used to define the exposure range with the given percentage.
	DynamicExposureBollBandScale *bbgo.PercentageScale `json:"dynamicExposurePositionScale"`

	types.IntervalWindowBandWidth
	// contains filtered or unexported fields
}

DynamicExposureBollBand calculates the max exposure with the Bollinger Band

type DynamicQuantity

type DynamicQuantity struct {
	// LinRegQty calculates quantity based on LinReg slope
	LinRegDynamicQuantity *DynamicQuantityLinReg `json:"linRegDynamicQuantity"`
}

func (*DynamicQuantity) Initialize

func (d *DynamicQuantity) Initialize(symbol string, session *bbgo.ExchangeSession)

Initialize dynamic quantity

func (*DynamicQuantity) IsEnabled

func (d *DynamicQuantity) IsEnabled() bool

type DynamicQuantityLinReg

type DynamicQuantityLinReg struct {
	// DynamicQuantityLinRegScale is used to define the quantity range with the given parameters.
	DynamicQuantityLinRegScale *bbgo.PercentageScale `json:"dynamicQuantityLinRegScale"`

	// QuantityLinReg to define the interval and window of the LinReg
	QuantityLinReg *indicator.LinReg `json:"quantityLinReg"`
}

DynamicQuantityLinReg uses LinReg slope to calculate quantity

type DynamicQuantitySet

type DynamicQuantitySet []DynamicQuantity

DynamicQuantitySet uses multiple dynamic quantity rules to calculate the total quantity

func (*DynamicQuantitySet) GetQuantity

func (d *DynamicQuantitySet) GetQuantity(reverse bool) (fixedpoint.Value, error)

GetQuantity returns the quantity

func (*DynamicQuantitySet) Initialize

func (d *DynamicQuantitySet) Initialize(symbol string, session *bbgo.ExchangeSession)

Initialize dynamic quantity set

type DynamicSpread

type DynamicSpread struct {
	// AmpSpread calculates spreads based on kline amplitude
	AmpSpread *DynamicAmpSpread `json:"amplitude"`

	// WeightedBollWidthRatioSpread calculates spreads based on two Bollinger Bands
	WeightedBollWidthRatioSpread *DynamicSpreadBollWidthRatio `json:"weightedBollWidth"`
}

func (*DynamicSpread) GetAskSpread

func (ds *DynamicSpread) GetAskSpread() (askSpread float64, err error)

GetAskSpread returns current ask spread

func (*DynamicSpread) GetBidSpread

func (ds *DynamicSpread) GetBidSpread() (bidSpread float64, err error)

GetBidSpread returns current dynamic bid spread

func (*DynamicSpread) Initialize

func (ds *DynamicSpread) Initialize(symbol string, session *bbgo.ExchangeSession)

Initialize dynamic spread

func (*DynamicSpread) IsEnabled

func (ds *DynamicSpread) IsEnabled() bool

type DynamicSpreadBollWidthRatio

type DynamicSpreadBollWidthRatio struct {
	// AskSpreadScale is used to define the ask spread range with the given percentage.
	AskSpreadScale *bbgo.PercentageScale `json:"askSpreadScale"`

	// BidSpreadScale is used to define the bid spread range with the given percentage.
	BidSpreadScale *bbgo.PercentageScale `json:"bidSpreadScale"`

	// Sensitivity factor of the weighting function: 1 / (1 + exp(-(x - mid) * sensitivity / width))
	// A positive number. The greater factor, the sharper weighting function. Default set to 1.0 .
	Sensitivity float64 `json:"sensitivity"`

	DefaultBollinger types.IntervalWindowBandWidth `json:"defaultBollinger"`
	NeutralBollinger types.IntervalWindowBandWidth `json:"neutralBollinger"`
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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