Overview
AIOKA can broadcast trading signals, Ghost Trader trade events, and market regime changes directly to your Discord server using Discord webhooks — no bot token or Discord application required. Two channels are supported:- Main signals channel — verdict changes, regime changes
- Ghost Trader trades channel (optional) — trade entries, exits, TP1 fires
Quick Start
Create a Discord webhook
- Open your Discord server.
- Right-click the channel where you want AIOKA signals to appear.
- Click Edit Channel → Integrations → Webhooks → New Webhook.
- Name the webhook (e.g.
AIOKA Signals) and click Copy Webhook URL.
Add the webhook URL to your environment
In your Railway service Restart the service. AIOKA will detect the webhook on next boot and start
posting verdict + regime changes within 60 seconds.
aioka (or local .env):(Optional) Separate Ghost Trader trades
Create a second webhook in your trades channel and set:Trade entries, TP1 fires, and exits will route to this channel instead. If
this variable is unset, all messages go to the main webhook.
Message Types
Verdict Update
Posted to the main channel when the AIOKA Judiciary ruling changes. The verdict poller checks the latest verdict every 60 seconds.Ghost Trader — Trade Entered
Posted to the trades channel the moment a Ghost Trader entry is committed to the database (parallel to the existing Telegram entry alert).Ghost Trader — Trade Closed
Posted to the trades channel on every full close path: TP2, TSL, Stop Loss, Score Sell, Regime Exit, Conviction Exit, and Flash Crash Emergency Exit.TP1 Fired
Posted to the trades channel when the partial 50% sell at TP1 executes and the Break-Even Shield activates.Regime Change
Posted to the main channel when the HMM market regime classifier flips. The regime poller checks every 60 seconds.Configuration Reference
| Env var | Required | Default | Description |
|---|---|---|---|
DISCORD_WEBHOOK_URL | Recommended | empty | Main signals channel webhook. If unset, Discord notifications are disabled. |
DISCORD_GHOST_WEBHOOK_URL | Optional | empty | Ghost Trader trades channel webhook. Falls back to DISCORD_WEBHOOK_URL when unset. |
Telegram Diagnostic Commands
If you also have the AIOKA Telegram bot configured, you can manage Discord from there:| Command | Purpose |
|---|---|
/discord_status | Check whether webhooks are configured + last successful send timestamp |
/discord_test | Send a test message to the Discord channel to verify the webhook is live |
_require_auth).
Rate Limits & Reliability
- Rate limit: AIOKA enforces a global 5-second minimum interval between any two Discord posts to stay well within Discord’s webhook rate limit.
- Truncation: Messages exceeding Discord’s 2,000-character hard limit are
automatically truncated with a
... (truncated)marker. - Graceful degradation: Every Discord call is fire-and-forget and wrapped in
try/except. Discord outages, DNS failures, or invalid webhooks never block
trading logic — they’re logged as
WARNINGand silently dropped. - Restart safety: Verdict + regime polling state is intentionally ephemeral. After a Railway restart, AIOKA establishes a new baseline on the first poll cycle (~60s) — no duplicate alerts and no missed transitions.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
/discord_status says “DISABLED” | DISCORD_WEBHOOK_URL not set | Set the variable in Railway env and redeploy. |
/discord_test returns ❌ | Webhook deleted or invalid URL | Re-create the Discord webhook and update the env var. |
| No verdict updates after deploy | Less than 60s since restart | Wait one poll cycle. The first observed verdict establishes the baseline; the next change fires the alert. |
| Messages truncated mid-line | Message exceeded 2000 chars | Expected — Discord enforces a hard 2000-char limit per webhook payload. |
| Trading not affected by Discord outage | Working as designed | Discord failures are silent. Check Railway logs for discord_send_failed warnings if needed. |
Related Endpoints
/v1/tradingview/signal— same data, polled by Pine Script/v1/integrations/zapier/signal— same data, polled by Zapier / n8n- Webhooks API — programmatic event subscriptions for Basic+ tiers