@luisjpf/alpaca-sdk 0.2.8 → 0.2.10

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/README.md CHANGED
@@ -20,14 +20,7 @@ Modern, type-safe TypeScript SDK for Alpaca's Trading, Broker, and Market Data A
20
20
  ## Installation
21
21
 
22
22
  ```bash
23
- # Full SDK (recommended)
24
23
  pnpm add @luisjpf/alpaca-sdk
25
-
26
- # Or individual packages
27
- pnpm add @luisjpf/trading
28
- pnpm add @luisjpf/market-data
29
- pnpm add @luisjpf/broker
30
- pnpm add @luisjpf/streaming
31
24
  ```
32
25
 
33
26
  ## Quick Start
@@ -61,29 +54,17 @@ const bars = await alpaca.marketData.stocks.getSymbolBars('AAPL', {
61
54
  })
62
55
  ```
63
56
 
64
- ## Packages
65
-
66
- | Package | Description |
67
- | ---------------------- | ----------------------------------------------- |
68
- | `@luisjpf/alpaca-sdk` | Complete SDK with all APIs |
69
- | `@luisjpf/trading` | Trading API (orders, positions, account) |
70
- | `@luisjpf/market-data` | Market Data API (stocks, crypto, options, news) |
71
- | `@luisjpf/broker` | Broker API (sub-accounts, funding, KYC) |
72
- | `@luisjpf/streaming` | WebSocket clients for real-time data |
73
- | `@luisjpf/core` | Shared utilities (auth, errors, types) |
74
-
75
57
  ## Configuration
76
58
 
77
59
  ```typescript
78
- import { createTradingClient } from '@luisjpf/trading'
60
+ import { createAlpacaClient } from '@luisjpf/alpaca-sdk'
79
61
 
80
- const client = createTradingClient({
62
+ const alpaca = createAlpacaClient({
81
63
  keyId: 'YOUR_API_KEY',
82
64
  secretKey: 'YOUR_SECRET_KEY',
83
65
  paper: true, // default: true
84
66
  timeout: 30_000, // default: 30s
85
67
  maxRetries: 2, // default: 2
86
- baseUrl: 'custom-url', // optional override
87
68
  })
88
69
  ```
89
70
 
@@ -97,7 +78,7 @@ The SDK automatically retries failed requests for:
97
78
  - **500+ Server Errors** - Uses exponential backoff with jitter
98
79
 
99
80
  ```typescript
100
- const client = createTradingClient({
81
+ const alpaca = createAlpacaClient({
101
82
  keyId: 'YOUR_API_KEY',
102
83
  secretKey: 'YOUR_SECRET_KEY',
103
84
  maxRetries: 2, // default: 2 (set to 0 to disable)
@@ -120,7 +101,7 @@ import {
120
101
  ValidationError,
121
102
  MarketClosedError,
122
103
  ServerError,
123
- } from '@luisjpf/core'
104
+ } from '@luisjpf/alpaca-sdk'
124
105
 
125
106
  try {
126
107
  await client.orders.create({ ... })
@@ -182,6 +163,7 @@ For type-safe error handling without `instanceof`:
182
163
 
183
164
  ```typescript
184
165
  import {
166
+ AlpacaError,
185
167
  isAuthenticationError,
186
168
  isRateLimitError,
187
169
  isInsufficientFundsError,
@@ -189,7 +171,7 @@ import {
189
171
  isNotFoundError,
190
172
  isMarketClosedError,
191
173
  isServerError,
192
- } from '@luisjpf/core'
174
+ } from '@luisjpf/alpaca-sdk'
193
175
 
194
176
  try {
195
177
  await client.orders.create({ ... })
@@ -213,7 +195,7 @@ Real-time market data and trade updates via WebSocket.
213
195
  ### Stock Data Streaming
214
196
 
215
197
  ```typescript
216
- import { createStockStream } from '@luisjpf/streaming'
198
+ import { createStockStream } from '@luisjpf/alpaca-sdk'
217
199
 
218
200
  const stream = createStockStream({
219
201
  keyId: 'YOUR_API_KEY',
@@ -247,7 +229,7 @@ stream.subscribeForBars(['AAPL'])
247
229
  ### Crypto Data Streaming
248
230
 
249
231
  ```typescript
250
- import { createCryptoStream } from '@luisjpf/streaming'
232
+ import { createCryptoStream } from '@luisjpf/alpaca-sdk'
251
233
 
252
234
  const stream = createCryptoStream({
253
235
  keyId: 'YOUR_API_KEY',
@@ -266,7 +248,7 @@ stream.subscribeForTrades(['BTC/USD', 'ETH/USD'])
266
248
  ### Trade Updates Streaming
267
249
 
268
250
  ```typescript
269
- import { createTradeUpdatesStream } from '@luisjpf/streaming'
251
+ import { createTradeUpdatesStream } from '@luisjpf/alpaca-sdk'
270
252
 
271
253
  const stream = createTradeUpdatesStream({
272
254
  keyId: 'YOUR_API_KEY',