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.
Conceptual model
Rendering…
Interface surface
Kinds implemented in src/alerts/:
| Kind | Fires when |
|---|---|
price_cross | Price crosses a level |
price_above / price_below | Price vs level |
pct_change | Bar-to-bar (or window) percent move |
drawing_touch | Price touches a user drawing’s levels (hline, fib, trend anchors) |
pine_condition | Applied indicator plot vs threshold (>, <, cross, …) |
pine_alert | Pine alert() / alertcondition() (and strategy alert_message) on the last bar |
onchain_tvl_spike | DefiLlama TVL jump (see On-Chain) |
onchain_event | Catalogued 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
| Path | Role |
|---|---|
src/alerts/ | Engine + format + storage |
src/ui/AlertsPanel.tsx | Panel |
src/onchain/ | TVL spike helpers (buildTvlSpikeEvents) |
Invariants & edge cases
- Alerts survive reload via local storage, not the Worker D1 script registry.
- Closing the tab stops evaluation unless a stream + engine is still running.
- On-chain kinds require the on-chain proxy (
/api/onchain) to be reachable. lastRunstrategy results are not persisted; do not assume alert history equals a backtest.
Worked examples
- Open Alerts panel.
- Add
price_crosson the active symbol / TF. - Enable browser notifications in the browser, then tick Browser notification on the form.
- For an indicator: apply a script, pick its plot, set
>/</crossvs a threshold. - For a drawing: place a horizontal line (or fib), pick it in the form, optionally set a tolerance.
- For Pine
alert()/alertcondition(): run a strategy, open Alerts, kind pine alert, pick the script andalert()/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
| Symptom | Cause | Fix |
|---|---|---|
| No rows | Engine not running / no stream | Start live or replay bars |
Pine alert() never fires | No pine_alert row armed; or remote compile without AXIS fallback | Arm 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 fires | Engine dropped alerts | Use Flask interpret; see PYNE alerts |
| On-chain silent | Proxy HTML / CORS | Use Worker /api/onchain, not the SPA origin |
| Webhook posted a trade | You pointed it at HOOX | Use pyne-worker instead |