@stocklayer/sdk 0.0.0-stage → 0.1.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/CHANGELOG.md +142 -0
- package/LICENSE +21 -0
- package/README.md +141 -2
- package/dist/index.d.ts +120 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +259 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +377 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -0
- package/package.json +59 -4
- package/src/index.ts +432 -0
- package/src/types.ts +445 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0 — Stocklayer (unreleased)
|
|
4
|
+
|
|
5
|
+
Fresh @stocklayer package identity and stocklayer.dev API target. SDK exports use Stocklayer names; MCP tools and configuration use stocklayer and STOCKLAYER prefixes. Existing RailX credentials are not migrated.
|
|
6
|
+
|
|
7
|
+
## Historical RailX releases
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
All notable changes to `@railx/sdk` are recorded here. The package follows semantic versioning and targets the public RailX V0 API documented at [railx.dev/docs](https://railx.dev/docs).
|
|
11
|
+
|
|
12
|
+
## 0.6.3 — 2026-09-13
|
|
13
|
+
|
|
14
|
+
Targets API `v0`.
|
|
15
|
+
|
|
16
|
+
### Documentation
|
|
17
|
+
|
|
18
|
+
- Improve npm search metadata with exact Stock Token, tokenized-stock, Robinhood Chain, TypeScript, RWA, trading API, and AI-agent terms.
|
|
19
|
+
- Add common integration use cases and a direct path from the SDK to the official MCP server.
|
|
20
|
+
- Add the public issue tracker to package metadata.
|
|
21
|
+
|
|
22
|
+
## 0.6.2 — 2026-09-12
|
|
23
|
+
|
|
24
|
+
Targets API `v0`.
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
- Preserve structured timeout and cancellation errors while reading response bodies, including safe timeout retries.
|
|
29
|
+
- Reject malformed success envelopes instead of returning undefined data.
|
|
30
|
+
- Require a finite, non-negative integer retry count.
|
|
31
|
+
- Correct the Node.js requirement to 20.3 or newer for combined timeout and cancellation signals.
|
|
32
|
+
- Include source files so published source maps resolve within the package.
|
|
33
|
+
|
|
34
|
+
### Documentation
|
|
35
|
+
|
|
36
|
+
- Align the introduction with the public Stock Tokens message and explain all three plan verdicts, policy configuration, and caller-supplied idempotency keys.
|
|
37
|
+
|
|
38
|
+
## 0.6.1
|
|
39
|
+
|
|
40
|
+
Targets API `v0`.
|
|
41
|
+
|
|
42
|
+
### Documentation
|
|
43
|
+
|
|
44
|
+
- Corrected the trade-plan example to read `plan.signing.unsignedTransactions`.
|
|
45
|
+
- Made the first trade example runnable with a test key and the funded sandbox fixture wallet.
|
|
46
|
+
- Aligned the README with the RailX Stock Token infrastructure positioning.
|
|
47
|
+
|
|
48
|
+
Runtime behavior and the API contract are unchanged.
|
|
49
|
+
|
|
50
|
+
## 0.6.0
|
|
51
|
+
|
|
52
|
+
Targets API `v0`.
|
|
53
|
+
|
|
54
|
+
### Added
|
|
55
|
+
|
|
56
|
+
- Added a 30-second default request timeout with client-level and per-request overrides.
|
|
57
|
+
- Added per-request `AbortSignal` support across every SDK method.
|
|
58
|
+
- Added structured `REQUEST_TIMEOUT` and `REQUEST_ABORTED` errors.
|
|
59
|
+
- Published the SDK's behavioral test suite in the public source repository.
|
|
60
|
+
|
|
61
|
+
### Changed
|
|
62
|
+
|
|
63
|
+
- Rewrote the public README around installation, the first trade, the sandbox, and the SDK's safety behavior.
|
|
64
|
+
- Made the public quality and release workflows run the test suite before packaging or publishing.
|
|
65
|
+
|
|
66
|
+
## 0.5.1
|
|
67
|
+
|
|
68
|
+
Targets API `v0`.
|
|
69
|
+
|
|
70
|
+
### Changed
|
|
71
|
+
|
|
72
|
+
- Reissued the SDK from a clean, RailX-authored public repository history with verified npm provenance.
|
|
73
|
+
|
|
74
|
+
## 0.5.0
|
|
75
|
+
|
|
76
|
+
Targets API `v0`.
|
|
77
|
+
|
|
78
|
+
### Added
|
|
79
|
+
|
|
80
|
+
- Added human-readable and base-unit maximum-input and minimum-output bounds to every quote and trade plan.
|
|
81
|
+
|
|
82
|
+
## 0.4.1
|
|
83
|
+
|
|
84
|
+
Targets API `v0`.
|
|
85
|
+
|
|
86
|
+
### Changed
|
|
87
|
+
|
|
88
|
+
- Moved the public source repository to the dedicated RailX identity at `railxdev/sdk`.
|
|
89
|
+
- Made the SDK TypeScript configuration standalone so the public repository builds independently from the private product monorepo.
|
|
90
|
+
|
|
91
|
+
## 0.4.0
|
|
92
|
+
|
|
93
|
+
Targets API `v0`. This is the first public release under the final RailX package identity.
|
|
94
|
+
|
|
95
|
+
### Changed
|
|
96
|
+
|
|
97
|
+
- Adopted the final `@railx/sdk` package identity.
|
|
98
|
+
- Renamed the public client to `RailXClient`, its options and response metadata types to `RailXClientOptions` and `RailXResponseInfo`, and structured failures to `RailXApiError`.
|
|
99
|
+
- Switched project-key examples and response metadata to `railx_test_`, `railx_live_`, and `x-railx-*`.
|
|
100
|
+
|
|
101
|
+
### Migration
|
|
102
|
+
|
|
103
|
+
Replace imports from `@rail/markets` with `@railx/sdk`, instantiate `RailXClient`, and update any direct header reads to the `x-railx-*` names. Previously issued project keys remain accepted by the V0 server during the preview migration.
|
|
104
|
+
|
|
105
|
+
## 0.3.0
|
|
106
|
+
|
|
107
|
+
Targets API `v0`. Not yet published to a registry.
|
|
108
|
+
|
|
109
|
+
### Added
|
|
110
|
+
|
|
111
|
+
- Corporate-action list types and `client.corporateActions.list()` with symbol, type, status, and limit filters.
|
|
112
|
+
- Explicit `exact_input` and `exact_output` trade intents for quotes and plans.
|
|
113
|
+
- Human-readable and base-unit output amounts on normalized quotes.
|
|
114
|
+
- Explainable `allow`, `warn`, and `block` trade-plan verdict types, including the immutable project-policy version and structured safety or policy checks.
|
|
115
|
+
|
|
116
|
+
### Compatibility
|
|
117
|
+
|
|
118
|
+
- The legacy V0 exact-input request remains accepted. New integrations should use the discriminated `intent` shape.
|
|
119
|
+
- Existing plan calls require no client change. A blocked plan contains no steps or unsigned transactions; a warning uses `review_required` and keeps its transactions for human review.
|
|
120
|
+
|
|
121
|
+
## 0.2.0
|
|
122
|
+
|
|
123
|
+
Targets API `v0`. Not yet published to a registry.
|
|
124
|
+
|
|
125
|
+
### Added
|
|
126
|
+
|
|
127
|
+
- `types.ts` as the single source of the wire contract, shared with the server and exported from the package root and from `@railx/sdk/types`.
|
|
128
|
+
- Full typed responses for every endpoint: `AssetList`, `CanonicalAsset`, `PriceObservation`, `Portfolio`, `Quote`, `TradePlan`, `SimulationResult`, `HealthReport`, and `ApiIndex`.
|
|
129
|
+
- `system.index()` and `system.health()`.
|
|
130
|
+
- `scenario` option to force a sandbox scenario on test keys via `x-railx-scenario`.
|
|
131
|
+
- `retries` option: safe GET requests are retried on retryable errors, honoring `Retry-After`. POST requests are never retried.
|
|
132
|
+
- `client.lastResponse` with request ID, environment, plan, sandbox flag, minute-limit, and monthly-allowance metadata from the most recent response.
|
|
133
|
+
- `readResponseInfo(response)` helper.
|
|
134
|
+
- `API_VERSION` and `SDK_VERSION` constants.
|
|
135
|
+
|
|
136
|
+
### Changed
|
|
137
|
+
|
|
138
|
+
- Non-JSON responses now produce a `RailXApiError` with code `API_ERROR` instead of a raw parse failure.
|
|
139
|
+
|
|
140
|
+
## 0.1.0
|
|
141
|
+
|
|
142
|
+
Initial repository-local client with `assets`, `prices`, `portfolios`, `quotes`, `trades`, and `transactions` groups and structured `RailXApiError`.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 RailX
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,142 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://stocklayer.dev">
|
|
3
|
+
<img src="https://stocklayer.dev/stocklayer-avatar.png" alt="Stocklayer" width="88" height="88" />
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
2
6
|
|
|
3
|
-
|
|
7
|
+
# `@stocklayer/sdk`
|
|
8
|
+
|
|
9
|
+
Put the stock market in your app. Stocklayer is the trading API for tokenized stocks on Robinhood Chain, built for apps, wallets, bots, and AI agents.
|
|
10
|
+
|
|
11
|
+
The official TypeScript SDK resolves Stock Tokens, finds routes, checks project policy, builds every required transaction, and simulates the full sequence. Your app gets an explainable verdict and an unsigned plan. Your wallet signs.
|
|
12
|
+
|
|
13
|
+
[Documentation](https://stocklayer.dev/docs) · [OpenAPI](https://stocklayer.dev/api/v0/openapi) · [npm](https://www.npmjs.com/package/@stocklayer/sdk) · [Issues](https://github.com/stocklayerdev/sdk/issues)
|
|
14
|
+
|
|
15
|
+
Use `@stocklayer/sdk` to add Robinhood Chain market data and Stock Token trading to:
|
|
16
|
+
|
|
17
|
+
- investing apps and embedded stock experiences;
|
|
18
|
+
- wallets, portfolio trackers, and trading bots;
|
|
19
|
+
- TypeScript backends that need quotes or checked trade plans; and
|
|
20
|
+
- AI agents that need structured market context and unsigned transactions.
|
|
21
|
+
|
|
22
|
+
## Install
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install @stocklayer/sdk
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Node.js 20.3 or newer is required. The SDK targets API `v0`; SDK releases use their own semantic versions.
|
|
29
|
+
|
|
30
|
+
Create a free test key in the [Stocklayer dashboard](https://stocklayer.dev/dashboard). Test keys use a deterministic sandbox, so you can try the complete API without funds or provider credentials.
|
|
31
|
+
|
|
32
|
+
## Plan a trade in the sandbox
|
|
33
|
+
|
|
34
|
+
Create a test key in the [dashboard](https://stocklayer.dev/dashboard), set `STOCKLAYER_PROJECT_KEY`, and use the funded fixture wallet below. This moves no funds. Use a live key and your own wallet only when ready to leave the sandbox.
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import { StocklayerClient } from '@stocklayer/sdk';
|
|
38
|
+
|
|
39
|
+
const stocklayer = new StocklayerClient({
|
|
40
|
+
baseUrl: 'https://stocklayer.dev/api/v0',
|
|
41
|
+
apiKey: process.env.STOCKLAYER_PROJECT_KEY,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const plan = await stocklayer.trades.plan({
|
|
45
|
+
wallet: '0x0000000000000000000000000000000000000001',
|
|
46
|
+
intent: {
|
|
47
|
+
type: 'exact_input',
|
|
48
|
+
tokenIn: 'USDG',
|
|
49
|
+
tokenOut: 'NVDA',
|
|
50
|
+
amountIn: '500',
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
console.log(plan.verdict);
|
|
55
|
+
console.log(plan.signing.unsignedTransactions);
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Stocklayer never holds funds or signs transactions. `allow` returns a `ready` plan. `warn` returns `review_required` with transactions for human review. `block` returns no signable transactions.
|
|
59
|
+
|
|
60
|
+
## What the SDK covers
|
|
61
|
+
|
|
62
|
+
- Official Stock Token resolution and reference prices
|
|
63
|
+
- Wallet balances and portfolio context
|
|
64
|
+
- Corporate actions
|
|
65
|
+
- Exact-input and exact-output quotes
|
|
66
|
+
- Durable, idempotent trade plans
|
|
67
|
+
- Project policy with `allow`, `warn`, and `block` verdicts
|
|
68
|
+
- Full-sequence onchain simulation
|
|
69
|
+
- A deterministic test-key sandbox
|
|
70
|
+
|
|
71
|
+
Every request and response type is exported from the package root and from `@stocklayer/sdk/types`. The API and SDK share the same contract source. Configure project policy in the dashboard; the SDK returns the policy version, checks, and verdict with each plan.
|
|
72
|
+
|
|
73
|
+
## Use the free sandbox
|
|
74
|
+
|
|
75
|
+
A `stocklayer_test_` key never calls a quote provider or the chain. It returns repeatable fixtures, so local development and CI do not need provider credentials or funded wallets.
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
const sandbox = new StocklayerClient({
|
|
79
|
+
baseUrl: 'https://stocklayer.dev/api/v0',
|
|
80
|
+
apiKey: process.env.STOCKLAYER_TEST_KEY,
|
|
81
|
+
scenario: 'simulation_failed',
|
|
82
|
+
});
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
See the [sandbox fixtures](https://stocklayer.dev/docs#sandbox) for every wallet and outcome.
|
|
86
|
+
|
|
87
|
+
## Add Stocklayer tools to an AI agent
|
|
88
|
+
|
|
89
|
+
Use the official [`@stocklayer/mcp`](https://www.npmjs.com/package/@stocklayer/mcp) server to expose the same market, portfolio, quote, planning, and simulation operations to Claude, Cursor, and other MCP clients.
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
npx -y @stocklayer/mcp
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
See the [agent setup guide](https://stocklayer.dev/docs#agents) for the complete MCP configuration.
|
|
96
|
+
|
|
97
|
+
## Timeouts and cancellation
|
|
98
|
+
|
|
99
|
+
Each attempt, including reading its response body, times out after 30 seconds by default. Set a client default, override one call, or cancel it with an `AbortController`.
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
const stocklayer = new StocklayerClient({
|
|
103
|
+
baseUrl: 'https://stocklayer.dev/api/v0',
|
|
104
|
+
apiKey: process.env.STOCKLAYER_PROJECT_KEY,
|
|
105
|
+
timeoutMs: 10_000,
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
const controller = new AbortController();
|
|
109
|
+
|
|
110
|
+
const price = await stocklayer.prices.get('NVDA', {
|
|
111
|
+
signal: controller.signal,
|
|
112
|
+
timeoutMs: 5_000,
|
|
113
|
+
});
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Set `timeoutMs: 0` to disable the timeout.
|
|
117
|
+
|
|
118
|
+
## Errors and retries
|
|
119
|
+
|
|
120
|
+
API failures and malformed response envelopes throw `StocklayerApiError` with `status`, `code`, `retryable`, `details`, and `requestId`. Timeouts use `REQUEST_TIMEOUT`; caller cancellation uses `REQUEST_ABORTED` and is never retried.
|
|
121
|
+
|
|
122
|
+
Safe GET requests retry retryable failures up to `retries` times (default 2). Quote and simulation POST requests are never retried. Trade-plan creation is retried safely with the same idempotency key, so one intent cannot create duplicate plans.
|
|
123
|
+
|
|
124
|
+
Use a non-negative integer for `retries`. Pass `{ idempotencyKey: 'your-unique-trade-id' }` as the second argument to `trades.plan()` to reuse an intent across separate calls. Keys are 16–128 URL-safe characters; reuse a key only for the same intent, and create a new key after its plan expires.
|
|
125
|
+
|
|
126
|
+
```ts
|
|
127
|
+
import { StocklayerApiError } from '@stocklayer/sdk';
|
|
128
|
+
|
|
129
|
+
try {
|
|
130
|
+
await stocklayer.assets.get('UNKNOWN');
|
|
131
|
+
} catch (error) {
|
|
132
|
+
if (error instanceof StocklayerApiError) {
|
|
133
|
+
console.error(error.code, error.requestId);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
`stocklayer.lastResponse` exposes the request ID, environment, plan, sandbox state, and rate-limit metadata from the most recent response.
|
|
139
|
+
|
|
140
|
+
## License
|
|
141
|
+
|
|
142
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import type { ApiIndex, AssetList, CanonicalAsset, CorporateActionList, CorporateActionStatus, CorporateActionType, HealthReport, Portfolio, PriceObservation, Quote, SandboxScenario, SimulateRequest, SimulationResult, TradePlan, TradeRequest } from './types.js';
|
|
2
|
+
export type * from './types.js';
|
|
3
|
+
export { ROBINHOOD_CHAIN_ID } from './types.js';
|
|
4
|
+
/** The API version this SDK release targets. */
|
|
5
|
+
export declare const API_VERSION: "v0";
|
|
6
|
+
/** Keep in sync with `package.json`; verified by the test suite. */
|
|
7
|
+
export declare const SDK_VERSION = "0.1.0";
|
|
8
|
+
export interface StocklayerRequestOptions {
|
|
9
|
+
/** Cancel this request with an AbortController. */
|
|
10
|
+
signal?: AbortSignal;
|
|
11
|
+
/** Override the client's per-attempt timeout. Set to 0 to disable. */
|
|
12
|
+
timeoutMs?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface StocklayerTradePlanOptions extends StocklayerRequestOptions {
|
|
15
|
+
/** Reuse this key when retrying the same intent. Generated when omitted. */
|
|
16
|
+
idempotencyKey?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface StocklayerClientOptions {
|
|
19
|
+
/** Base URL including the version segment, e.g. `https://host/api/v0`. */
|
|
20
|
+
baseUrl: string;
|
|
21
|
+
/** Project key beginning with `stocklayer_test_` or `stocklayer_live_`. */
|
|
22
|
+
apiKey?: string;
|
|
23
|
+
fetch?: typeof globalThis.fetch;
|
|
24
|
+
/**
|
|
25
|
+
* Force a sandbox scenario on every request. Only valid with test keys;
|
|
26
|
+
* the API rejects it on live keys.
|
|
27
|
+
*/
|
|
28
|
+
scenario?: SandboxScenario;
|
|
29
|
+
/**
|
|
30
|
+
* Retries for safe GET requests and idempotent plan creation when they fail
|
|
31
|
+
* with a retryable error. Other POST requests are never retried. Default 2.
|
|
32
|
+
*/
|
|
33
|
+
retries?: number;
|
|
34
|
+
/** Per-attempt timeout in milliseconds. Set to 0 to disable. Default 30000. */
|
|
35
|
+
timeoutMs?: number;
|
|
36
|
+
}
|
|
37
|
+
export interface StocklayerResponseInfo {
|
|
38
|
+
requestId: string | null;
|
|
39
|
+
status: number;
|
|
40
|
+
sandbox: boolean;
|
|
41
|
+
plan: string | null;
|
|
42
|
+
environment: 'test' | 'live' | null;
|
|
43
|
+
rateLimit: {
|
|
44
|
+
limit: number;
|
|
45
|
+
remaining: number;
|
|
46
|
+
resetAt: number;
|
|
47
|
+
} | null;
|
|
48
|
+
monthly: {
|
|
49
|
+
limit: number;
|
|
50
|
+
remaining: number;
|
|
51
|
+
} | null;
|
|
52
|
+
}
|
|
53
|
+
export declare class StocklayerApiError extends Error {
|
|
54
|
+
readonly status: number;
|
|
55
|
+
readonly code: string;
|
|
56
|
+
readonly retryable: boolean;
|
|
57
|
+
readonly details: unknown;
|
|
58
|
+
readonly requestId: string | null;
|
|
59
|
+
constructor(options: {
|
|
60
|
+
status: number;
|
|
61
|
+
code: string;
|
|
62
|
+
message: string;
|
|
63
|
+
retryable?: boolean;
|
|
64
|
+
details?: unknown;
|
|
65
|
+
requestId?: string | null;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
export declare function readResponseInfo(response: Response): StocklayerResponseInfo;
|
|
69
|
+
export declare class StocklayerClient {
|
|
70
|
+
readonly system: {
|
|
71
|
+
index: (requestOptions?: StocklayerRequestOptions) => Promise<ApiIndex>;
|
|
72
|
+
health: (requestOptions?: StocklayerRequestOptions) => Promise<HealthReport>;
|
|
73
|
+
};
|
|
74
|
+
readonly assets: {
|
|
75
|
+
list: (options?: {
|
|
76
|
+
status?: 'active' | 'inactive' | 'all';
|
|
77
|
+
limit?: number;
|
|
78
|
+
after?: string;
|
|
79
|
+
}, requestOptions?: StocklayerRequestOptions) => Promise<AssetList>;
|
|
80
|
+
get: (symbol: string, requestOptions?: StocklayerRequestOptions) => Promise<CanonicalAsset>;
|
|
81
|
+
};
|
|
82
|
+
readonly prices: {
|
|
83
|
+
get: (symbol: string, requestOptions?: StocklayerRequestOptions) => Promise<PriceObservation>;
|
|
84
|
+
};
|
|
85
|
+
readonly corporateActions: {
|
|
86
|
+
list: (options?: {
|
|
87
|
+
symbol?: string;
|
|
88
|
+
type?: CorporateActionType;
|
|
89
|
+
status?: CorporateActionStatus;
|
|
90
|
+
limit?: number;
|
|
91
|
+
}, requestOptions?: StocklayerRequestOptions) => Promise<CorporateActionList>;
|
|
92
|
+
};
|
|
93
|
+
readonly portfolios: {
|
|
94
|
+
get: (wallet: string, options?: {
|
|
95
|
+
symbols?: string[];
|
|
96
|
+
includeZero?: boolean;
|
|
97
|
+
}, requestOptions?: StocklayerRequestOptions) => Promise<Portfolio>;
|
|
98
|
+
};
|
|
99
|
+
readonly quotes: {
|
|
100
|
+
create: (request: TradeRequest, options?: StocklayerRequestOptions) => Promise<Quote>;
|
|
101
|
+
};
|
|
102
|
+
readonly trades: {
|
|
103
|
+
plan: (request: TradeRequest, options?: StocklayerTradePlanOptions) => Promise<TradePlan>;
|
|
104
|
+
get: (planId: string, options?: StocklayerRequestOptions) => Promise<TradePlan>;
|
|
105
|
+
};
|
|
106
|
+
readonly transactions: {
|
|
107
|
+
simulate: (input: SimulateRequest, options?: StocklayerRequestOptions) => Promise<SimulationResult>;
|
|
108
|
+
};
|
|
109
|
+
/** Metadata from the most recent response, including limits and sandbox state. */
|
|
110
|
+
lastResponse: StocklayerResponseInfo | null;
|
|
111
|
+
private readonly baseUrl;
|
|
112
|
+
private readonly apiKey?;
|
|
113
|
+
private readonly scenario?;
|
|
114
|
+
private readonly retries;
|
|
115
|
+
private readonly timeoutMs;
|
|
116
|
+
private readonly requestFetch;
|
|
117
|
+
constructor(options: StocklayerClientOptions);
|
|
118
|
+
private request;
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,QAAQ,EAER,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,KAAK,EACL,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,SAAS,EACT,YAAY,EACb,MAAM,YAAY,CAAC;AAEpB,mBAAmB,YAAY,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,gDAAgD;AAChD,eAAO,MAAM,WAAW,EAAG,IAAa,CAAC;AACzC,oEAAoE;AACpE,eAAO,MAAM,WAAW,UAAU,CAAC;AAEnC,MAAM,WAAW,wBAAwB;IACvC,mDAAmD;IACnD,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,0BAA2B,SAAQ,wBAAwB;IAC1E,4EAA4E;IAC5E,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,uBAAuB;IACtC,0EAA0E;IAC1E,OAAO,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+EAA+E;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,MAAM,GAAG,IAAI,C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