Expand description
Position event ingress (JFLOW-C).
Receives live position snapshots from the execution side (Ruby / fks),
defines the wire shape, validates inputs, and computes a guidance hint
(hold / reduce / exit) the producer can act on. The receiving HTTP
handler lives in janus-api; persistence and brain-pipeline-driven
guidance refinement are follow-ups.
Structs§
- Guidance
- Advisory guidance returned alongside the receive acknowledgement.
- Guidance
Thresholds - Threshold ratios used by
compute_guidance. Decoupled fromOptimizedParamsso callers can supply optimizer-derived values when available and fall back to conservative defaults otherwise. - Position
Close - A terminal event: the producer closed a position. Carries the realized
outcome so Janus can record what actually happened against the guidance it
advised while the position was open. Sent to
POST /api/v1/positions/close. - Position
Event - A snapshot of an open position pushed by the execution side.
- Position
Outcome - A closed-trade record joining a
PositionClosewith the guidance history accumulated inPositionStatewhile the position was open. - Position
State - Rolling per-position state, accumulated across the repeated snapshots a
producer pushes for the same
position_id. Lets guidance depend on a position’s history (peak profit, prior advice) rather than scoring each snapshot in isolation. - Position
Tracker - Stateful refinement layer on top of
compute_guidance. - Trailing
Config - Tunables for the stateful guidance layer in
PositionTracker.
Enums§
- Guidance
Action - Guidance action returned to the execution side for an open position.
- Outcome
Result - Coarse win/loss classification of a closed trade.
Constants§
- FEAR_
ELEVATED_ LEVEL - Fear level (inclusive) at or above which guidance escalates: banks open profit (Reduce) or tightens the stop on a losing position.
- FEAR_
EXIT_ LEVEL - Fear level (inclusive) at or above which guidance exits outright, regardless of P&L — the amygdala equivalent of a crisis regime.
Functions§
- base_
asset - Extract the base asset from a position symbol —
"BTC-USD"→"BTC","ETH/USDT"→"ETH","BTC"→"BTC". Used to look up per-assetOptimizedParamsfrom aParamManager. - compute_
guidance - Compute advisory guidance for an open position.