riskcontrol

package
v0.0.0-...-cb4139d Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CircuitBreakRiskControl

type CircuitBreakRiskControl struct {
	// contains filtered or unexported fields
}

func NewCircuitBreakRiskControl

func NewCircuitBreakRiskControl(
	position *types.Position,
	price *indicator.EWMAStream,
	lossThreshold fixedpoint.Value,
	profitStats *types.ProfitStats) *CircuitBreakRiskControl

func (*CircuitBreakRiskControl) IsHalted

func (c *CircuitBreakRiskControl) IsHalted() bool

IsHalted returns whether we reached the circuit break condition set for this day?

type PositionRiskControl

type PositionRiskControl struct {
	// contains filtered or unexported fields
}

func NewPositionRiskControl

func NewPositionRiskControl(hardLimit, quantity fixedpoint.Value, tradeCollector *bbgo.TradeCollector) *PositionRiskControl

func (*PositionRiskControl) EmitReleasePosition

func (p *PositionRiskControl) EmitReleasePosition(quantity fixedpoint.Value, side types.SideType)

func (*PositionRiskControl) ModifiedQuantity

func (p *PositionRiskControl) ModifiedQuantity(position fixedpoint.Value) (buyQuantity, sellQuantity fixedpoint.Value)

ModifiedQuantity returns quantity controlled by position risks For buy orders, mod quantity = min(hardLimit - position, quantity), limiting by positive position For sell orders, mod quantity = min(hardLimit - (-position), quantity), limiting by negative position

func (*PositionRiskControl) OnReleasePosition

func (p *PositionRiskControl) OnReleasePosition(cb func(quantity fixedpoint.Value, side types.SideType))

Jump to

Keyboard shortcuts

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