π Send Taiwan stock pre-market briefings using TWSE, CNYES, OpenAI and Telegram
β‘ 45 views Β· π Crypto Trading & Stock Market
Description
Quick overview
This workflow runs every weekday morning, fetches the latest available TWSE institutional trading and market data plus CNYES headlines, summarizes it with OpenAI into a short briefing, and sends the result as plain text to a Telegram chat.
How it works
- Runs on a cron schedule at 08:00 Monday to Friday in Asia/Taipei.
- Determines the most recent trading day by checking TWSE availability for prior weekdays.
- Pulls TWSE institutional net buy/sell data (T86), TWSE market close data (MI_INDEX) to derive index and limit up/down counts, and the latest CNYES headline news.
- Normalizes and validates the fetched datasets, falls back to βno dataβ messages when sources are unavailable, and prepares prompt variables including an optional watchlist.
- Sends the prepared data to OpenAI (gpt-4o-mini) to generate a structured JSON briefing with a required risk disclaimer.
- Formats the AI JSON into a plain-text message and sends it to the configured Telegram chat via a Telegram bot.
Setup
- Create and select an OpenAI API credential (API key) for the OpenAI node.
- Create and select a Telegram Bot credential (BotFather token) for the Telegram node.
- Message your bot, retrieve the target chat ID via
https://api.telegram.org/bot<TOKEN>/getUpdates, and paste it intotelegramChatIdin the Config step. - Optionally adjust
topN,promptStyle, andwatchlist, then run a manual execution to verify output before activating the schedule.
π Nodes Used
HTTP Request, Telegram, Schedule Trigger, OpenAI
π₯ Import
Download workflow.json and import into n8n:
Workflow menu β Import from File