feat(discord): actionable trade idea alerts for prediction markets#99
Open
webframp wants to merge 5 commits intocalesthio:masterfrom
Open
feat(discord): actionable trade idea alerts for prediction markets#99webframp wants to merge 5 commits intocalesthio:masterfrom
webframp wants to merge 5 commits intocalesthio:masterfrom
Conversation
The custom .env parser did not handle quoted values, causing passwords and API keys containing special characters (|, ^, ", >, [, etc.) to include the quote characters as part of the value or parse incorrectly. This adds quote stripping for both single and double-quoted values, matching the behavior of dotenv and other standard .env parsers. Co-authored-by: Shelley <shelley@exe.dev>
Slash command registration was called before client.login(), so client.user.id was undefined and fell back to the string "me", causing a Discord API error: Invalid Form Body application_id[NUMBER_TYPE_COERCE]: Value "me" is not snowflake. This moves command registration into the ready event handler and attaches that handler before login() to avoid a race condition where the ready event fires before the listener is attached. Co-authored-by: Shelley <shelley@exe.dev>
When running behind a reverse proxy or on a remote host, the /status command in Telegram and Discord shows http://localhost:PORT which is not reachable by users. Adds a PUBLIC_URL env var that, when set, replaces the hardcoded localhost URL in bot status responses. Falls back to localhost when unset, so existing setups are unaffected. Example: PUBLIC_URL=https://my-crucix.example.com Co-authored-by: Shelley <shelley@exe.dev>
Three issues when using Gemini 2.5 Flash/Pro models: 1. Gemini 2.5 models return multi-part responses where the first part is a "thinking" part and the second is the actual content. The provider only read parts[0], getting thinking text instead of the response. Fixed by filtering out thought parts. 2. Thinking tokens consumed the maxOutputTokens budget, causing truncated JSON responses (cut mid-object). Added thinkingConfig with a 1024-token budget to keep reasoning concise, and bumped idea generation to 8192 output tokens. 3. The ideas response parser failed on Gemini output because it only handled code blocks at string boundaries. Rewrote to extract code blocks from anywhere in the response and fall back to finding the JSON array if no code block is present. Co-authored-by: Shelley <shelley@exe.dev>
Adds automatic Discord alerts for HIGH confidence, short-horizon (Intraday/Days/Weeks) trade ideas after each sweep. Designed for users acting on prediction markets like Kalshi. Each alert includes: - Ticker, direction (LONG/SHORT/HEDGE), confidence, and horizon - Full rationale and risk from the LLM analysis - Supporting OSINT signals that back the thesis - A prediction market angle suggesting relevant contract types (oil/gold/rates/indexes/defense/crypto with contextual guidance) Features: - Filters: only HIGH confidence + actionable types (LONG/SHORT/HEDGE) - Dedup: same idea title suppressed for 6 hours - Color-coded embeds: green=LONG, red=SHORT, gray=HEDGE - Works with any LLM provider Wired into the sweep cycle in server.mjs — fires after idea generation, independent of the delta-based alert pipeline. Co-authored-by: Shelley <shelley@exe.dev>
Author
|
An idea I worked through a bit but haven't fully used, since prediction market still seem super volatile to me. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds automatic Discord alerts for high-confidence, short-horizon trade ideas — designed for users acting on prediction markets (Kalshi, Polymarket, etc.) or short-term trades.
How It Works
After each sweep, if the LLM generates trade ideas, the new
sendActionableIdeas()method filters for:Ideas that pass the filter are posted as rich Discord embeds.
What Each Alert Contains
The prediction market angle adapts to the asset class — oil, gold, rates, indexes, defense/geopolitical, crypto — with specific guidance rather than generic advice.
Deduplication
Same idea title won't re-alert for 6 hours, so sweeps every 15 minutes won't spam the channel with the same thesis.
Embed Styling
Changes
lib/alerts/discord.mjs: AddedsendActionableIdeas(),_kalshiAngle(), and idea dedup logicserver.mjs: Wired into sweep cycle (step 7, after idea generation)Example
Ideas that would trigger alerts from a typical sweep: