This commit is contained in:
nusquama
2025-11-12 13:05:59 +01:00
parent 4aaf7d5caa
commit 53425e8128
@@ -0,0 +1,265 @@
Tesla 1day Indicators Tool (Macro-Level Technical AI)
https://n8nworkflows.xyz/workflows/tesla-1day-indicators-tool--macro-level-technical-ai--4098
# Tesla 1day Indicators Tool (Macro-Level Technical AI)
### 1. Workflow Overview
This workflow, **Tesla 1day Indicators Tool (Macro-Level Technical AI)**, is designed to perform daily timeframe technical analysis of Tesla (TSLA) stock price action using six key Alpha Vantage indicators. It is intended for swing and position traders to understand macro-level market sentiment and trend health.
The workflow is **not standalone**; it must be triggered via an external workflow, specifically the Tesla Financial Market Data Analyst Tool. It relies on a secured webhook to fetch pre-processed indicator data, then uses an AI agent powered by OpenAIs GPT-4.1 via LangChain to analyze and summarize the data into a concise market condition report.
**Logical Blocks:**
- **1.1 Input Reception:** Trigger node that receives execution calls and session context from the parent workflow.
- **1.2 AI Agent Setup and Memory:** LangChain AI agent configured with GPT-4.1 and a short-term memory buffer to maintain session context.
- **1.3 Data Retrieval:** HTTP request node fetching Tesla daily interval indicator data via a secured webhook.
- **1.4 AI Processing:** The AI agent processes the fetched indicator data and contextual session memory to output a structured JSON summary of Teslas daily market condition.
---
### 2. Block-by-Block Analysis
#### 1.1 Input Reception
- **Overview:**
This block receives execution triggers and input parameters from the Tesla Financial Market Data Analyst Tool, allowing session linkage and optional contextual messaging.
- **Nodes Involved:**
- `When Executed by Another Workflow`
- **Node Details:**
- **When Executed by Another Workflow**
- **Type:** Execute Workflow Trigger
- **Role:** Entry point; activated when called by another workflow (parent)
- **Configuration:**
- Accepts two inputs: `message` (optional context string), `sessionId` (for session memory linkage)
- **Input:** Trigger from external workflow call
- **Output:** Passes inputs downstream to AI agent
- **Version Requirements:** n8n 0.188+ recommended for Execute Workflow Trigger node stability
- **Potential Failures:** Missing required inputs, workflow execution errors if parent workflow misconfigured
- **Sticky Note:**
> Trigger from Parent Workflow: This node activates the workflow when called to execute Workflow action from the Tesla Financial Market Analyst Tool. Ensure proper inputs `message`, `sessionId` are passed.
---
#### 1.2 AI Agent Setup and Memory
- **Overview:**
Configures the AI agent using LangChain with OpenAI GPT-4.1 for interpreting Teslas daily technical indicators. Maintains short-term memory to ensure session consistency across multiple invocations.
- **Nodes Involved:**
- `Tesla 1day Indicators Agent`
- `OpenAI Chat Model`
- `Simple Memory`
- **Node Details:**
- **Tesla 1day Indicators Agent**
- **Type:** LangChain Agent Node
- **Role:** Core AI logic interpreting indicator data and generating output
- **Configuration:**
- Uses input `message` as prompt text
- System message defines role as Tesla 1-Day Technical Indicators Analyst AI
- Specifies access to 6 Alpha Vantage indicators and their meaning
- Details data workflow: receives latest 20 trimmed indicator values from webhook
- Outputs structured JSON summary with `summary`, `timeframe`, and `indicators` fields
- Integrates with `OpenAI Chat Model` as language model and `Simple Memory` as memory buffer
- **Key Expressions:**
- Prompt text: `={{ $json.message }}` forwarded from trigger
- System message contains detailed instructions and output format
- **Inputs:**
- Accepts inputs from `When Executed by Another Workflow` and from `1day Data` (indicator data) and `Simple Memory` (context)
- **Outputs:**
- AI-generated JSON summary
- **Version Requirements:** n8n LangChain nodes version 1.8+ recommended for latest features
- **Potential Failures:**
- Invalid or missing input data
- OpenAI API errors (auth, rate limits, timeouts)
- Prompt interpretation errors leading to malformed output
- **Sticky Note:**
> Tesla 1-Day Technical Indicators AI
> • Processes the webhook data and performs daily timeframe evaluation for TSLA.
> • Outputs a JSON summary of market condition, trend state, and all indicator values.
> • This feeds into the broader Tesla Financial Market Data Analyst.
- **OpenAI Chat Model**
- **Type:** LangChain OpenAI Chat Model Node
- **Role:** Provides GPT-4.1 language model processing for the LangChain agent
- **Configuration:**
- Model set to `gpt-4.1`
- Credentials linked to OpenAI API key
- **Inputs:** Receives prompt from agent node
- **Outputs:** Returns AI-generated completions to agent
- **Potential Failures:**
- API key misconfiguration
- Network issues
- OpenAI rate limits or quota exhaustion
- **Sticky Note:**
> GPT Model for Reasoning
> Utilizes OpenAI GPT-4.1 to interpret technical indicators and generate long-term trend analysis and structured JSON output.
- **Simple Memory**
- **Type:** LangChain Memory Buffer Window Node
- **Role:** Maintains short-term session memory for consistent AI contextual reasoning
- **Configuration:** Default memory buffer, no special parameters
- **Inputs:** Receives sessionId from trigger node
- **Outputs:** Supplies memory context to AI agent
- **Potential Failures:**
- Loss of session context if sessionId is missing or inconsistent
- **Sticky Note:**
> Short-Term Memory Module
> Maintains context across requests within the same session. Supports consistent logic between indicator evaluations for the Tesla Financial Market Analyst Tool.
---
#### 1.3 Data Retrieval
- **Overview:**
Fetches Tesla daily timeframe technical indicator data as JSON from a secured webhook endpoint, which itself queries Alpha Vantages Premium API and returns trimmed latest 20 values.
- **Nodes Involved:**
- `1day Data`
- **Node Details:**
- **1day Data**
- **Type:** HTTP Request Node
- **Role:** Retrieves prepared Tesla daily indicator data for input to AI agent
- **Configuration:**
- Method: GET
- URL: `https://treasurium.app.n8n.cloud/webhook/1dayData` (secured webhook)
- No additional query parameters or headers set here; credentials handled by webhook service
- **Inputs:** None (triggered downstream from AI agent node with integration)
- **Outputs:** JSON containing latest 20 trimmed values for RSI, BBANDS, SMA, EMA, ADX, MACD
- **Potential Failures:**
- Network timeouts
- Webhook not active or inaccessible
- Data format changes from webhook source
- Alpha Vantage API quota or auth issues propagated through webhook
- **Sticky Note:**
> 1-Day Indicator Data from Alpha Vantage
> Makes an HTTP call to a secured webhook, which fetches Tesla 1-day interval indicators (RSI, BBANDS, SMA, EMA, ADX, MACD) via Alpha Vantage Premium API. Only the latest 20 values are returned, cleaned and trimmed.
---
#### 1.4 AI Processing and Output Generation
- **Overview:**
The LangChain AI agent combines the incoming webhook data and memory context to analyze Teslas daily technical indicators, inferring trend status, volatility, and momentum, and returns a structured JSON summary used by the parent financial analyst tool.
- **Nodes Involved:**
- `Tesla 1day Indicators Agent` (as the final processor)
- **Node Details:**
- See details in Block 1.2 for the agent nodes processing configuration and output.
- Output Format Example:
```json
{
"summary": "TSLA shows consolidation on the daily chart. RSI is neutral, BBANDS are contracting, and MACD is flattening.",
"timeframe": "1d",
"indicators": {
"RSI": 51.3,
"BBANDS": {
"upper": 192.80,
"lower": 168.20,
"middle": 180.50,
"close": 179.90
},
"SMA": 181.10,
"EMA": 179.75,
"ADX": 15.8,
"MACD": {
"macd": -0.25,
"signal": -0.20,
"histogram": -0.05
}
}
}
```
- Potential Failures: See AI Agent node details
---
### 3. Summary Table
| Node Name | Node Type | Functional Role | Input Node(s) | Output Node(s) | Sticky Note |
|-------------------------------|---------------------------------------|-------------------------------------------------|----------------------------------|-----------------------------------|---------------------------------------------------------------------------------------------------------------|
| When Executed by Another Workflow | Execute Workflow Trigger | Entry trigger from parent workflow with context | External call | Tesla 1day Indicators Agent | Trigger from Parent Workflow: This node activates the workflow when called to execute Workflow action from the Tesla Financial Market Analyst Tool. Ensure proper inputs `message`, `sessionId` are passed. |
| Tesla 1day Indicators Agent | LangChain Agent | Core AI agent processing indicator data | When Executed by Another Workflow, 1day Data, Simple Memory | - | Tesla 1-Day Technical Indicators AI: Processes webhook data, performs daily evaluation, outputs JSON summary feeding Tesla Financial Market Data Analyst. |
| OpenAI Chat Model | LangChain OpenAI Chat Model | Provides GPT-4.1 LLM for AI reasoning | Tesla 1day Indicators Agent | Tesla 1day Indicators Agent | GPT Model for Reasoning: Uses OpenAI GPT-4.1 to interpret technical indicators and generate JSON output. |
| Simple Memory | LangChain Memory Buffer Window | Maintains session context for consistent AI logic | When Executed by Another Workflow | Tesla 1day Indicators Agent | Short-Term Memory Module: Maintains context across requests within the same session for consistent logic. |
| 1day Data | HTTP Request Node | Fetches Tesla daily technical indicator data | None | Tesla 1day Indicators Agent | 1-Day Indicator Data from Alpha Vantage: Calls secured webhook returning trimmed latest 20 values for RSI, BBANDS, SMA, EMA, ADX, MACD. |
---
### 4. Reproducing the Workflow from Scratch
1. **Create Trigger Node**
- Add **Execute Workflow Trigger** node named `When Executed by Another Workflow`
- Configure inputs: `message` (string, optional), `sessionId` (string)
- Position early in workflow (e.g., x=160, y=-200)
2. **Set Up LangChain AI Agent**
- Add **LangChain Agent** node named `Tesla 1day Indicators Agent`
- Set parameter `text` to expression: `={{ $json.message }}`
- Under options, paste the detailed system message specifying the AI role, indicators, data workflow, and required JSON output format (refer to overview for full system message)
- Connect input from `When Executed by Another Workflow` node
3. **Configure OpenAI Chat Model**
- Add **LangChain OpenAI Chat Model** node named `OpenAI Chat Model`
- Set model to `gpt-4.1`
- Connect this node as the `ai_languageModel` credential/source in the LangChain Agent node
- Attach valid OpenAI GPT-4.1 API credentials to this node
4. **Add Short-Term Memory Module**
- Add **LangChain Memory Buffer Window** node named `Simple Memory`
- No special parameters needed; defaults suffice
- Connect input from `When Executed by Another Workflow` node (to receive sessionId)
- Link output as `ai_memory` to the LangChain Agent node
5. **Add HTTP Request Node for Data Fetching**
- Add **HTTP Request** node named `1day Data`
- Set method to GET
- Set URL to: `https://treasurium.app.n8n.cloud/webhook/1dayData`
- No additional query parameters or headers required here
- Connect output as `ai_tool` input to the LangChain Agent node
6. **Wire Connections**
- `When Executed by Another Workflow` connects main output to `Tesla 1day Indicators Agent` main input
- `Simple Memory` output connects to `Tesla 1day Indicators Agent` memory input
- `OpenAI Chat Model` output connects to `Tesla 1day Indicators Agent` language model input
- `1day Data` output connects to `Tesla 1day Indicators Agent` tool input
7. **Credentials Setup**
- Create and add `OpenAI GPT-4.1` API key credential for the OpenAI Chat Model node
- Ensure the secured webhook at `https://treasurium.app.n8n.cloud/webhook/1dayData` is active and accessible (provided by Tesla Quant Technical Indicators Webhooks Tool)
- Alpha Vantage Premium API key is required for the webhook service but managed externally, not within this workflow
8. **Naming and Positioning**
- Name the workflow `Tesla 1day Indicators Tool n8n`
- Arrange nodes logically for readability: Trigger → Memory + Data Fetch + OpenAI Model → AI Agent
9. **Testing**
- Trigger the workflow via `Execute Workflow` from the Tesla Financial Market Data Analyst Tool, passing `message` (optional) and `sessionId`
- Inspect the JSON output from the LangChain Agent node for correctness and completeness
---
### 5. General Notes & Resources
| Note Content | Context or Link |
|------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------|
| This tool is designed to be triggered only via the Tesla Financial Market Data Analyst Tool and is not standalone. | Integration dependency |
| Requires active webhook `/1dayData` from Tesla Quant Technical Indicators Webhooks Tool to supply indicator data. | https://n8n.io/workflows/4095-tesla-quant-technical-indicators-webhooks-tool/ |
| Uses Alpha Vantage Premium API key managed externally by the webhook service for indicator data retrieval. | Alpha Vantage API Documentation: https://www.alphavantage.co/documentation/ |
| LangChain AI agent uses OpenAI GPT-4.1 for advanced technical analysis and structured output generation. | OpenAI GPT-4 API: https://platform.openai.com/docs/models/gpt-4 |
| Session memory module ensures context continuity for consistent AI reasoning across multiple executions. | Useful for multi-step or multi-timeframe analysis in parent workflow |
| Workflow and intellectual property © 2025 Treasurium Capital Limited Company, created by Don Jayamaha. | LinkedIn: https://linkedin.com/in/donjayamahajr |
---
This document provides a comprehensive, structured reference for understanding, reproducing, and maintaining the Tesla 1day Indicators Tool workflow. It covers node-by-node configurations, logical dependencies, potential failure points, and integration requirements for seamless operation within the Tesla financial data ecosystem.