tradingmode

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: 4 Imported by: 0

Documentation

Overview

Package tradingmode defines the process-wide paper vs live execution gate.

Venue order mutations follow trading_mode (or SEQ_TRADING_MODE). The default mode is always paper.

Index

Constants

View Source
const EnvTradingMode = "SEQ_TRADING_MODE"

EnvTradingMode optionally overrides the YAML trading_mode value.

Variables

View Source
var (
	// ErrPaperMode is returned by execution paths that refuse live venue
	// order mutations while the process is in paper mode.
	ErrPaperMode = errors.New("trading mode is paper: live venue order mutation refused")
)

Functions

func RequireLive

func RequireLive() error

RequireLive returns ErrPaperMode unless the process is in live mode.

func ResetForTest

func ResetForTest()

ResetForTest restores the default paper mode. Tests only.

func Set

func Set(mode Mode)

Set installs the process-wide trading mode. Call once at boot after Resolve.

Types

type Mode

type Mode string

Mode is the runtime trading posture for Seq.

const (
	// ModePaper is the default. Venue order submit/cancel paths must refuse
	// live mutations.
	ModePaper Mode = "paper"

	// ModeLive allows venue order mutations.
	ModeLive Mode = "live"
)

func Current

func Current() Mode

Current returns the process-wide trading mode (defaults to paper).

func Parse

func Parse(s string) (Mode, error)

Parse converts a config/env string into a Mode. Empty string means paper.

func Resolve

func Resolve(configValue string, getenv func(string) string) (Mode, error)

Resolve picks the effective trading mode from config and environment.

Precedence:

  1. SEQ_TRADING_MODE if set
  2. configValue (empty → paper)

func (Mode) IsLive

func (m Mode) IsLive() bool

IsLive reports whether mode permits live venue order mutations.

func (Mode) String

func (m Mode) String() string

String returns the canonical mode name.

Jump to

Keyboard shortcuts

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