@luisjpf/alpaca-sdk 0.3.2 → 0.3.4
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 +35 -2
- package/dist/index.cjs +235 -166
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -6
- package/dist/index.d.ts +21 -6
- package/dist/index.js +222 -153
- package/dist/index.js.map +1 -1
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -17,6 +17,33 @@ Modern, type-safe TypeScript SDK for Alpaca's Trading, Broker, and Market Data A
|
|
|
17
17
|
- **WebSocket Streaming**: Real-time market data and trade updates
|
|
18
18
|
- **Modern**: ESM-first with CommonJS compatibility
|
|
19
19
|
|
|
20
|
+
## Documentation
|
|
21
|
+
|
|
22
|
+
- [Getting Started](docs/getting-started.md) - Installation, setup, first request
|
|
23
|
+
- [Configuration](docs/configuration.md) - Client options, paper vs live, custom URLs
|
|
24
|
+
- [Error Handling](docs/error-handling.md) - Error classes, type guards, retries
|
|
25
|
+
- [Streaming](docs/streaming.md) - Real-time WebSocket data
|
|
26
|
+
- [Advanced Usage](docs/advanced.md) - Raw client, AbortSignal, type generation
|
|
27
|
+
|
|
28
|
+
For API-specific details (order types, timeframes, asset classes), see the [Alpaca API docs](https://docs.alpaca.markets).
|
|
29
|
+
|
|
30
|
+
## Examples
|
|
31
|
+
|
|
32
|
+
| Example | Description |
|
|
33
|
+
| ------------------------------------------------ | ----------------------------------------------------- |
|
|
34
|
+
| [Basic Setup](examples/01-basic-setup) | Create a client, get account info, check market clock |
|
|
35
|
+
| [Place Orders](examples/02-place-order) | Market, limit, and stop-limit orders |
|
|
36
|
+
| [Manage Positions](examples/03-manage-positions) | List, inspect, and close positions |
|
|
37
|
+
| [Market Data](examples/04-market-data) | Historical bars, latest quotes, snapshots |
|
|
38
|
+
| [Stream Stocks](examples/05-streaming-stocks) | Real-time stock trades and quotes |
|
|
39
|
+
| [Stream Crypto](examples/06-streaming-crypto) | Real-time crypto data |
|
|
40
|
+
| [Trade Updates](examples/07-trade-updates) | Listen for order fills and cancellations |
|
|
41
|
+
| [Error Handling](examples/08-error-handling) | Both error handling patterns |
|
|
42
|
+
| [Options Data](examples/09-options-data) | Option chains, snapshots, quotes |
|
|
43
|
+
| [Watchlists](examples/10-watchlists) | Create and manage watchlists |
|
|
44
|
+
| [News & Screener](examples/11-news-screener) | News articles, most actives, movers |
|
|
45
|
+
| [Broker Basics](examples/12-broker-basics) | Sub-accounts and transfers |
|
|
46
|
+
|
|
20
47
|
## Installation
|
|
21
48
|
|
|
22
49
|
```bash
|
|
@@ -104,7 +131,7 @@ import {
|
|
|
104
131
|
} from '@luisjpf/alpaca-sdk'
|
|
105
132
|
|
|
106
133
|
try {
|
|
107
|
-
await client.orders.create({ ... })
|
|
134
|
+
await client.trading.orders.create({ ... })
|
|
108
135
|
} catch (error) {
|
|
109
136
|
if (error instanceof RateLimitError) {
|
|
110
137
|
// Auto-retried, but still failed after maxRetries
|
|
@@ -174,7 +201,7 @@ import {
|
|
|
174
201
|
} from '@luisjpf/alpaca-sdk'
|
|
175
202
|
|
|
176
203
|
try {
|
|
177
|
-
await client.orders.create({ ... })
|
|
204
|
+
await client.trading.orders.create({ ... })
|
|
178
205
|
} catch (error) {
|
|
179
206
|
if (error instanceof AlpacaError) {
|
|
180
207
|
const apiError = error.toApiError()
|
|
@@ -301,8 +328,14 @@ pnpm test:coverage
|
|
|
301
328
|
# Lint code
|
|
302
329
|
pnpm lint
|
|
303
330
|
|
|
331
|
+
# Lint examples
|
|
332
|
+
pnpm lint:examples
|
|
333
|
+
|
|
304
334
|
# Type check
|
|
305
335
|
pnpm typecheck
|
|
336
|
+
|
|
337
|
+
# Type check examples
|
|
338
|
+
pnpm typecheck:examples
|
|
306
339
|
```
|
|
307
340
|
|
|
308
341
|
## Requirements
|