the market is about to start - can you run /morningfix
2026-04-30 03:42:41
ASSISTANT (hermes, deepseek-v4-pro)
2026-04-30 03:42:41
TOOL (hermes, deepseek-v4-pro)
{"success": true, "name": "trading-bot-data-freshness", "description": "Verify and refresh OpenAlgo trading bot databases. Use when a bot's DB is stale, when checking data readiness before market open, or when backfilling missed trading days. Covers both claude_bot (unified_strategy, JSON state) and lt_3candle_bot (SQLite DB). Handles NFO futures symbols, rollover expiry, and the bot's EOD pipeline for Renko/VIDYA anchor computation.", "tags": [], "related_skills": [], "content": "---\nname: trading-bot-data-freshness\ndescription: Verify and refresh OpenAlgo trading bot databases. Use when a bot's DB is stale, when checking data readiness before market open, or when backfilling missed trading days. Covers both claude_bot (unified_strategy, JSON state) and lt_3candle_bot (SQLite DB). Handles NFO futures symbols, rollover expiry, and the bot's EOD pipeline for Renko/VIDYA anchor computation.\n---\n\n# Trading Bot Data Freshness Check\n\nVerify and refresh data for the two active VPS trading bots.\n\n## Active bots on VPS\n\n1. **claude_bot** — `/home/ubuntu/bots/Claude_bot/unified_strategy.py` (service: `claude_bot.service`)\n - State: JSON files in `state/state_*.json`, NOT SQLite\n - Symbols traded: DLF, INFY, INDUSINDBK (all NFO futures, expiry 26MAY26)\n - Data source: Flattrade + Shoonya via openalgo SDK\n - On startup fetches daily OHLC + 15-min candles in-memory; does NOT persist market data to SQLite\n\n2. **lt_3candle_bot** — `/home/ubuntu/bots/three_candle_bot/lt_3candle_bot.py` (service: `lt_3candle_bot.service`)\n - State: SQLite at `/home/ubuntu/bots/three_candle_bot/lt_3candle.db`\n - Symbol: `LT26MAY26FUT` on `NFO` (Larsen & Toubro futures, NOT `LT` on `NSE`)\n - Tables: `daily_ohlc`, `candles_5min`, `candles_15min`, `renko_bricks`, `vidya_values`, `daily_anchors`\n - Data source: Flattrade history (historical), Kotak (live quotes/orders)\n - EOD script: `lt_3candle_eod.py` builds Renko bricks → VIDYA → tomorrow's anchor\n\n## Monthly Futures Rollover Procedure\n\nNFO futures contracts expire on the last Thursday of every month. After expiry, all bots must be updated to the next month's contract (e.g. `28APR26` → `26MAY26`). This happens every 4 weeks.\n\n### Files to update\n\n| Bot | File | What to change |\n|-----|------|----------------|\n| claude_bot | `/home/ubuntu/bots/Claude_bot/config.py` | `symbol_fut` and `expiry_date` in every profile (active + disabled) |\n| lt_3candle_bot | `/home/ubuntu/bots/three_candle_bot/lt_3candle_bot.py` | `SYMBOL_FUT` and `EXPIRY_DATE` constants |\n| lt_3candle_bot | `/home/ubuntu/bots/three_candle_bot/lt_3candle_eod.py` | `SYMBOL_HIST` constant |\n\n### Exact procedure\n\n1. **Stop both services**:\n ```bash\n sudo systemctl stop claude_bot lt_3candle_bot\n ```\n\n2. **Replace all instances** of the old expiry string (e.g. `28APR26`) with the new one (e.g. `26MAY26`) in all three files. Use `replace_all=true` — the string appears in `symbol_fut` values AND `expiry_date`
... [13273 chars total, truncated]
2026-04-30 03:42:41
TOOL (hermes, deepseek-v4-pro)
{"success": true, "query": "morningfix OR morning_fix", "results": [{"session_id": "20260422_091036_5d9691", "when": "April 22, 2026 at 09:27 AM", "source": "cli", "model": "claude-haiku-4.5", "summary": "The conversation did not contain any mention of \"morningfix\" or \"morning_fix\". The user did not ask about or reference those terms; the session focused on comparing historical data fetching across three trading brokers (Kotak, Shoonya, Flattrade) and troubleshooting a Shoonya web URL outage.\n\nAs a result, there is no information to summarize regarding morningfix/morning_fix.\n\nThe actual topics discussed were:\n\n1. **Historical Data Fetching Comparison**: Shoonya and Flattrade both support full historical data via EODChartData and TPSeries endpoints (Shoonya: 10 intervals, Flattrade: 6 intervals), while Kotak has NO historical data support (returns empty DataFrame). This explains why trading bots (claude_bot, lt_3candle_bot) only use Shoonya/Flattrade.\n\n2. **Shoonya Outage**: The user reported https://shoonya.openalgo.theworkpc.com/ not opening. Investigation found the Gunicorn service running but unresponsive due to expired broker session and stale socket. Restarting the Shoonya Gunicorn service fixed the issue. Key command: `sudo systemctl restart openalgo-shoonya-openalgo.theworkpc.com-shoonya.service`. Service became available again.\n\n3. **Files/References**: Detailed analysis written to `/home/ubuntu/docs/HISTORICAL-DATA-COMPARISON.md` and `/home/ubuntu/docs/SHOONYA-SERVICE-DOWNTIME-REPORT.md`.\n\nNo morningfix-related commands, files, or decisions were encountered."}, {"session_id": "20260422_094745_5e4152", "when": "April 22, 2026 at 09:48 AM", "source": "cli", "model": "glm-5.1", "summary": "## Summary: morningfix / morning_fix\n\nThe session began with the user investigating why trading bots had gone silent—no Telegram status updates were being received. The initial troubleshooting focused on service health (both `claude_bot.service` and `lt_3candle_bot.service` were running) and log analysis. The root cause was identified as **expired broker API sessions** on both the Shoonya and Flattrade OpenAlgo services, causing all `/api/v1/quotes` calls to return `500 INTERNAL SERVER ERROR` with the underlying broker error `\"Session Expired : Invalid Session Key\"`. Position book calls still worked, meaning only quote/price data was affected—without which signals could not be generated and no Telegram alerts were sent.\n\n### Actions Taken & Outcomes\n\n1. **Restarted OpenAlgo broker services** to force re-authentication, which resolved the quotes issue and restored live data flow.\n2. **Fixed `lt_3candle_bot.service`** — the service file pointed to `/home/ubuntu/three_candle_bot/` but the code had been migrated to `/home/ubuntu/bots/three_candle_bot/`. Updated `WorkingDirectory`, `ExecStart`, and log paths, then created the missing `logs/` directory and restarted the service.\n3. **Confirmed Telegram delivery** worked for both bots
... [5494 chars total, truncated]