n8n-nodes-alpaca 1.0.0
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 +46 -0
- package/README.md +363 -0
- package/dist/credentials/AlpacaApi.credentials.d.ts +10 -0
- package/dist/credentials/AlpacaApi.credentials.d.ts.map +1 -0
- package/dist/credentials/AlpacaApi.credentials.js +89 -0
- package/dist/credentials/AlpacaApi.credentials.js.map +1 -0
- package/dist/nodes/Alpaca/Alpaca.node.d.ts +6 -0
- package/dist/nodes/Alpaca/Alpaca.node.d.ts.map +1 -0
- package/dist/nodes/Alpaca/Alpaca.node.js +200 -0
- package/dist/nodes/Alpaca/Alpaca.node.js.map +1 -0
- package/dist/nodes/Alpaca/AlpacaTrigger.node.d.ts +6 -0
- package/dist/nodes/Alpaca/AlpacaTrigger.node.d.ts.map +1 -0
- package/dist/nodes/Alpaca/AlpacaTrigger.node.js +315 -0
- package/dist/nodes/Alpaca/AlpacaTrigger.node.js.map +1 -0
- package/dist/nodes/Alpaca/actions/account/index.d.ts +5 -0
- package/dist/nodes/Alpaca/actions/account/index.d.ts.map +1 -0
- package/dist/nodes/Alpaca/actions/account/index.js +245 -0
- package/dist/nodes/Alpaca/actions/account/index.js.map +1 -0
- package/dist/nodes/Alpaca/actions/activities/index.d.ts +5 -0
- package/dist/nodes/Alpaca/actions/activities/index.d.ts.map +1 -0
- package/dist/nodes/Alpaca/actions/activities/index.js +225 -0
- package/dist/nodes/Alpaca/actions/activities/index.js.map +1 -0
- package/dist/nodes/Alpaca/actions/assets/index.d.ts +5 -0
- package/dist/nodes/Alpaca/actions/assets/index.d.ts.map +1 -0
- package/dist/nodes/Alpaca/actions/assets/index.js +279 -0
- package/dist/nodes/Alpaca/actions/assets/index.js.map +1 -0
- package/dist/nodes/Alpaca/actions/calendar/index.d.ts +5 -0
- package/dist/nodes/Alpaca/actions/calendar/index.d.ts.map +1 -0
- package/dist/nodes/Alpaca/actions/calendar/index.js +99 -0
- package/dist/nodes/Alpaca/actions/calendar/index.js.map +1 -0
- package/dist/nodes/Alpaca/actions/corporateActions/index.d.ts +5 -0
- package/dist/nodes/Alpaca/actions/corporateActions/index.d.ts.map +1 -0
- package/dist/nodes/Alpaca/actions/corporateActions/index.js +169 -0
- package/dist/nodes/Alpaca/actions/corporateActions/index.js.map +1 -0
- package/dist/nodes/Alpaca/actions/cryptoData/index.d.ts +5 -0
- package/dist/nodes/Alpaca/actions/cryptoData/index.d.ts.map +1 -0
- package/dist/nodes/Alpaca/actions/cryptoData/index.js +311 -0
- package/dist/nodes/Alpaca/actions/cryptoData/index.js.map +1 -0
- package/dist/nodes/Alpaca/actions/cryptoFunding/index.d.ts +5 -0
- package/dist/nodes/Alpaca/actions/cryptoFunding/index.d.ts.map +1 -0
- package/dist/nodes/Alpaca/actions/cryptoFunding/index.js +261 -0
- package/dist/nodes/Alpaca/actions/cryptoFunding/index.js.map +1 -0
- package/dist/nodes/Alpaca/actions/news/index.d.ts +5 -0
- package/dist/nodes/Alpaca/actions/news/index.d.ts.map +1 -0
- package/dist/nodes/Alpaca/actions/news/index.js +166 -0
- package/dist/nodes/Alpaca/actions/news/index.js.map +1 -0
- package/dist/nodes/Alpaca/actions/optionsData/index.d.ts +5 -0
- package/dist/nodes/Alpaca/actions/optionsData/index.d.ts.map +1 -0
- package/dist/nodes/Alpaca/actions/optionsData/index.js +355 -0
- package/dist/nodes/Alpaca/actions/optionsData/index.js.map +1 -0
- package/dist/nodes/Alpaca/actions/orders/index.d.ts +5 -0
- package/dist/nodes/Alpaca/actions/orders/index.d.ts.map +1 -0
- package/dist/nodes/Alpaca/actions/orders/index.js +626 -0
- package/dist/nodes/Alpaca/actions/orders/index.js.map +1 -0
- package/dist/nodes/Alpaca/actions/positions/index.d.ts +5 -0
- package/dist/nodes/Alpaca/actions/positions/index.d.ts.map +1 -0
- package/dist/nodes/Alpaca/actions/positions/index.js +200 -0
- package/dist/nodes/Alpaca/actions/positions/index.js.map +1 -0
- package/dist/nodes/Alpaca/actions/screener/index.d.ts +5 -0
- package/dist/nodes/Alpaca/actions/screener/index.d.ts.map +1 -0
- package/dist/nodes/Alpaca/actions/screener/index.js +154 -0
- package/dist/nodes/Alpaca/actions/screener/index.js.map +1 -0
- package/dist/nodes/Alpaca/actions/stockData/index.d.ts +5 -0
- package/dist/nodes/Alpaca/actions/stockData/index.d.ts.map +1 -0
- package/dist/nodes/Alpaca/actions/stockData/index.js +420 -0
- package/dist/nodes/Alpaca/actions/stockData/index.js.map +1 -0
- package/dist/nodes/Alpaca/actions/utility/index.d.ts +5 -0
- package/dist/nodes/Alpaca/actions/utility/index.d.ts.map +1 -0
- package/dist/nodes/Alpaca/actions/utility/index.js +128 -0
- package/dist/nodes/Alpaca/actions/utility/index.js.map +1 -0
- package/dist/nodes/Alpaca/actions/watchlists/index.d.ts +5 -0
- package/dist/nodes/Alpaca/actions/watchlists/index.d.ts.map +1 -0
- package/dist/nodes/Alpaca/actions/watchlists/index.js +283 -0
- package/dist/nodes/Alpaca/actions/watchlists/index.js.map +1 -0
- package/dist/nodes/Alpaca/alpaca.svg +9 -0
- package/dist/nodes/Alpaca/constants/index.d.ts +364 -0
- package/dist/nodes/Alpaca/constants/index.d.ts.map +1 -0
- package/dist/nodes/Alpaca/constants/index.js +167 -0
- package/dist/nodes/Alpaca/constants/index.js.map +1 -0
- package/dist/nodes/Alpaca/transport/index.d.ts +16 -0
- package/dist/nodes/Alpaca/transport/index.d.ts.map +1 -0
- package/dist/nodes/Alpaca/transport/index.js +118 -0
- package/dist/nodes/Alpaca/transport/index.js.map +1 -0
- package/dist/nodes/Alpaca/utils/index.d.ts +63 -0
- package/dist/nodes/Alpaca/utils/index.d.ts.map +1 -0
- package/dist/nodes/Alpaca/utils/index.js +204 -0
- package/dist/nodes/Alpaca/utils/index.js.map +1 -0
- package/package.json +82 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
Business Source License 1.1
|
|
2
|
+
|
|
3
|
+
License text copyright (c) 2017 MariaDB Corporation Ab.
|
|
4
|
+
|
|
5
|
+
Licensor:
|
|
6
|
+
Velocity BPA, LLC
|
|
7
|
+
https://velobpa.com
|
|
8
|
+
|
|
9
|
+
Licensed Work:
|
|
10
|
+
This repository and all source code, documentation, and associated artifacts
|
|
11
|
+
contained herein, including all n8n community nodes published by Velocity BPA.
|
|
12
|
+
|
|
13
|
+
Additional Use Grant:
|
|
14
|
+
You may use, modify, and run the Licensed Work free of charge for:
|
|
15
|
+
- Personal use
|
|
16
|
+
- Educational use
|
|
17
|
+
- Research use
|
|
18
|
+
- Internal business use, provided such use does not involve resale,
|
|
19
|
+
redistribution, or offering the Licensed Work as part of a commercial
|
|
20
|
+
product or service.
|
|
21
|
+
|
|
22
|
+
Commercial Use Restriction:
|
|
23
|
+
Commercial Use of the Licensed Work is prohibited without a valid
|
|
24
|
+
Commercial License issued by the Licensor.
|
|
25
|
+
|
|
26
|
+
Commercial Use includes, but is not limited to:
|
|
27
|
+
- Use of the Licensed Work within any Software-as-a-Service (SaaS),
|
|
28
|
+
Platform-as-a-Service (PaaS), or hosted application that is sold,
|
|
29
|
+
licensed, or monetized in any form
|
|
30
|
+
- Offering the Licensed Work as part of a managed services engagement
|
|
31
|
+
- Bundling or redistributing the Licensed Work with a paid product
|
|
32
|
+
- Reselling, sublicensing, or white-labeling the Licensed Work
|
|
33
|
+
- Embedding the Licensed Work into any commercial automation platform,
|
|
34
|
+
integration product, or solution offering
|
|
35
|
+
|
|
36
|
+
Change Date:
|
|
37
|
+
January 1, 2030
|
|
38
|
+
|
|
39
|
+
Change License:
|
|
40
|
+
Apache License, Version 2.0
|
|
41
|
+
|
|
42
|
+
For commercial licensing inquiries:
|
|
43
|
+
licensing@velobpa.com
|
|
44
|
+
|
|
45
|
+
Business Source License 1.1 full text:
|
|
46
|
+
https://mariadb.com/bsl11/
|
package/README.md
ADDED
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
# n8n-nodes-alpaca
|
|
2
|
+
|
|
3
|
+
> [Velocity BPA Licensing Notice]
|
|
4
|
+
>
|
|
5
|
+
> This n8n node is licensed under the Business Source License 1.1 (BSL 1.1).
|
|
6
|
+
>
|
|
7
|
+
> Use of this node by for-profit organizations in production environments requires a commercial license from Velocity BPA.
|
|
8
|
+
>
|
|
9
|
+
> For licensing information, visit https://velobpa.com/licensing or contact licensing@velobpa.com.
|
|
10
|
+
|
|
11
|
+
A comprehensive n8n community node for Alpaca Trading API, providing full access to stocks, options, and crypto trading capabilities. Supports paper trading for testing strategies and live trading for real execution.
|
|
12
|
+
|
|
13
|
+

|
|
14
|
+

|
|
15
|
+

|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
|
+
- **Complete Trading API Integration**: Full access to Alpaca's Trading API v2
|
|
20
|
+
- **Stock Trading**: Market, limit, stop, stop-limit, and trailing stop orders
|
|
21
|
+
- **Options Trading**: Options contracts, chains, and market data
|
|
22
|
+
- **Crypto Trading**: Cryptocurrency trading and market data
|
|
23
|
+
- **Paper Trading**: Test strategies risk-free with paper trading environment
|
|
24
|
+
- **Real-time Market Data**: Access to IEX and SIP data feeds
|
|
25
|
+
- **Fractional Shares**: Support for fractional share trading
|
|
26
|
+
- **Extended Hours**: Trade during pre-market and after-hours sessions
|
|
27
|
+
- **Account Management**: Portfolio history, activities, and configuration
|
|
28
|
+
- **Trigger Node**: Event-driven workflows for orders, positions, and market status
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
### Community Nodes (Recommended)
|
|
33
|
+
|
|
34
|
+
1. Open n8n
|
|
35
|
+
2. Go to **Settings** > **Community Nodes**
|
|
36
|
+
3. Search for `n8n-nodes-alpaca`
|
|
37
|
+
4. Click **Install**
|
|
38
|
+
5. Restart n8n
|
|
39
|
+
|
|
40
|
+
### Manual Installation
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Navigate to your n8n installation
|
|
44
|
+
cd ~/.n8n
|
|
45
|
+
|
|
46
|
+
# Install the package
|
|
47
|
+
npm install n8n-nodes-alpaca
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Development Installation
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# Clone the repository
|
|
54
|
+
git clone https://github.com/Velocity-BPA/n8n-nodes-alpaca.git
|
|
55
|
+
cd n8n-nodes-alpaca
|
|
56
|
+
|
|
57
|
+
# Install dependencies
|
|
58
|
+
npm install
|
|
59
|
+
|
|
60
|
+
# Build the project
|
|
61
|
+
npm run build
|
|
62
|
+
|
|
63
|
+
# Link to n8n (Linux/macOS)
|
|
64
|
+
mkdir -p ~/.n8n/custom
|
|
65
|
+
ln -s $(pwd) ~/.n8n/custom/n8n-nodes-alpaca
|
|
66
|
+
|
|
67
|
+
# Restart n8n
|
|
68
|
+
n8n start
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Credentials Setup
|
|
72
|
+
|
|
73
|
+
### Alpaca API Credentials
|
|
74
|
+
|
|
75
|
+
To use this node, you need an Alpaca account and API credentials:
|
|
76
|
+
|
|
77
|
+
1. Sign up at [Alpaca](https://alpaca.markets/)
|
|
78
|
+
2. Go to your dashboard
|
|
79
|
+
3. Navigate to **API Keys**
|
|
80
|
+
4. Generate new API keys
|
|
81
|
+
|
|
82
|
+
| Field | Description |
|
|
83
|
+
|-------|-------------|
|
|
84
|
+
| API Key ID | Your Alpaca API Key ID (starts with `PK` for paper, `AK` for live) |
|
|
85
|
+
| API Secret Key | Your Alpaca API Secret Key |
|
|
86
|
+
| Environment | `paper` for testing, `live` for real trading |
|
|
87
|
+
| Trading Base URL | Custom trading API URL (optional) |
|
|
88
|
+
| Data Base URL | Custom data API URL (optional) |
|
|
89
|
+
|
|
90
|
+
**Important**: Use paper trading credentials for testing. Live trading uses real money.
|
|
91
|
+
|
|
92
|
+
## Resources & Operations
|
|
93
|
+
|
|
94
|
+
### Account
|
|
95
|
+
- **Get Account**: Retrieve account details, buying power, and status
|
|
96
|
+
- **Get Account Config**: Get account configuration settings
|
|
97
|
+
- **Update Account Config**: Modify DTBP check, trade confirmations, margin settings
|
|
98
|
+
- **Get Portfolio History**: Historical portfolio value with customizable timeframes
|
|
99
|
+
|
|
100
|
+
### Orders
|
|
101
|
+
- **Create Order**: Place market, limit, stop, stop-limit, or trailing stop orders
|
|
102
|
+
- **Get All Orders**: List all orders with status filters
|
|
103
|
+
- **Get Order**: Retrieve specific order by ID
|
|
104
|
+
- **Get Order by Client ID**: Find order by your client order ID
|
|
105
|
+
- **Replace Order**: Modify existing order (quantity, price, time in force)
|
|
106
|
+
- **Cancel Order**: Cancel specific order
|
|
107
|
+
- **Cancel All Orders**: Cancel all open orders
|
|
108
|
+
|
|
109
|
+
### Positions
|
|
110
|
+
- **Get All Positions**: List all open positions
|
|
111
|
+
- **Get Position**: Get position for specific symbol
|
|
112
|
+
- **Close Position**: Close position by symbol (full or partial)
|
|
113
|
+
- **Close All Positions**: Liquidate all positions
|
|
114
|
+
- **Exercise Option**: Exercise options position
|
|
115
|
+
|
|
116
|
+
### Assets
|
|
117
|
+
- **Get All Assets**: List tradable assets with filters
|
|
118
|
+
- **Get Asset**: Get asset details by symbol or ID
|
|
119
|
+
- **Get Option Contracts**: Search option contracts
|
|
120
|
+
- **Get Option Contract**: Get specific option contract details
|
|
121
|
+
|
|
122
|
+
### Watchlists
|
|
123
|
+
- **Get All Watchlists**: List all watchlists
|
|
124
|
+
- **Create Watchlist**: Create new watchlist
|
|
125
|
+
- **Get Watchlist**: Retrieve watchlist by ID or name
|
|
126
|
+
- **Update Watchlist**: Modify watchlist name and symbols
|
|
127
|
+
- **Delete Watchlist**: Remove watchlist
|
|
128
|
+
- **Add Asset**: Add symbol to watchlist
|
|
129
|
+
- **Remove Asset**: Remove symbol from watchlist
|
|
130
|
+
|
|
131
|
+
### Account Activities
|
|
132
|
+
- **Get Activities**: Get all account activities
|
|
133
|
+
- **Get Activities by Type**: Filter activities by type (FILL, TRANS, DIV, etc.)
|
|
134
|
+
|
|
135
|
+
### Calendar
|
|
136
|
+
- **Get Calendar**: Get market calendar with trading days
|
|
137
|
+
- **Get Clock**: Get market status and next open/close times
|
|
138
|
+
|
|
139
|
+
### Corporate Actions
|
|
140
|
+
- **Get Announcements**: Search corporate action announcements
|
|
141
|
+
- **Get Announcement**: Get specific announcement details
|
|
142
|
+
|
|
143
|
+
### Stock Market Data
|
|
144
|
+
- **Get Stock Bars**: Historical OHLCV bars (candlesticks)
|
|
145
|
+
- **Get Latest Bar**: Most recent bar for symbol
|
|
146
|
+
- **Get Stock Quotes**: Historical bid/ask quotes
|
|
147
|
+
- **Get Latest Quote**: Most recent quote
|
|
148
|
+
- **Get Stock Trades**: Historical trade data
|
|
149
|
+
- **Get Latest Trade**: Most recent trade
|
|
150
|
+
- **Get Snapshot**: Current market snapshot
|
|
151
|
+
- **Get Multiple Snapshots**: Snapshots for multiple symbols
|
|
152
|
+
- **Get Auctions**: Auction data
|
|
153
|
+
- **Get Condition Codes**: Trade condition code reference
|
|
154
|
+
- **Get Exchange Codes**: Exchange code reference
|
|
155
|
+
|
|
156
|
+
### Options Market Data
|
|
157
|
+
- **Get Option Bars**: Historical option bars
|
|
158
|
+
- **Get Latest Quotes**: Latest option quotes
|
|
159
|
+
- **Get Snapshots**: Option market snapshots
|
|
160
|
+
- **Get Option Chain**: Full option chain for underlying
|
|
161
|
+
- **Get Option Trades**: Historical option trades
|
|
162
|
+
|
|
163
|
+
### Crypto Market Data
|
|
164
|
+
- **Get Crypto Bars**: Historical crypto bars
|
|
165
|
+
- **Get Latest Bars**: Latest crypto bars
|
|
166
|
+
- **Get Crypto Quotes**: Historical crypto quotes
|
|
167
|
+
- **Get Latest Quotes**: Latest crypto quotes
|
|
168
|
+
- **Get Crypto Trades**: Historical crypto trades
|
|
169
|
+
- **Get Snapshots**: Crypto market snapshots
|
|
170
|
+
- **Get Orderbook**: Crypto orderbook data
|
|
171
|
+
|
|
172
|
+
### Crypto Funding
|
|
173
|
+
- **Get Wallets**: List crypto funding wallets
|
|
174
|
+
- **Get Transfers**: List crypto transfers
|
|
175
|
+
- **Request Withdrawal**: Initiate crypto withdrawal
|
|
176
|
+
- **Get Whitelisted Addresses**: List whitelisted withdrawal addresses
|
|
177
|
+
- **Add Whitelisted Address**: Add new whitelisted address
|
|
178
|
+
- **Delete Whitelisted Address**: Remove whitelisted address
|
|
179
|
+
- **Get Gas Estimate**: Estimate gas fees
|
|
180
|
+
|
|
181
|
+
### News
|
|
182
|
+
- **Get News**: Search and retrieve news articles with symbol filters
|
|
183
|
+
|
|
184
|
+
### Screener
|
|
185
|
+
- **Get Most Active**: Most actively traded stocks
|
|
186
|
+
- **Get Top Movers**: Top market movers (gainers/losers)
|
|
187
|
+
|
|
188
|
+
### Utility
|
|
189
|
+
- **Get Forex Rates**: Foreign exchange rates
|
|
190
|
+
- **Get Logos**: Company logo images
|
|
191
|
+
|
|
192
|
+
## Trigger Node
|
|
193
|
+
|
|
194
|
+
The Alpaca Trigger node supports polling-based event detection:
|
|
195
|
+
|
|
196
|
+
| Event | Description |
|
|
197
|
+
|-------|-------------|
|
|
198
|
+
| New Order | Triggers when a new order is created |
|
|
199
|
+
| Order Filled | Triggers when an order is filled/executed |
|
|
200
|
+
| Order Canceled | Triggers when an order is canceled |
|
|
201
|
+
| Position Opened | Triggers when a new position is opened |
|
|
202
|
+
| Position Closed | Triggers when a position is closed |
|
|
203
|
+
| Price Alert | Triggers when price crosses a threshold |
|
|
204
|
+
| Market Open | Triggers when market opens |
|
|
205
|
+
| Market Close | Triggers when market closes |
|
|
206
|
+
| News Alert | Triggers on news for a specific symbol |
|
|
207
|
+
|
|
208
|
+
## Usage Examples
|
|
209
|
+
|
|
210
|
+
### Place a Market Order
|
|
211
|
+
|
|
212
|
+
```javascript
|
|
213
|
+
// Buy 10 shares of AAPL at market price
|
|
214
|
+
{
|
|
215
|
+
"resource": "orders",
|
|
216
|
+
"operation": "createOrder",
|
|
217
|
+
"symbol": "AAPL",
|
|
218
|
+
"side": "buy",
|
|
219
|
+
"type": "market",
|
|
220
|
+
"quantity": 10,
|
|
221
|
+
"timeInForce": "day"
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Get Latest Stock Quote
|
|
226
|
+
|
|
227
|
+
```javascript
|
|
228
|
+
// Get latest quote for AAPL
|
|
229
|
+
{
|
|
230
|
+
"resource": "stockData",
|
|
231
|
+
"operation": "getLatestQuote",
|
|
232
|
+
"symbol": "AAPL"
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Create a Limit Order with Stop Loss
|
|
237
|
+
|
|
238
|
+
```javascript
|
|
239
|
+
// Buy TSLA with bracket order
|
|
240
|
+
{
|
|
241
|
+
"resource": "orders",
|
|
242
|
+
"operation": "createOrder",
|
|
243
|
+
"symbol": "TSLA",
|
|
244
|
+
"side": "buy",
|
|
245
|
+
"type": "limit",
|
|
246
|
+
"quantity": 5,
|
|
247
|
+
"limitPrice": 200,
|
|
248
|
+
"orderClass": "bracket",
|
|
249
|
+
"takeProfit": 220,
|
|
250
|
+
"stopLoss": 190
|
|
251
|
+
}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
## Alpaca Trading Concepts
|
|
255
|
+
|
|
256
|
+
| Concept | Description |
|
|
257
|
+
|---------|-------------|
|
|
258
|
+
| Symbol | Stock ticker (e.g., AAPL, GOOGL) |
|
|
259
|
+
| Asset ID | Alpaca's unique asset identifier |
|
|
260
|
+
| Client Order ID | Your custom order identifier |
|
|
261
|
+
| Quantity | Number of shares (supports decimals for fractional) |
|
|
262
|
+
| Notional | Dollar amount for fractional orders |
|
|
263
|
+
| Time in Force | Order duration (day, gtc, opg, cls, ioc, fok) |
|
|
264
|
+
| Extended Hours | Trade during pre/post market sessions |
|
|
265
|
+
| Paper Trading | Risk-free testing environment |
|
|
266
|
+
|
|
267
|
+
## Data Feeds
|
|
268
|
+
|
|
269
|
+
| Feed | Description | Availability |
|
|
270
|
+
|------|-------------|--------------|
|
|
271
|
+
| IEX | IEX Exchange data | Free tier |
|
|
272
|
+
| SIP | Consolidated tape (all exchanges) | Paid subscription |
|
|
273
|
+
| OPRA | Options pricing data | Options subscription |
|
|
274
|
+
|
|
275
|
+
## Error Handling
|
|
276
|
+
|
|
277
|
+
The node provides detailed error messages for common issues:
|
|
278
|
+
|
|
279
|
+
| Code | Description |
|
|
280
|
+
|------|-------------|
|
|
281
|
+
| 400 | Invalid request parameters |
|
|
282
|
+
| 401 | Invalid API credentials |
|
|
283
|
+
| 403 | Insufficient permissions or buying power |
|
|
284
|
+
| 404 | Resource not found |
|
|
285
|
+
| 422 | Unprocessable entity (validation error) |
|
|
286
|
+
| 429 | Rate limit exceeded |
|
|
287
|
+
| 500 | Internal server error |
|
|
288
|
+
|
|
289
|
+
## Security Best Practices
|
|
290
|
+
|
|
291
|
+
1. **Use Paper Trading First**: Test all workflows in paper trading before going live
|
|
292
|
+
2. **Secure API Keys**: Never expose API keys in workflows or logs
|
|
293
|
+
3. **Rate Limiting**: Respect API rate limits (200 requests/minute for trading)
|
|
294
|
+
4. **Order Validation**: Always validate order parameters before submission
|
|
295
|
+
5. **Error Handling**: Implement proper error handling in workflows
|
|
296
|
+
6. **Access Control**: Use n8n's credentials system for secure key storage
|
|
297
|
+
|
|
298
|
+
## Development
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
# Install dependencies
|
|
302
|
+
npm install
|
|
303
|
+
|
|
304
|
+
# Build the project
|
|
305
|
+
npm run build
|
|
306
|
+
|
|
307
|
+
# Run tests
|
|
308
|
+
npm test
|
|
309
|
+
|
|
310
|
+
# Run tests with coverage
|
|
311
|
+
npm run test:coverage
|
|
312
|
+
|
|
313
|
+
# Lint code
|
|
314
|
+
npm run lint
|
|
315
|
+
|
|
316
|
+
# Fix linting issues
|
|
317
|
+
npm run lint:fix
|
|
318
|
+
|
|
319
|
+
# Watch mode for development
|
|
320
|
+
npm run dev
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
## Author
|
|
324
|
+
|
|
325
|
+
**Velocity BPA**
|
|
326
|
+
- Website: [velobpa.com](https://velobpa.com)
|
|
327
|
+
- GitHub: [Velocity-BPA](https://github.com/Velocity-BPA)
|
|
328
|
+
|
|
329
|
+
## Licensing
|
|
330
|
+
|
|
331
|
+
This n8n community node is licensed under the **Business Source License 1.1**.
|
|
332
|
+
|
|
333
|
+
### Free Use
|
|
334
|
+
Permitted for personal, educational, research, and internal business use.
|
|
335
|
+
|
|
336
|
+
### Commercial Use
|
|
337
|
+
Use of this node within any SaaS, PaaS, hosted platform, managed service,
|
|
338
|
+
or paid automation offering requires a commercial license.
|
|
339
|
+
|
|
340
|
+
For licensing inquiries:
|
|
341
|
+
**licensing@velobpa.com**
|
|
342
|
+
|
|
343
|
+
See [LICENSE](LICENSE), [COMMERCIAL_LICENSE.md](COMMERCIAL_LICENSE.md), and [LICENSING_FAQ.md](LICENSING_FAQ.md) for details.
|
|
344
|
+
|
|
345
|
+
## Contributing
|
|
346
|
+
|
|
347
|
+
1. Fork the repository
|
|
348
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
349
|
+
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
350
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
351
|
+
5. Open a Pull Request
|
|
352
|
+
|
|
353
|
+
## Support
|
|
354
|
+
|
|
355
|
+
- **Documentation**: [Alpaca API Docs](https://docs.alpaca.markets/)
|
|
356
|
+
- **Issues**: [GitHub Issues](https://github.com/Velocity-BPA/n8n-nodes-alpaca/issues)
|
|
357
|
+
- **Commercial Support**: licensing@velobpa.com
|
|
358
|
+
|
|
359
|
+
## Acknowledgments
|
|
360
|
+
|
|
361
|
+
- [Alpaca](https://alpaca.markets/) for their excellent trading API
|
|
362
|
+
- [n8n](https://n8n.io/) for the workflow automation platform
|
|
363
|
+
- The n8n community for inspiration and support
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class AlpacaApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
documentationUrl: string;
|
|
6
|
+
properties: INodeProperties[];
|
|
7
|
+
authenticate: IAuthenticateGeneric;
|
|
8
|
+
test: ICredentialTestRequest;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=AlpacaApi.credentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AlpacaApi.credentials.d.ts","sourceRoot":"","sources":["../../credentials/AlpacaApi.credentials.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,eAAe,EAChB,MAAM,cAAc,CAAC;AAEtB,qBAAa,SAAU,YAAW,eAAe;IAC/C,IAAI,SAAe;IACnB,WAAW,SAAgB;IAC3B,gBAAgB,SAAsD;IACtE,UAAU,EAAE,eAAe,EAAE,CAuD3B;IAEF,YAAY,EAAE,oBAAoB,CAQhC;IAEF,IAAI,EAAE,sBAAsB,CAO1B;CACH"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) Velocity BPA, LLC
|
|
4
|
+
* Licensed under the Business Source License 1.1
|
|
5
|
+
* Commercial use requires a separate commercial license.
|
|
6
|
+
* See LICENSE file for details.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.AlpacaApi = void 0;
|
|
10
|
+
class AlpacaApi {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.name = 'alpacaApi';
|
|
13
|
+
this.displayName = 'Alpaca API';
|
|
14
|
+
this.documentationUrl = 'https://docs.alpaca.markets/docs/getting-started';
|
|
15
|
+
this.properties = [
|
|
16
|
+
{
|
|
17
|
+
displayName: 'API Key ID',
|
|
18
|
+
name: 'apiKeyId',
|
|
19
|
+
type: 'string',
|
|
20
|
+
default: '',
|
|
21
|
+
required: true,
|
|
22
|
+
description: 'Your Alpaca API Key ID',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
displayName: 'API Secret Key',
|
|
26
|
+
name: 'apiSecretKey',
|
|
27
|
+
type: 'string',
|
|
28
|
+
typeOptions: {
|
|
29
|
+
password: true,
|
|
30
|
+
},
|
|
31
|
+
default: '',
|
|
32
|
+
required: true,
|
|
33
|
+
description: 'Your Alpaca API Secret Key',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
displayName: 'Environment',
|
|
37
|
+
name: 'environment',
|
|
38
|
+
type: 'options',
|
|
39
|
+
options: [
|
|
40
|
+
{
|
|
41
|
+
name: 'Paper Trading',
|
|
42
|
+
value: 'paper',
|
|
43
|
+
description: 'Use paper trading environment for testing',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'Live Trading',
|
|
47
|
+
value: 'live',
|
|
48
|
+
description: 'Use live trading environment with real money',
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
default: 'paper',
|
|
52
|
+
description: 'Choose between paper trading (testing) and live trading environments',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
displayName: 'Trading API Base URL',
|
|
56
|
+
name: 'tradingBaseUrl',
|
|
57
|
+
type: 'string',
|
|
58
|
+
default: '',
|
|
59
|
+
placeholder: 'https://paper-api.alpaca.markets',
|
|
60
|
+
description: 'Override the trading API base URL. Leave empty to use default based on environment.',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
displayName: 'Data API Base URL',
|
|
64
|
+
name: 'dataBaseUrl',
|
|
65
|
+
type: 'string',
|
|
66
|
+
default: 'https://data.alpaca.markets',
|
|
67
|
+
description: 'The Market Data API base URL',
|
|
68
|
+
},
|
|
69
|
+
];
|
|
70
|
+
this.authenticate = {
|
|
71
|
+
type: 'generic',
|
|
72
|
+
properties: {
|
|
73
|
+
headers: {
|
|
74
|
+
'APCA-API-KEY-ID': '={{$credentials.apiKeyId}}',
|
|
75
|
+
'APCA-API-SECRET-KEY': '={{$credentials.apiSecretKey}}',
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
this.test = {
|
|
80
|
+
request: {
|
|
81
|
+
baseURL: '={{$credentials.environment === "live" ? "https://api.alpaca.markets" : "https://paper-api.alpaca.markets"}}',
|
|
82
|
+
url: '/v2/account',
|
|
83
|
+
method: 'GET',
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.AlpacaApi = AlpacaApi;
|
|
89
|
+
//# sourceMappingURL=AlpacaApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AlpacaApi.credentials.js","sourceRoot":"","sources":["../../credentials/AlpacaApi.credentials.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AASH,MAAa,SAAS;IAAtB;QACE,SAAI,GAAG,WAAW,CAAC;QACnB,gBAAW,GAAG,YAAY,CAAC;QAC3B,qBAAgB,GAAG,kDAAkD,CAAC;QACtE,eAAU,GAAsB;YAC9B;gBACE,WAAW,EAAE,YAAY;gBACzB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,wBAAwB;aACtC;YACD;gBACE,WAAW,EAAE,gBAAgB;gBAC7B,IAAI,EAAE,cAAc;gBACpB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE;oBACX,QAAQ,EAAE,IAAI;iBACf;gBACD,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,4BAA4B;aAC1C;YACD;gBACE,WAAW,EAAE,aAAa;gBAC1B,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,eAAe;wBACrB,KAAK,EAAE,OAAO;wBACd,WAAW,EAAE,2CAA2C;qBACzD;oBACD;wBACE,IAAI,EAAE,cAAc;wBACpB,KAAK,EAAE,MAAM;wBACb,WAAW,EAAE,8CAA8C;qBAC5D;iBACF;gBACD,OAAO,EAAE,OAAO;gBAChB,WAAW,EAAE,sEAAsE;aACpF;YACD;gBACE,WAAW,EAAE,sBAAsB;gBACnC,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,kCAAkC;gBAC/C,WAAW,EACT,qFAAqF;aACxF;YACD;gBACE,WAAW,EAAE,mBAAmB;gBAChC,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,6BAA6B;gBACtC,WAAW,EAAE,8BAA8B;aAC5C;SACF,CAAC;QAEF,iBAAY,GAAyB;YACnC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,iBAAiB,EAAE,4BAA4B;oBAC/C,qBAAqB,EAAE,gCAAgC;iBACxD;aACF;SACF,CAAC;QAEF,SAAI,GAA2B;YAC7B,OAAO,EAAE;gBACP,OAAO,EACL,8GAA8G;gBAChH,GAAG,EAAE,aAAa;gBAClB,MAAM,EAAE,KAAK;aACd;SACF,CAAC;IACJ,CAAC;CAAA;AA/ED,8BA+EC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class Alpaca implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=Alpaca.node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Alpaca.node.d.ts","sourceRoot":"","sources":["../../../nodes/Alpaca/Alpaca.node.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,oBAAoB,EAErB,MAAM,cAAc,CAAC;AAyBtB,qBAAa,MAAO,YAAW,SAAS;IACtC,WAAW,EAAE,oBAAoB,CA0F/B;IAEI,OAAO,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC;CAkFxE"}
|