n8n-nodes-twelve-data 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +19 -0
- package/README.md +442 -0
- package/dist/credentials/TwelveDataApi.credentials.d.ts +13 -0
- package/dist/credentials/TwelveDataApi.credentials.js +72 -0
- package/dist/credentials/TwelveDataApi.credentials.js.map +1 -0
- package/dist/icons/github.dark.svg +3 -0
- package/dist/icons/github.svg +3 -0
- package/dist/icons/twelvedata.dark.svg +29 -0
- package/dist/icons/twelvedata.svg +18 -0
- package/dist/nodes/TwelveData/TwelveData.node.d.ts +4 -0
- package/dist/nodes/TwelveData/TwelveData.node.js +173 -0
- package/dist/nodes/TwelveData/TwelveData.node.js.map +1 -0
- package/dist/nodes/TwelveData/TwelveData.node.json +47 -0
- package/dist/nodes/TwelveData/operations/advanced.d.ts +6 -0
- package/dist/nodes/TwelveData/operations/advanced.js +168 -0
- package/dist/nodes/TwelveData/operations/advanced.js.map +1 -0
- package/dist/nodes/TwelveData/operations/coreData.d.ts +13 -0
- package/dist/nodes/TwelveData/operations/coreData.js +471 -0
- package/dist/nodes/TwelveData/operations/coreData.js.map +1 -0
- package/dist/nodes/TwelveData/operations/fundamentals.d.ts +9 -0
- package/dist/nodes/TwelveData/operations/fundamentals.js +440 -0
- package/dist/nodes/TwelveData/operations/fundamentals.js.map +1 -0
- package/dist/nodes/TwelveData/operations/index.d.ts +6 -0
- package/dist/nodes/TwelveData/operations/index.js +21 -0
- package/dist/nodes/TwelveData/operations/index.js.map +1 -0
- package/dist/nodes/TwelveData/operations/marketIntelligence.d.ts +5 -0
- package/dist/nodes/TwelveData/operations/marketIntelligence.js +156 -0
- package/dist/nodes/TwelveData/operations/marketIntelligence.js.map +1 -0
- package/dist/nodes/TwelveData/operations/referenceData.d.ts +9 -0
- package/dist/nodes/TwelveData/operations/referenceData.js +451 -0
- package/dist/nodes/TwelveData/operations/referenceData.js.map +1 -0
- package/dist/nodes/TwelveData/operations/technicalIndicators.d.ts +2 -0
- package/dist/nodes/TwelveData/operations/technicalIndicators.js +1110 -0
- package/dist/nodes/TwelveData/operations/technicalIndicators.js.map +1 -0
- package/dist/nodes/TwelveData/parameters/common.d.ts +11 -0
- package/dist/nodes/TwelveData/parameters/common.js +163 -0
- package/dist/nodes/TwelveData/parameters/common.js.map +1 -0
- package/dist/nodes/TwelveData/parameters/index.d.ts +2 -0
- package/dist/nodes/TwelveData/parameters/index.js +21 -0
- package/dist/nodes/TwelveData/parameters/index.js.map +1 -0
- package/dist/nodes/TwelveData/parameters/indicatorParams.d.ts +31 -0
- package/dist/nodes/TwelveData/parameters/indicatorParams.js +575 -0
- package/dist/nodes/TwelveData/parameters/indicatorParams.js.map +1 -0
- package/dist/nodes/TwelveData/utils/errorSanitizer.d.ts +2 -0
- package/dist/nodes/TwelveData/utils/errorSanitizer.js +33 -0
- package/dist/nodes/TwelveData/utils/errorSanitizer.js.map +1 -0
- package/dist/package.json +69 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +69 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright 2022 n8n
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
5
|
+
the Software without restriction, including without limitation the rights to
|
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
7
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
8
|
+
so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
# n8n-nodes-twelve-data
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
This is an n8n community node for the [Twelve Data API](https://twelvedata.com). It provides access to comprehensive financial market data including stocks, forex, cryptocurrencies, ETFs, and more.
|
|
6
|
+
|
|
7
|
+
[n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/reference/license/) workflow automation platform.
|
|
8
|
+
|
|
9
|
+
## Table of Contents
|
|
10
|
+
|
|
11
|
+
- [Installation](#installation)
|
|
12
|
+
- [Credentials](#credentials)
|
|
13
|
+
- [Compatibility](#compatibility)
|
|
14
|
+
- [Usage](#usage)
|
|
15
|
+
- [Testing Status](#testing-status)
|
|
16
|
+
- [Example Workflows](#example-workflows)
|
|
17
|
+
- [Known Limitations](#known-limitations)
|
|
18
|
+
- [Resources](#resources)
|
|
19
|
+
- [Version History](#version-history)
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.
|
|
24
|
+
|
|
25
|
+
### For n8n Cloud
|
|
26
|
+
|
|
27
|
+
1. Go to **Settings > Community Nodes**
|
|
28
|
+
2. Select **Install**
|
|
29
|
+
3. Enter `n8n-nodes-twelve-data` in the **Enter npm package name** field
|
|
30
|
+
4. Select **Install**
|
|
31
|
+
|
|
32
|
+
### For Self-Hosted n8n
|
|
33
|
+
|
|
34
|
+
1. Go to **Settings > Community Nodes**
|
|
35
|
+
2. Select **Install**
|
|
36
|
+
3. Enter `n8n-nodes-twelve-data` in the **Enter npm package name** field
|
|
37
|
+
4. Select **Install**
|
|
38
|
+
|
|
39
|
+
Alternatively, install via npm in your n8n installation directory:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm install n8n-nodes-twelve-data
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Then restart n8n.
|
|
46
|
+
|
|
47
|
+
## Credentials
|
|
48
|
+
|
|
49
|
+
To use this node, you need a Twelve Data API key.
|
|
50
|
+
|
|
51
|
+
### Quick Setup
|
|
52
|
+
|
|
53
|
+
1. **Sign up** at [twelvedata.com](https://twelvedata.com)
|
|
54
|
+
2. **Get your free API key** from the dashboard
|
|
55
|
+
3. In n8n: **Settings → Credentials → Create → "Twelve Data API"**
|
|
56
|
+
4. **Paste your key** and click **Test**
|
|
57
|
+
5. **Save** your credential
|
|
58
|
+
|
|
59
|
+
### Authentication Methods
|
|
60
|
+
|
|
61
|
+
Choose between two authentication methods:
|
|
62
|
+
|
|
63
|
+
- **Header (Recommended)** - Sends API key in Authorization header
|
|
64
|
+
- More secure, not visible in URLs
|
|
65
|
+
- Best for production use
|
|
66
|
+
|
|
67
|
+
- **Query Parameter** - Adds API key to URL
|
|
68
|
+
- Simpler for testing
|
|
69
|
+
- Good for debugging
|
|
70
|
+
|
|
71
|
+
### Detailed Instructions
|
|
72
|
+
|
|
73
|
+
For step-by-step instructions with screenshots, see:
|
|
74
|
+
- **[Credentials Setup Guide](docs/CREDENTIALS_SETUP.md)** - Complete walkthrough
|
|
75
|
+
- **[Credentials Documentation](docs/CREDENTIALS.md)** - Technical details
|
|
76
|
+
|
|
77
|
+
### Demo API Key
|
|
78
|
+
|
|
79
|
+
For quick testing, use the demo API key: `demo`
|
|
80
|
+
- Limited functionality
|
|
81
|
+
- Not suitable for production
|
|
82
|
+
- Replace with your personal key for real use
|
|
83
|
+
|
|
84
|
+
## Compatibility
|
|
85
|
+
|
|
86
|
+
- **Minimum n8n version:** 1.0.0
|
|
87
|
+
- **Tested up to:** Latest version
|
|
88
|
+
|
|
89
|
+
## Usage
|
|
90
|
+
|
|
91
|
+
### Available Operations
|
|
92
|
+
|
|
93
|
+
The Twelve Data node provides access to **142 API endpoints** organized into 6 main resource categories:
|
|
94
|
+
|
|
95
|
+
#### Core Data (Market Data)
|
|
96
|
+
- **Get Quote** - Real-time price quotes with bid, ask, open, high, low, close, volume
|
|
97
|
+
- **Get Price** - Lightweight current price lookup
|
|
98
|
+
- **Get Time Series** - Historical OHLCV data with customizable intervals (1min to 1month)
|
|
99
|
+
- **Get End of Day Price** - Daily closing prices for specific dates
|
|
100
|
+
- **Get Exchange Rate** - Real-time currency conversion rates
|
|
101
|
+
- **Currency Conversion** - Convert amounts between currencies
|
|
102
|
+
|
|
103
|
+
#### Reference Data
|
|
104
|
+
- **List Stocks** - Browse and filter available stock symbols
|
|
105
|
+
- **List Forex Pairs** - Available currency pairs
|
|
106
|
+
- **List Cryptocurrencies** - Supported crypto assets
|
|
107
|
+
- **List ETFs** - Exchange-traded funds
|
|
108
|
+
- **List Indices** - Market indices (S&P 500, NASDAQ, etc.)
|
|
109
|
+
- **List Exchanges** - Trading venues and their details
|
|
110
|
+
- **Symbol Search** - Search for symbols by name or ticker
|
|
111
|
+
- **Get Market State** - Check if markets are open or closed
|
|
112
|
+
|
|
113
|
+
#### Technical Indicators (91 operations)
|
|
114
|
+
- **Moving Averages** (9): SMA, EMA, DEMA, TEMA, WMA, TRIMA, KAMA, MAMA, T3
|
|
115
|
+
- **Momentum Indicators** (16): RSI, MACD, ADX, CCI, MOM, ROC, STOCH, TRIX, etc.
|
|
116
|
+
- **Volatility Indicators** (5): ATR, BBANDS, NATR, SUPERTREND, TRANGE
|
|
117
|
+
- **Volume Indicators** (4): AD, ADOSC, OBV, VWAP
|
|
118
|
+
- **Trend Indicators** (10): AROON, SAR, ICHIMOKU, HT_TRENDMODE, etc.
|
|
119
|
+
- **Statistical Functions** (9): BETA, CORREL, LINEARREG, STDDEV, VAR, etc.
|
|
120
|
+
- **Overlap Studies** (14): AVGPRICE, MEDPRICE, MIDPOINT, TYPPRICE, etc.
|
|
121
|
+
- **Math Transform** (25): ACOS, ADD, ASIN, ATAN, COS, EXP, LN, LOG10, MAX, MIN, etc.
|
|
122
|
+
|
|
123
|
+
#### Fundamentals (16 operations)
|
|
124
|
+
- **Get Profile** - Company information (sector, industry, employees, description)
|
|
125
|
+
- **Get Dividends** - Historical dividend payment records
|
|
126
|
+
- **Get Earnings** - Historical and upcoming earnings data
|
|
127
|
+
- **Get Statistics** - Key financial statistics and metrics
|
|
128
|
+
- **Get Balance Sheet** - Company balance sheet data
|
|
129
|
+
- **Get Cash Flow** - Cash flow statement data
|
|
130
|
+
- **Get Income Statement** - Income statement data
|
|
131
|
+
- **Get Fund Holders** - Mutual fund ownership data
|
|
132
|
+
- **Get Insider Transactions** - Insider buying and selling activity
|
|
133
|
+
- **Get Institutional Holders** - Institutional ownership data
|
|
134
|
+
- **Get Key Executives** - Company executive information
|
|
135
|
+
- **Get Earnings Calendar** - Upcoming earnings announcements
|
|
136
|
+
- **Get IPO Calendar** - Upcoming IPO listings
|
|
137
|
+
- **Get Stock Splits** - Historical stock split data
|
|
138
|
+
- **Get Options Chain** - 🚧 Planned API endpoint
|
|
139
|
+
- **Get Options Expiration** - 🚧 Planned API endpoint
|
|
140
|
+
|
|
141
|
+
#### Market Intelligence (8 operations)
|
|
142
|
+
- **Get Analyst Ratings** - Consensus recommendations
|
|
143
|
+
- **Get Price Target** - Analyst price predictions
|
|
144
|
+
- **Get Recommendations** - Recommendation trends
|
|
145
|
+
- **Get Earnings Estimate** - Forward-looking earnings estimates
|
|
146
|
+
- **Get Revenue Estimate** - Revenue estimates
|
|
147
|
+
- **Get EPS Trend** - Earnings per share trend data
|
|
148
|
+
- **Get Growth Estimates** - Growth estimates
|
|
149
|
+
- **Get Economic Calendar** - Upcoming economic events
|
|
150
|
+
|
|
151
|
+
#### Advanced (3 operations)
|
|
152
|
+
- **API Usage** - Get API usage statistics and remaining credits
|
|
153
|
+
- **Batch Request** - Get multiple data types for multiple symbols in one request
|
|
154
|
+
- **Get Logo** - Get company logo URL
|
|
155
|
+
|
|
156
|
+
### Example Workflows
|
|
157
|
+
|
|
158
|
+
#### 1. Get Stock Quote
|
|
159
|
+
```
|
|
160
|
+
Trigger → Twelve Data (Quote) → Process Data
|
|
161
|
+
```
|
|
162
|
+
Get real-time price for AAPL, MSFT, or any stock.
|
|
163
|
+
|
|
164
|
+
#### 2. Monitor Crypto Prices
|
|
165
|
+
```
|
|
166
|
+
Schedule → Twelve Data (Quote) → If Price > X → Send Alert
|
|
167
|
+
```
|
|
168
|
+
Set up price alerts for Bitcoin, Ethereum, etc.
|
|
169
|
+
|
|
170
|
+
#### 3. Technical Analysis
|
|
171
|
+
```
|
|
172
|
+
Twelve Data (Time Series) → Twelve Data (RSI) → Make Decision
|
|
173
|
+
```
|
|
174
|
+
Calculate RSI indicator and trigger trades.
|
|
175
|
+
|
|
176
|
+
#### 4. Currency Conversion
|
|
177
|
+
```
|
|
178
|
+
Twelve Data (Exchange Rate) → Calculate → Store Result
|
|
179
|
+
```
|
|
180
|
+
Convert between any currency pairs.
|
|
181
|
+
|
|
182
|
+
### Tips
|
|
183
|
+
|
|
184
|
+
- **Start with the demo key** for testing
|
|
185
|
+
- **Use caching** to reduce API calls
|
|
186
|
+
- **Monitor rate limits** in your Twelve Data dashboard
|
|
187
|
+
- **Batch requests** when possible
|
|
188
|
+
- **See [OpenAPI Analysis](docs/OPENAPI_ANALYSIS.md)** for endpoint details
|
|
189
|
+
|
|
190
|
+
## Testing Status
|
|
191
|
+
|
|
192
|
+
This node is **production-ready** with thorough testing completed on all endpoints accessible with the free Twelve Data API tier.
|
|
193
|
+
|
|
194
|
+
### What "Production-Ready" Means
|
|
195
|
+
|
|
196
|
+
All operations that can be tested with a free Twelve Data account have been thoroughly tested and verified working. This represents comprehensive coverage of the core functionality that most users will need.
|
|
197
|
+
|
|
198
|
+
**Testing Highlights:**
|
|
199
|
+
- ✅ 100% success rate on all testable free-tier endpoints
|
|
200
|
+
- ✅ Comprehensive error handling validated
|
|
201
|
+
- ✅ Parameter variations tested (stocks, forex, crypto)
|
|
202
|
+
- ✅ Integration testing with other n8n nodes completed
|
|
203
|
+
- ✅ UI/UX validation passed
|
|
204
|
+
|
|
205
|
+
### Testing Breakdown by Category
|
|
206
|
+
|
|
207
|
+
| Category | Tested | Status | Notes |
|
|
208
|
+
|----------|--------|--------|-------|
|
|
209
|
+
| **Core Data** | 8/9 operations | ✅ Production Ready | 1 planned endpoint not yet in REST API |
|
|
210
|
+
| **Fundamentals** | 10/16 operations | ✅ Production Ready | 6 require paid API tier |
|
|
211
|
+
| **Reference Data** | 15/15 operations | ✅ Production Ready | 100% coverage |
|
|
212
|
+
| **Market Intelligence** | 7/8 operations | ✅ Production Ready | Comprehensive testing completed |
|
|
213
|
+
| **Advanced** | 3/3 operations | ✅ Production Ready | 100% coverage |
|
|
214
|
+
| **Technical Indicators** | 91 operations | ⚠️ BETA | Functional, pending paid tier testing |
|
|
215
|
+
|
|
216
|
+
**API Tier Requirements:**
|
|
217
|
+
- **Free Tier (Fully Tested):** Core data, reference data, company profiles, market intelligence
|
|
218
|
+
- **Paid Tier Required:** Advanced fundamentals (earnings, dividends, statistics), calendars
|
|
219
|
+
- **Planned Endpoints:** Options chain, options expiration, complex data (not yet in REST API)
|
|
220
|
+
|
|
221
|
+
### Test Documentation
|
|
222
|
+
|
|
223
|
+
- **[Testing Log](docs/TESTING_LOG.md)** - Complete test results with JSON responses
|
|
224
|
+
- **[Integration Testing](docs/INTEGRATION_TESTING.md)** - Workflow integration tests
|
|
225
|
+
- **[Testing Plan](docs/TESTING_PLAN.md)** - Original test plan and structure
|
|
226
|
+
|
|
227
|
+
### Key Findings
|
|
228
|
+
|
|
229
|
+
- ✅ All free-tier endpoints working correctly
|
|
230
|
+
- ✅ Error handling validated (400, 401, 404, 422 status codes)
|
|
231
|
+
- ✅ Parameter variations tested (stocks, forex, crypto, intervals, filters)
|
|
232
|
+
- ✅ Date range filtering confirmed working
|
|
233
|
+
- ✅ Country and exchange filters validated
|
|
234
|
+
- ✅ Output size limiting verified
|
|
235
|
+
- ✅ Zero critical issues found
|
|
236
|
+
|
|
237
|
+
## Example Workflows
|
|
238
|
+
|
|
239
|
+
Ready-to-import workflow examples are available in the [`examples/`](examples/) directory:
|
|
240
|
+
|
|
241
|
+
| Workflow | Description | Nodes Used |
|
|
242
|
+
|----------|-------------|------------|
|
|
243
|
+
| [Stock Price to Sheets](examples/stock-price-to-sheets.json) | Fetch stock quotes and save to Google Sheets | Twelve Data, Google Sheets |
|
|
244
|
+
| [Crypto Alert Webhook](examples/crypto-alert-webhook.json) | Send webhook alerts on price changes | Twelve Data, IF, HTTP Request |
|
|
245
|
+
| [Market Data Conditional](examples/market-data-conditional.json) | Route data based on market direction | Twelve Data, IF, Set |
|
|
246
|
+
| [Multi-Symbol Loop](examples/multi-symbol-loop.json) | Process multiple symbols in a loop | Twelve Data, Split, Aggregate |
|
|
247
|
+
| [Forex Rate Comparison](examples/forex-rate-comparison.json) | Compare multiple forex pairs | Twelve Data, Merge, Set |
|
|
248
|
+
|
|
249
|
+
See [examples/README.md](examples/README.md) for import instructions and customization tips.
|
|
250
|
+
|
|
251
|
+
## Known Limitations
|
|
252
|
+
|
|
253
|
+
### Free Tier Restrictions
|
|
254
|
+
|
|
255
|
+
The Twelve Data free tier has some limitations:
|
|
256
|
+
|
|
257
|
+
| Feature | Free Tier | Paid Plans |
|
|
258
|
+
|---------|-----------|------------|
|
|
259
|
+
| API Calls | 800/day | Higher limits |
|
|
260
|
+
| Rate Limit | 8 calls/minute | Higher limits |
|
|
261
|
+
| Historical Data | Limited | Extended |
|
|
262
|
+
| Fundamentals | Profile only | Full access |
|
|
263
|
+
| Real-time Data | 15-min delay | Real-time |
|
|
264
|
+
|
|
265
|
+
### API Tier Requirements
|
|
266
|
+
|
|
267
|
+
**Understanding API Tiers:**
|
|
268
|
+
|
|
269
|
+
Twelve Data offers different subscription tiers. The connector works with all tiers - it's the API access that varies.
|
|
270
|
+
|
|
271
|
+
**Free Tier (Fully Supported):**
|
|
272
|
+
- Core data operations (quotes, time series, exchange rates)
|
|
273
|
+
- Reference data (lists of stocks, forex, crypto, ETFs, indices)
|
|
274
|
+
- Company profiles
|
|
275
|
+
- Market intelligence data
|
|
276
|
+
- 800 API calls per day, 8 per minute
|
|
277
|
+
|
|
278
|
+
**Paid Tier Required (grow/pro/ultra/enterprise):**
|
|
279
|
+
- Advanced fundamentals: Get Dividends, Get Earnings, Get Statistics
|
|
280
|
+
- Calendars: Earnings Calendar, IPO Calendar
|
|
281
|
+
- Real-time data (free tier has 15-minute delay)
|
|
282
|
+
- Higher rate limits
|
|
283
|
+
- Extended historical data
|
|
284
|
+
|
|
285
|
+
### Planned Endpoints (Not Yet in REST API)
|
|
286
|
+
|
|
287
|
+
The following endpoints are defined in the node but not yet available in the Twelve Data REST API. They're included for future compatibility:
|
|
288
|
+
|
|
289
|
+
- **Get Options Chain** - Options contract data (available in Google Sheets Add-on)
|
|
290
|
+
- **Get Options Expiration** - Options expiration dates (available in Google Sheets Add-on)
|
|
291
|
+
- **Get Complex Data** - Multi-symbol, multi-endpoint requests
|
|
292
|
+
|
|
293
|
+
**Status:** These endpoints are expected to be added to the REST API in a future release. The operations are ready in the connector and will work automatically when Twelve Data makes them available.
|
|
294
|
+
|
|
295
|
+
**Current Workarounds:**
|
|
296
|
+
- For options data: Use the [Twelve Data Google Sheets Add-on](https://support.twelvedata.com/en/articles/5702399-google-sheets-add-on-documentation)
|
|
297
|
+
- For complex data: Make separate API calls using n8n loops (works well for most use cases)
|
|
298
|
+
|
|
299
|
+
### Interval Limitations
|
|
300
|
+
|
|
301
|
+
- **1-minute interval** may return 5-minute data on free tier
|
|
302
|
+
- **Hourly and daily intervals** work correctly on free tier
|
|
303
|
+
|
|
304
|
+
### Performance Notes
|
|
305
|
+
|
|
306
|
+
- Average response time: < 1 second
|
|
307
|
+
- Large datasets (1000+ items) may show n8n UI warning but load successfully
|
|
308
|
+
- Recommended: Add 0.5-1 second delay between requests in loops to avoid rate limiting
|
|
309
|
+
|
|
310
|
+
## Resources
|
|
311
|
+
|
|
312
|
+
### Documentation
|
|
313
|
+
|
|
314
|
+
- **[Credentials Setup Guide](docs/CREDENTIALS_SETUP.md)** - How to get and configure API keys
|
|
315
|
+
- **[Credentials Technical Docs](docs/CREDENTIALS.md)** - Authentication details
|
|
316
|
+
- **[OpenAPI Analysis](docs/OPENAPI_ANALYSIS.md)** - Complete API endpoint reference
|
|
317
|
+
|
|
318
|
+
#### Testing Documentation
|
|
319
|
+
- **[Testing Log](docs/TESTING_LOG.md)** - Complete API endpoint test results (30/33 tests)
|
|
320
|
+
- **[Integration Testing](docs/INTEGRATION_TESTING.md)** - Workflow integration test procedures
|
|
321
|
+
- **[Testing Plan](docs/TESTING_PLAN.md)** - Original test plan and structure
|
|
322
|
+
|
|
323
|
+
#### Technical Decisions
|
|
324
|
+
- **[Legacy Peer Dependencies Summary](docs/LEGACY-PEER-DEPS-SUMMARY.md)** - Quick overview (TL;DR)
|
|
325
|
+
- **[ADR-001: Legacy Peer Dependencies](docs/ADR-001-LEGACY-PEER-DEPS.md)** - Full investigation and decision record
|
|
326
|
+
- **[Dependency Removal Plan](docs/DEPENDENCY-REMOVAL-PLAN.md)** - Implementation guide
|
|
327
|
+
|
|
328
|
+
### External Links
|
|
329
|
+
|
|
330
|
+
- **[Twelve Data Website](https://twelvedata.com)** - Sign up and get API key
|
|
331
|
+
- **[Twelve Data API Docs](https://twelvedata.com/docs)** - Official API documentation
|
|
332
|
+
- **[Twelve Data Pricing](https://twelvedata.com/pricing)** - Plan comparison
|
|
333
|
+
- **[n8n Community Forum](https://community.n8n.io/)** - Get help from the community
|
|
334
|
+
- **[n8n Documentation](https://docs.n8n.io/)** - Learn more about n8n
|
|
335
|
+
|
|
336
|
+
### Support
|
|
337
|
+
|
|
338
|
+
- **Issues:** [GitHub Issues](https://github.com/yourusername/n8n-nodes-twelve-data/issues)
|
|
339
|
+
- **Twelve Data Support:** support@twelvedata.com
|
|
340
|
+
- **n8n Community:** [community.n8n.io](https://community.n8n.io)
|
|
341
|
+
|
|
342
|
+
## Version History
|
|
343
|
+
|
|
344
|
+
### 0.1.0 (Current)
|
|
345
|
+
- ✅ Initial release with full node implementation
|
|
346
|
+
- ✅ Twelve Data API credential support with automatic authentication
|
|
347
|
+
- ✅ Header and query parameter authentication (both methods supported)
|
|
348
|
+
- ✅ Credential testing functionality with automatic validation
|
|
349
|
+
- ✅ 4 resource categories: Core Data, Fundamentals, Reference Data, Analysis
|
|
350
|
+
- ✅ 20+ operations including:
|
|
351
|
+
- Core Data: Get Quote, Get Price, Get Time Series, Get EOD, Exchange Rate, Currency Conversion
|
|
352
|
+
- Fundamentals: Get Profile, Get Dividends, Get Earnings, Get Statistics
|
|
353
|
+
- Reference Data: List Stocks/Forex/Crypto/ETFs/Indices/Exchanges, Symbol Search, Market State
|
|
354
|
+
- Analysis: Technical Indicators (placeholder for future expansion)
|
|
355
|
+
- ✅ Comprehensive documentation with setup guides
|
|
356
|
+
- ✅ Declarative routing implementation for easy maintenance
|
|
357
|
+
- ✅ TypeScript strict mode with full type safety
|
|
358
|
+
- ✅ Light and dark theme icon support
|
|
359
|
+
- ✅ **Zero runtime dependencies** - Compliant with n8n verification guidelines
|
|
360
|
+
- ✅ **100% test success rate** - 17/17 applicable tests passed
|
|
361
|
+
|
|
362
|
+
## Development
|
|
363
|
+
|
|
364
|
+
### Prerequisites
|
|
365
|
+
|
|
366
|
+
- Node.js v18 or higher (tested with v22)
|
|
367
|
+
- npm v10.x (npm 11.x has known issues with lock files)
|
|
368
|
+
- n8n (included in dev dependencies via `n8n-node dev`)
|
|
369
|
+
|
|
370
|
+
### Setup
|
|
371
|
+
|
|
372
|
+
```bash
|
|
373
|
+
# Clone the repository
|
|
374
|
+
git clone https://github.com/yourusername/n8n-nodes-twelve-data.git
|
|
375
|
+
cd n8n-nodes-twelve-data
|
|
376
|
+
|
|
377
|
+
# Install dependencies
|
|
378
|
+
npm install
|
|
379
|
+
|
|
380
|
+
# Start development server
|
|
381
|
+
npm run dev
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
### Available Scripts
|
|
385
|
+
|
|
386
|
+
- `npm run dev` - Start n8n with your node and watch for changes
|
|
387
|
+
- `npm run build` - Build for production
|
|
388
|
+
- `npm run lint` - Check code quality
|
|
389
|
+
- `npm run lint:fix` - Auto-fix linting issues
|
|
390
|
+
|
|
391
|
+
### Project Structure
|
|
392
|
+
|
|
393
|
+
```
|
|
394
|
+
n8n-nodes-twelve-data/
|
|
395
|
+
├── credentials/
|
|
396
|
+
│ └── TwelveDataApi.credentials.ts # API authentication with dual auth methods
|
|
397
|
+
├── nodes/
|
|
398
|
+
│ └── TwelveData/
|
|
399
|
+
│ ├── TwelveData.node.ts # Main node implementation (1,170+ lines)
|
|
400
|
+
│ └── TwelveData.node.json # Node metadata and search aliases
|
|
401
|
+
├── icons/
|
|
402
|
+
│ ├── twelvedata.svg # Light theme icon
|
|
403
|
+
│ └── twelvedata.dark.svg # Dark theme icon
|
|
404
|
+
├── docs/
|
|
405
|
+
│ ├── CREDENTIALS_SETUP.md # Step-by-step setup guide
|
|
406
|
+
│ ├── CREDENTIALS.md # Technical authentication details
|
|
407
|
+
│ └── OPENAPI_ANALYSIS.md # Complete API endpoint reference
|
|
408
|
+
├── openapi-spec.json # Twelve Data OpenAPI specification
|
|
409
|
+
├── .npmrc # npm configuration (legacy-peer-deps)
|
|
410
|
+
├── .cursorrules # Development guidelines
|
|
411
|
+
└── package.json # Project configuration
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
### Implementation Details
|
|
415
|
+
|
|
416
|
+
- **Declarative Style**: Uses n8n's declarative routing approach for maintainability
|
|
417
|
+
- **Type Safety**: Full TypeScript with strict mode enabled
|
|
418
|
+
- **Authentication**: Automatic API key injection via query parameter (required by Twelve Data API)
|
|
419
|
+
- **Error Handling**: Comprehensive credential testing and validation
|
|
420
|
+
- **Documentation**: Extensive inline comments for beginners
|
|
421
|
+
|
|
422
|
+
## Contributing
|
|
423
|
+
|
|
424
|
+
Contributions are welcome! Please:
|
|
425
|
+
|
|
426
|
+
1. Fork the repository
|
|
427
|
+
2. Create a feature branch
|
|
428
|
+
3. Make your changes
|
|
429
|
+
4. Add tests if applicable
|
|
430
|
+
5. Submit a pull request
|
|
431
|
+
|
|
432
|
+
## License
|
|
433
|
+
|
|
434
|
+
[MIT](LICENSE.md)
|
|
435
|
+
|
|
436
|
+
## Disclaimer
|
|
437
|
+
|
|
438
|
+
This is a community-maintained node and is not officially affiliated with Twelve Data or n8n. Use at your own risk.
|
|
439
|
+
|
|
440
|
+
---
|
|
441
|
+
|
|
442
|
+
**Made with ❤️ for the n8n community**
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IAuthenticate, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class TwelveDataApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
documentationUrl: string;
|
|
6
|
+
icon: {
|
|
7
|
+
readonly light: "file:../icons/twelvedata.svg";
|
|
8
|
+
readonly dark: "file:../icons/twelvedata.dark.svg";
|
|
9
|
+
};
|
|
10
|
+
properties: INodeProperties[];
|
|
11
|
+
authenticate: IAuthenticate;
|
|
12
|
+
test: ICredentialTestRequest;
|
|
13
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TwelveDataApi = void 0;
|
|
4
|
+
class TwelveDataApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'twelveDataApi';
|
|
7
|
+
this.displayName = 'Twelve Data API';
|
|
8
|
+
this.documentationUrl = 'https://twelvedata.com/docs';
|
|
9
|
+
this.icon = { light: 'file:../icons/twelvedata.svg', dark: 'file:../icons/twelvedata.dark.svg' };
|
|
10
|
+
this.properties = [
|
|
11
|
+
{
|
|
12
|
+
displayName: 'API Key',
|
|
13
|
+
name: 'apiKey',
|
|
14
|
+
type: 'string',
|
|
15
|
+
typeOptions: {
|
|
16
|
+
password: true,
|
|
17
|
+
},
|
|
18
|
+
default: '',
|
|
19
|
+
required: true,
|
|
20
|
+
description: 'Your Twelve Data API key. Get it from <a href="https://twelvedata.com/account/api-keys" target="_blank">your dashboard</a>. <strong>Security:</strong> Never share this key or commit it to version control. Rotate regularly for best security.',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
displayName: 'Authentication Method',
|
|
24
|
+
name: 'authMethod',
|
|
25
|
+
type: 'options',
|
|
26
|
+
options: [
|
|
27
|
+
{
|
|
28
|
+
name: 'Header (Recommended)',
|
|
29
|
+
value: 'header',
|
|
30
|
+
description: 'Sends API key in Authorization header (more secure, not visible in URL logs)',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'Query Parameter',
|
|
34
|
+
value: 'queryString',
|
|
35
|
+
description: 'Sends API key as query parameter in URL (simpler for testing)',
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
default: 'header',
|
|
39
|
+
required: true,
|
|
40
|
+
description: 'Choose how to send the API key to Twelve Data. Header method is recommended for production use.',
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
this.authenticate = async (credentials, requestOptions) => {
|
|
44
|
+
if (!credentials.apiKey || typeof credentials.apiKey !== 'string') {
|
|
45
|
+
throw new Error('API Key is required. Please configure your Twelve Data API credentials with a valid API key.');
|
|
46
|
+
}
|
|
47
|
+
const authMethod = credentials.authMethod || 'header';
|
|
48
|
+
const modifiedOptions = { ...requestOptions };
|
|
49
|
+
if (authMethod === 'queryString') {
|
|
50
|
+
modifiedOptions.qs = {
|
|
51
|
+
...modifiedOptions.qs,
|
|
52
|
+
apikey: credentials.apiKey,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
modifiedOptions.headers = {
|
|
57
|
+
...modifiedOptions.headers,
|
|
58
|
+
Authorization: `apikey ${credentials.apiKey}`,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
return modifiedOptions;
|
|
62
|
+
};
|
|
63
|
+
this.test = {
|
|
64
|
+
request: {
|
|
65
|
+
baseURL: 'https://api.twelvedata.com',
|
|
66
|
+
url: '/stocks',
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.TwelveDataApi = TwelveDataApi;
|
|
72
|
+
//# sourceMappingURL=TwelveDataApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TwelveDataApi.credentials.js","sourceRoot":"","sources":["../../credentials/TwelveDataApi.credentials.ts"],"names":[],"mappings":";;;AASA,MAAa,aAAa;IAA1B;QACC,SAAI,GAAG,eAAe,CAAC;QACvB,gBAAW,GAAG,iBAAiB,CAAC;QAChC,qBAAgB,GAAG,6BAA6B,CAAC;QAGjD,SAAI,GAAG,EAAE,KAAK,EAAE,8BAA8B,EAAE,IAAI,EAAE,mCAAmC,EAAW,CAAC;QACrG,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE;oBACZ,QAAQ,EAAE,IAAI;iBACd;gBACD,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,kPAAkP;aAC/P;YACD;gBACC,WAAW,EAAE,uBAAuB;gBACpC,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE;oBACR;wBACC,IAAI,EAAE,sBAAsB;wBAC5B,KAAK,EAAE,QAAQ;wBACf,WAAW,EAAE,8EAA8E;qBAC3F;oBACD;wBACC,IAAI,EAAE,iBAAiB;wBACvB,KAAK,EAAE,aAAa;wBACpB,WAAW,EAAE,+DAA+D;qBAC5E;iBACD;gBACD,OAAO,EAAE,QAAQ;gBACjB,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,iGAAiG;aAC9G;SACD,CAAC;QAqBF,iBAAY,GAAkB,KAAK,EAClC,WAA2C,EAC3C,cAAmC,EACJ,EAAE;YAEjC,IAAI,CAAC,WAAW,CAAC,MAAM,IAAI,OAAO,WAAW,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;gBACnE,MAAM,IAAI,KAAK,CACd,8FAA8F,CAC9F,CAAC;YACH,CAAC;YAGD,MAAM,UAAU,GAAI,WAAW,CAAC,UAAqB,IAAI,QAAQ,CAAC;YAGlE,MAAM,eAAe,GAAG,EAAE,GAAG,cAAc,EAAE,CAAC;YAE9C,IAAI,UAAU,KAAK,aAAa,EAAE,CAAC;gBAElC,eAAe,CAAC,EAAE,GAAG;oBACpB,GAAG,eAAe,CAAC,EAAE;oBACrB,MAAM,EAAE,WAAW,CAAC,MAAM;iBAC1B,CAAC;YACH,CAAC;iBAAM,CAAC;gBAEP,eAAe,CAAC,OAAO,GAAG;oBACzB,GAAG,eAAe,CAAC,OAAO;oBAC1B,aAAa,EAAE,UAAU,WAAW,CAAC,MAAM,EAAE;iBAC7C,CAAC;YACH,CAAC;YAED,OAAO,eAAe,CAAC;QACxB,CAAC,CAAC;QAcF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,4BAA4B;gBACrC,GAAG,EAAE,SAAS;aACd;SACD,CAAC;IACH,CAAC;CAAA;AAhHD,sCAgHC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M20.0165 0C8.94791 0 0 9.01388 0 20.1653C0 29.0792 5.73324 36.6246 13.6868 39.2952C14.6812 39.496 15.0454 38.8613 15.0454 38.3274C15.0454 37.8599 15.0126 36.2575 15.0126 34.5879C9.4445 35.79 8.28498 32.1841 8.28498 32.1841C7.39015 29.847 6.06429 29.2463 6.06429 29.2463C4.24185 28.011 6.19704 28.011 6.19704 28.011C8.21861 28.1446 9.27938 30.081 9.27938 30.081C11.0686 33.1522 13.9518 32.2844 15.1118 31.7502C15.2773 30.4481 15.8079 29.5467 16.3713 29.046C11.9303 28.5785 7.25781 26.8425 7.25781 19.0967C7.25781 16.8932 8.05267 15.0905 9.31216 13.6884C9.11344 13.1877 8.41732 11.1174 9.51128 8.34644C9.51128 8.34644 11.2014 7.81217 15.0122 10.4164C16.6438 9.97495 18.3263 9.7504 20.0165 9.74851C21.7067 9.74851 23.4295 9.98246 25.0205 10.4164C28.8317 7.81217 30.5218 8.34644 30.5218 8.34644C31.6158 11.1174 30.9192 13.1877 30.7205 13.6884C32.0132 15.0905 32.7753 16.8932 32.7753 19.0967C32.7753 26.8425 28.1028 28.5449 23.6287 29.046C24.358 29.6802 24.9873 30.882 24.9873 32.7851C24.9873 35.4893 24.9545 37.6596 24.9545 38.327C24.9545 38.8613 25.3192 39.496 26.3132 39.2956C34.2667 36.6242 39.9999 29.0792 39.9999 20.1653C40.0327 9.01388 31.052 0 20.0165 0Z" fill="white"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M20.0165 0C8.94791 0 0 9.01388 0 20.1653C0 29.0792 5.73324 36.6246 13.6868 39.2952C14.6812 39.496 15.0454 38.8613 15.0454 38.3274C15.0454 37.8599 15.0126 36.2575 15.0126 34.5879C9.4445 35.79 8.28498 32.1841 8.28498 32.1841C7.39015 29.847 6.06429 29.2463 6.06429 29.2463C4.24185 28.011 6.19704 28.011 6.19704 28.011C8.21861 28.1446 9.27938 30.081 9.27938 30.081C11.0686 33.1522 13.9518 32.2844 15.1118 31.7502C15.2773 30.4481 15.8079 29.5467 16.3713 29.046C11.9303 28.5785 7.25781 26.8425 7.25781 19.0967C7.25781 16.8932 8.05267 15.0905 9.31216 13.6884C9.11344 13.1877 8.41732 11.1174 9.51128 8.34644C9.51128 8.34644 11.2014 7.81217 15.0122 10.4164C16.6438 9.97495 18.3263 9.7504 20.0165 9.74851C21.7067 9.74851 23.4295 9.98246 25.0205 10.4164C28.8317 7.81217 30.5218 8.34644 30.5218 8.34644C31.6158 11.1174 30.9192 13.1877 30.7205 13.6884C32.0132 15.0905 32.7753 16.8932 32.7753 19.0967C32.7753 26.8425 28.1028 28.5449 23.6287 29.046C24.358 29.6802 24.9873 30.882 24.9873 32.7851C24.9873 35.4893 24.9545 37.6596 24.9545 38.327C24.9545 38.8613 25.3192 39.496 26.3132 39.2956C34.2667 36.6242 39.9999 29.0792 39.9999 20.1653C40.0327 9.01388 31.052 0 20.0165 0Z" fill="#24292F"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
2
|
+
<!-- Financial chart/candlestick icon representing market data - Dark theme version -->
|
|
3
|
+
<line x1="3" y1="21" x2="21" y2="21"/>
|
|
4
|
+
<line x1="3" y1="21" x2="3" y2="3"/>
|
|
5
|
+
<!-- Candlestick 1 -->
|
|
6
|
+
<line x1="7" y1="17" x2="7" y2="11"/>
|
|
7
|
+
<rect x="6" y="13" width="2" height="3" fill="#ffffff"/>
|
|
8
|
+
<!-- Candlestick 2 -->
|
|
9
|
+
<line x1="11" y1="18" x2="11" y2="8"/>
|
|
10
|
+
<rect x="10" y="10" width="2" height="6" fill="#ffffff"/>
|
|
11
|
+
<!-- Candlestick 3 -->
|
|
12
|
+
<line x1="15" y1="19" x2="15" y2="13"/>
|
|
13
|
+
<rect x="14" y="15" width="2" height="2" fill="#ffffff"/>
|
|
14
|
+
<!-- Candlestick 4 -->
|
|
15
|
+
<line x1="19" y1="16" x2="19" y2="6"/>
|
|
16
|
+
<rect x="18" y="8" width="2" height="6" fill="#ffffff"/>
|
|
17
|
+
</svg>
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
2
|
+
<!-- Financial chart/candlestick icon representing market data - Light theme version -->
|
|
3
|
+
<line x1="3" y1="21" x2="21" y2="21"/>
|
|
4
|
+
<line x1="3" y1="21" x2="3" y2="3"/>
|
|
5
|
+
<!-- Candlestick 1 -->
|
|
6
|
+
<line x1="7" y1="17" x2="7" y2="11"/>
|
|
7
|
+
<rect x="6" y="13" width="2" height="3" fill="#000000"/>
|
|
8
|
+
<!-- Candlestick 2 -->
|
|
9
|
+
<line x1="11" y1="18" x2="11" y2="8"/>
|
|
10
|
+
<rect x="10" y="10" width="2" height="6" fill="#000000"/>
|
|
11
|
+
<!-- Candlestick 3 -->
|
|
12
|
+
<line x1="15" y1="19" x2="15" y2="13"/>
|
|
13
|
+
<rect x="14" y="15" width="2" height="2" fill="#000000"/>
|
|
14
|
+
<!-- Candlestick 4 -->
|
|
15
|
+
<line x1="19" y1="16" x2="19" y2="6"/>
|
|
16
|
+
<rect x="18" y="8" width="2" height="6" fill="#000000"/>
|
|
17
|
+
</svg>
|
|
18
|
+
|