regimerows

package
v2.8.5 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package regimerows builds presentation-oriented regime rows, bands, and provenance labels from typed RPC results.

The package performs no I/O and owns no daemon state or broker authority. Its shared classifications keep Canary and CLI presentation consistent; callers must continue to use daemon- and risk-owned verdicts for policy decisions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsOfLabel

func AsOfLabel(meta *rpc.RegimeAsOfSummary, status string) string

AsOfLabel returns the producer label when present and otherwise derives a conservative label from status.

func FormatRegimeAgreement

func FormatRegimeAgreement(result *rpc.GammaZeroComputed) string

FormatRegimeAgreement summarizes SPY/SPX gamma agreement.

func FormatSpotPrice

func FormatSpotPrice(value float64) string

FormatSpotPrice formats a spot value for regime presentation.

func GammaIsSPYProxy

func GammaIsSPYProxy(result *rpc.GammaZeroComputed) bool

GammaIsSPYProxy reports whether an SPX-context result is backed by the SPY proxy rather than canonical SPX data.

func GammaPlainQualityReason

func GammaPlainQualityReason(quality *rpc.GammaSignalQuality) string

GammaPlainQualityReason summarizes gamma quality without terminal styling.

func GammaRegimeWord

func GammaRegimeWord(result *rpc.GammaZeroComputed) string

GammaRegimeWord returns the plain-language gamma regime classification.

func GammaRowLabel

func GammaRowLabel(row rpc.RegimeGammaZero) string

GammaRowLabel returns the scope-aware label for a gamma row.

func GammaTripAnchor added in v2.6.0

func GammaTripAnchor(row rpc.RegimeGammaZero) string

GammaTripAnchor is the dealer-gamma trigger a gauge face prints beside its reading. Gamma's red band is a crossing rather than a fixed number, so the anchor is the SERVED pair the crossing is measured against — the spot the sweep was anchored at and the γ-zero level it found.

A combined SPY+SPX result deliberately carries no blended level (the two underlyings live on different spot scales), so the anchor falls back to the canonical per-index result and says which index it is. Nothing is interpolated and no scale is mixed. Empty when no served result has a usable crossing; callers then fall back to the row's worded trip, which states the rule without pretending to a level.

func IfNonEmpty

func IfNonEmpty(value, fallback string) string

IfNonEmpty returns value when non-empty and fallback otherwise.

func QualityTag

func QualityTag(now time.Time, qualities ...*rpc.Quality) string

QualityTag returns a compact worst-source provenance and age label.

func StreakMarker

func StreakMarker(s *rpc.StreakInfo) string

StreakMarker formats a positive consecutive-session count for a row.

Types

type Band

type Band int

Band is the classified state of one indicator. unranked covers computing / unavailable / error — these don't contribute to the composite count (user-confirmed decision; honest about coverage).

const (
	BandUnranked Band = iota
	BandGreen
	BandYellow
	BandRed
)

Indicator bands. BandUnranked represents unavailable or non-comparable evidence and does not contribute to ranked counts.

func GammaCombinedRegimeBand

func GammaCombinedRegimeBand(result *rpc.GammaZeroComputed) Band

GammaCombinedRegimeBand maps a combined SPY/SPX gamma result to a presentation band.

func GammaSingleRegimeBand

func GammaSingleRegimeBand(result *rpc.GammaZeroComputed) Band

GammaSingleRegimeBand maps a single-scope gamma result to a presentation band.

func (Band) String

func (b Band) String() string

String returns the stable lowercase band label, or an empty string for an unranked value.

type Row

type Row struct {
	Name      string // "VIX/VIX3M"
	Cluster   string // cluster token for composite de-duplication
	Value     string // value cell, plain; dim-suffix attached at render time
	AsOf      string // compact freshness badge ("live", "close D-1", "cached 11:42")
	Band      Band   // for glyph + band-word coloring
	Reason    string // parenthetical band justification ("<0.92 contango")
	Status    string // rpc.RegimeStatus*; drives glyph for unranked + stale suffix
	StateNote string // override for unranked / loading rows ("42s ETA · 40% done")
	// quality is the row's compact provenance tag, e.g. "· est 18s" or
	// "· modelled". Empty string when every value on the row came from
	// a firm-live tick — the default case stays unannotated to keep the
	// rendering uncluttered. Each row builder computes this from the
	// rpc.Quality pointers attached to the values it consumed.
	Quality string
	// streak summarises the consecutive-sessions-in-band counter on a
	// short inline marker like "day 3" — appended next to the band word
	// so a reader sees "yellow · day 3" without scanning sideways. The
	// streak counter is daemon-classified using the spec defaults; a
	// renderer with custom thresholds reads the raw value cell instead.
	Streak string
}

Row is the rendered shape of one indicator: a fixed-width row the layout assembles top-to-bottom. Kept as a struct so the composite counter and the row renderer share one source of truth.

func Breadth

func Breadth(now time.Time, row rpc.RegimeBreadth) Row

Breadth builds the S&P 500 breadth presentation row.

func CreditSpreads

func CreditSpreads(now time.Time, row rpc.RegimeCreditSpreads) Row

CreditSpreads builds the official credit-spread presentation row.

func FundingStress

func FundingStress(now time.Time, row rpc.RegimeFundingStress) Row

FundingStress builds the short-term funding-stress presentation row.

func Gamma

func Gamma(now time.Time, row rpc.RegimeGammaZero) Row

Gamma builds the dealer-gamma presentation row with provenance disclosure.

func HYGSPY

func HYGSPY(now time.Time, row rpc.RegimeHYGSPYDivergence) Row

HYGSPY builds the credit-versus-equity divergence presentation row.

func USDJPY

func USDJPY(now time.Time, row rpc.RegimeUSDJPY) Row

USDJPY builds the dollar-yen carry-stress presentation row.

func VIXTerm

func VIXTerm(now time.Time, row rpc.RegimeVIXTerm) Row

VIXTerm builds the VIX term-structure presentation row.

func VolOfVol

func VolOfVol(now time.Time, row rpc.RegimeVolOfVol) Row

VolOfVol builds the volatility-of-volatility presentation row.

Jump to

Keyboard shortcuts

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