risk

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2026 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RiskConfig

type RiskConfig struct {
	// MaxPosition maximum allowed position size (0 = unlimited)
	MaxPosition float64
	// MaxDailyLoss maximum daily loss ratio (e.g. 0.1 = 10%, 0 = unlimited)
	MaxDailyLoss float64
	// MaxOrderRate maximum orders per minute (0 = unlimited)
	MaxOrderRate int
	// PriceDeviation max price deviation from last known price (e.g. 0.05 = 5%, 0 = disabled)
	PriceDeviation float64
}

RiskConfig configurable risk control parameters

type RiskManager

type RiskManager struct {
	BaseProcesser
	// contains filtered or unexported fields
}

RiskManager monitors positions and P&L, triggers protective actions when limits are breached. It acts as a guardian/observer in the processer chain - it does NOT block orders, but when risk limits are breached it sends CancelAll + forced close orders to the exchange.

func NewRiskManager

func NewRiskManager(symbol string, config RiskConfig) *RiskManager

NewRiskManager creates a new risk manager with the given config

func (*RiskManager) Init

func (rm *RiskManager) Init(bus *Bus) (err error)

func (*RiskManager) Start

func (rm *RiskManager) Start() (err error)

func (*RiskManager) Stop

func (rm *RiskManager) Stop() (err error)

Jump to

Keyboard shortcuts

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