Alerts

AXIS local alerts: price crosses, drawings, Pine conditions, on-chain spikes. Persist axis.alerts.v1. Not HOOX orders.

This page

Alerts

Abstract

AXIS ships a client-side alert book (src/alerts/) with an Alerts panel. Kinds cover price, percent change, drawing touch, indicator plot conditions, and on-chain TVL spikes. State persists in axis.alerts.v1. Delivery is local to the PWA: browser notifications, an optional HTTPS webhook, and an optional L2 webhook (richer JSON: channel: "l2", message, params snapshot).

These alerts are not HOOX trade-worker orders. Pointing the L2 field at a PYNE/HOOX gateway is possible and dangerous — you are then inventing an execution path the PWA does not certify. Pine alert() and alertcondition() (and strategy alert_message on fills) fire as pine_alert rows when you arm them in the panel. Interpret runs export alerts / alert_conditions; AXIS delivers only the last bar so a full backtest does not dump history. Plot-vs-threshold remains pine_condition.

Alerts panel: price-cross form and empty book

Conceptual model

Diagram

Rendering…

Interface surface

Kinds implemented in src/alerts/:

KindFires when
price_crossPrice crosses a level
price_above / price_belowPrice vs level
pct_changeBar-to-bar (or window) percent move
drawing_touchPrice touches a user drawing’s levels (hline, fib, trend anchors)
pine_conditionApplied indicator plot vs threshold (>, <, cross, …)
pine_alertPine alert() / alertcondition() (and strategy alert_message) on the last bar
onchain_tvl_spikeDefiLlama TVL jump (see On-Chain)
onchain_eventCatalogued on-chain event

UI: src/ui/AlertsPanel.tsx. Persistence key: axis.alerts.v1.

Delivery: enable Notifications in the panel (browser permission), optionally set a compact webhook URL, and/or an L2 webhook. Both URLs must be https (no loopback / private IPs). Live ticks from the chart stream evaluate price, drawing, and indicator kinds; on-chain kinds still fire from the on-chain events plane.

PYNE language alert() / alertcondition() on Flask / pyne-worker is documented at PYNE alerts.

Internals

PathRole
src/alerts/Engine + format + storage
src/ui/AlertsPanel.tsxPanel
src/onchain/TVL spike helpers (buildTvlSpikeEvents)

Invariants & edge cases

  1. Alerts survive reload via local storage, not the Worker D1 script registry.
  2. Closing the tab stops evaluation unless a stream + engine is still running.
  3. On-chain kinds require the on-chain proxy (/api/onchain) to be reachable.
  4. lastRun strategy results are not persisted; do not assume alert history equals a backtest.

Worked examples

  1. Open Alerts panel.
  2. Add price_cross on the active symbol / TF.
  3. Enable browser notifications in the browser, then tick Browser notification on the form.
  4. For an indicator: apply a script, pick its plot, set > / < / cross vs a threshold.
  5. For a drawing: place a horizontal line (or fib), pick it in the form, optionally set a tolerance.
  6. For Pine alert() / alertcondition(): run a strategy, open Alerts, kind pine alert, pick the script and alert() / alertcondition() / both. Optional title filter from the last run. In-browser compile records these in the compiled loop; the Flask/pyne-worker engine uses interpret for scripts that call them.

On-chain: attach a TVL series, then add onchain_tvl_spike (default ~10% day-over-day in buildTvlSpikeEvents).

Failure modes

SymptomCauseFix
No rowsEngine not running / no streamStart live or replay bars
Pine alert() never firesNo pine_alert row armed; or remote compile without AXIS fallbackArm pine alert; AXIS uses interpret on Flask/pyne-worker when the script calls alert() / alertcondition(). In-browser compile records them in the compiled loop.
Pine kind never firesEngine dropped alertsUse Flask interpret; see PYNE alerts
On-chain silentProxy HTML / CORSUse Worker /api/onchain, not the SPA origin
Webhook posted a tradeYou pointed it at HOOXUse pyne-worker instead

See also