rule

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RateLimit

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

RateLimit rejects orders when the current time is before the next-accepted time written by the leaky bucket actor.

func (*RateLimit) Check

func (r *RateLimit) Check(cmd command.RiskCheck) error

type Rule

type Rule interface {
	Check(cmd command.RiskCheck) error
}

Rule is the interface that all risk rules must implement. Each rule inspects a RiskCheck command and returns an error to reject it, or nil to allow it through.

func NewRateLimit

func NewRateLimit(cat *catalog.Catalog, c *cache.Cache, config map[string]any) (Rule, error)

NewRateLimit creates a RateLimit rule from config.

func NewTpnlStop

func NewTpnlStop(cat *catalog.Catalog, c *cache.Cache, config map[string]any) (Rule, error)

type TpnlStop

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

TpnlStop rejects orders when the trading PnL for a given (account, window) pair drops below the configured stop-loss threshold. At check time it purges expired trades from the shared TpnlState, reads per-symbol exposures, and applies current mid-prices to compute the live PnL.

func (*TpnlStop) Check

func (r *TpnlStop) Check(cmd command.RiskCheck) error

Jump to

Keyboard shortcuts

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