thetadatadx 8.0.25 → 8.0.30
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 +26 -20
- package/index.d.ts +119 -30
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -36,14 +36,19 @@ async function main() {
|
|
|
36
36
|
// With timeout
|
|
37
37
|
const snap = tdx.stockSnapshotQuote(['AAPL', 'MSFT'], null, null, 5000);
|
|
38
38
|
|
|
39
|
-
// Streaming —
|
|
40
|
-
//
|
|
41
|
-
|
|
39
|
+
// Streaming — register a callback. napi-rs `ThreadsafeFunction`
|
|
40
|
+
// routes every event through libuv's `uv_async_t` queue onto the
|
|
41
|
+
// Node main thread; the callback runs there, decoupled from the
|
|
42
|
+
// FPSS reader thread. A slow callback fills the SSOT dispatcher's
|
|
43
|
+
// bounded queue and overflow events are dropped (observable via
|
|
44
|
+
// `tdx.droppedEventCount()`); the FPSS TLS reader is never blocked.
|
|
45
|
+
tdx.startStreaming((event) => {
|
|
46
|
+
if (event.kind === 'quote') {
|
|
47
|
+
console.log(event.quote.bid, event.quote.ask);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
42
50
|
tdx.subscribeQuotes('AAPL');
|
|
43
|
-
|
|
44
|
-
if (event && event.kind === 'quote') {
|
|
45
|
-
console.log(event.quote.bid, event.quote.ask);
|
|
46
|
-
}
|
|
51
|
+
// ...do other work; the callback fires on incoming events...
|
|
47
52
|
tdx.stopStreaming();
|
|
48
53
|
}
|
|
49
54
|
|
|
@@ -60,20 +65,21 @@ the Rust side, so the full typed surface lives in `index.d.ts`
|
|
|
60
65
|
import type { OhlcTick, GreeksTick, Quote, Trade, FpssEvent } from 'thetadatadx';
|
|
61
66
|
```
|
|
62
67
|
|
|
63
|
-
Historical endpoints return `Tick[]
|
|
64
|
-
|
|
68
|
+
Historical endpoints return `Tick[]`. Streaming events arrive through the
|
|
69
|
+
`startStreaming(callback)` registration; the callback receives a
|
|
70
|
+
discriminated `FpssEvent`, narrowed on `event.kind`:
|
|
65
71
|
|
|
66
72
|
```ts
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
73
|
+
tdx.startStreaming((event: FpssEvent) => {
|
|
74
|
+
switch (event.kind) {
|
|
75
|
+
case 'quote': /* event.quote is Quote */ break;
|
|
76
|
+
case 'trade': /* event.trade is Trade */ break;
|
|
77
|
+
case 'ohlcvc': /* event.ohlcvc is Ohlcvc */ break;
|
|
78
|
+
case 'open_interest': /* event.openInterest is OpenInterest */ break;
|
|
79
|
+
case 'simple': /* event.simple is FpssSimplePayload */ break;
|
|
80
|
+
case 'raw_data': /* event.rawData is FpssRawDataPayload */ break;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
77
83
|
```
|
|
78
84
|
|
|
79
85
|
The `kind` field is typed as the string-literal union
|
|
@@ -87,7 +93,7 @@ including Vite, esbuild, ts-jest, and Next.js.
|
|
|
87
93
|
|
|
88
94
|
Anywhere a Rust `u64` or `i64` crosses the napi boundary it surfaces as
|
|
89
95
|
JavaScript `bigint` (not `number`): `volume` and `count` on every
|
|
90
|
-
OHLC / EOD tick, `
|
|
96
|
+
OHLC / EOD tick, `droppedEventCount()` on the streaming client, and
|
|
91
97
|
`received_at_ns` on every FPSS event. Use `bigint` literal syntax
|
|
92
98
|
(`42n`) for comparisons or widen to `Number(x)` at the point of
|
|
93
99
|
display (watch for loss of precision beyond 2^53).
|
package/index.d.ts
CHANGED
|
@@ -9,18 +9,19 @@ export declare class ThetaDataDx {
|
|
|
9
9
|
/** Connect with a credentials file (line 1 = email, line 2 = password). */
|
|
10
10
|
static connectFromFile(path: string): ThetaDataDx
|
|
11
11
|
/**
|
|
12
|
-
* Cumulative count of FPSS events dropped because the
|
|
13
|
-
*
|
|
12
|
+
* Cumulative count of FPSS events dropped because the SSOT
|
|
13
|
+
* `StreamingDispatcher`'s bounded queue overflowed before the
|
|
14
|
+
* drain thread could hand the event off to the JS callback.
|
|
14
15
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
16
|
+
* Forwards to `thetadatadx::ThetaDataDx::dropped_event_count` so
|
|
17
|
+
* the value matches every other binding (C ABI, Python, future
|
|
18
|
+
* C++) and survives reconnect — the dispatcher carries the count
|
|
19
|
+
* across `start_streaming` / `reconnect` cycles.
|
|
19
20
|
*
|
|
20
21
|
* Returned as `bigint` so it can represent the full `u64` range
|
|
21
22
|
* (Number would top out at 2^53).
|
|
22
23
|
*/
|
|
23
|
-
|
|
24
|
+
droppedEventCount(): bigint
|
|
24
25
|
/**
|
|
25
26
|
* List all available stock ticker symbols.
|
|
26
27
|
*
|
|
@@ -298,7 +299,7 @@ export declare class ThetaDataDx {
|
|
|
298
299
|
* - `version`: `"latest"`
|
|
299
300
|
* - `use_market_value`: `false`
|
|
300
301
|
*/
|
|
301
|
-
optionSnapshotGreeksAll(symbol: string, expiration: string | Date, strike?: string | undefined | null, right?: string | undefined | null, annualDividend?: number | undefined | null, rateType?: string | undefined | null, rateValue?: number | undefined | null, stockPrice?: number | undefined | null, version?: string | undefined | null, maxDte?: number | undefined | null, strikeRange?: number | undefined | null, minTime?: string | Date | undefined | null, useMarketValue?: boolean | undefined | null, timeoutMs?: number | undefined | null): Array<
|
|
302
|
+
optionSnapshotGreeksAll(symbol: string, expiration: string | Date, strike?: string | undefined | null, right?: string | undefined | null, annualDividend?: number | undefined | null, rateType?: string | undefined | null, rateValue?: number | undefined | null, stockPrice?: number | undefined | null, version?: string | undefined | null, maxDte?: number | undefined | null, strikeRange?: number | undefined | null, minTime?: string | Date | undefined | null, useMarketValue?: boolean | undefined | null, timeoutMs?: number | undefined | null): Array<GreeksAllTick>
|
|
302
303
|
/**
|
|
303
304
|
* Get first-order Greeks snapshot (delta, theta, rho) for an option contract.
|
|
304
305
|
*
|
|
@@ -314,7 +315,7 @@ export declare class ThetaDataDx {
|
|
|
314
315
|
* - `version`: `"latest"`
|
|
315
316
|
* - `use_market_value`: `false`
|
|
316
317
|
*/
|
|
317
|
-
optionSnapshotGreeksFirstOrder(symbol: string, expiration: string | Date, strike?: string | undefined | null, right?: string | undefined | null, annualDividend?: number | undefined | null, rateType?: string | undefined | null, rateValue?: number | undefined | null, stockPrice?: number | undefined | null, version?: string | undefined | null, maxDte?: number | undefined | null, strikeRange?: number | undefined | null, minTime?: string | Date | undefined | null, useMarketValue?: boolean | undefined | null, timeoutMs?: number | undefined | null): Array<
|
|
318
|
+
optionSnapshotGreeksFirstOrder(symbol: string, expiration: string | Date, strike?: string | undefined | null, right?: string | undefined | null, annualDividend?: number | undefined | null, rateType?: string | undefined | null, rateValue?: number | undefined | null, stockPrice?: number | undefined | null, version?: string | undefined | null, maxDte?: number | undefined | null, strikeRange?: number | undefined | null, minTime?: string | Date | undefined | null, useMarketValue?: boolean | undefined | null, timeoutMs?: number | undefined | null): Array<GreeksFirstOrderTick>
|
|
318
319
|
/**
|
|
319
320
|
* Get second-order Greeks snapshot (gamma, vanna, charm) for an option contract.
|
|
320
321
|
*
|
|
@@ -330,7 +331,7 @@ export declare class ThetaDataDx {
|
|
|
330
331
|
* - `version`: `"latest"`
|
|
331
332
|
* - `use_market_value`: `false`
|
|
332
333
|
*/
|
|
333
|
-
optionSnapshotGreeksSecondOrder(symbol: string, expiration: string | Date, strike?: string | undefined | null, right?: string | undefined | null, annualDividend?: number | undefined | null, rateType?: string | undefined | null, rateValue?: number | undefined | null, stockPrice?: number | undefined | null, version?: string | undefined | null, maxDte?: number | undefined | null, strikeRange?: number | undefined | null, minTime?: string | Date | undefined | null, useMarketValue?: boolean | undefined | null, timeoutMs?: number | undefined | null): Array<
|
|
334
|
+
optionSnapshotGreeksSecondOrder(symbol: string, expiration: string | Date, strike?: string | undefined | null, right?: string | undefined | null, annualDividend?: number | undefined | null, rateType?: string | undefined | null, rateValue?: number | undefined | null, stockPrice?: number | undefined | null, version?: string | undefined | null, maxDte?: number | undefined | null, strikeRange?: number | undefined | null, minTime?: string | Date | undefined | null, useMarketValue?: boolean | undefined | null, timeoutMs?: number | undefined | null): Array<GreeksSecondOrderTick>
|
|
334
335
|
/**
|
|
335
336
|
* Get third-order Greeks snapshot (speed, color, ultima) for an option contract.
|
|
336
337
|
*
|
|
@@ -346,7 +347,7 @@ export declare class ThetaDataDx {
|
|
|
346
347
|
* - `version`: `"latest"`
|
|
347
348
|
* - `use_market_value`: `false`
|
|
348
349
|
*/
|
|
349
|
-
optionSnapshotGreeksThirdOrder(symbol: string, expiration: string | Date, strike?: string | undefined | null, right?: string | undefined | null, annualDividend?: number | undefined | null, rateType?: string | undefined | null, rateValue?: number | undefined | null, stockPrice?: number | undefined | null, version?: string | undefined | null, maxDte?: number | undefined | null, strikeRange?: number | undefined | null, minTime?: string | Date | undefined | null, useMarketValue?: boolean | undefined | null, timeoutMs?: number | undefined | null): Array<
|
|
350
|
+
optionSnapshotGreeksThirdOrder(symbol: string, expiration: string | Date, strike?: string | undefined | null, right?: string | undefined | null, annualDividend?: number | undefined | null, rateType?: string | undefined | null, rateValue?: number | undefined | null, stockPrice?: number | undefined | null, version?: string | undefined | null, maxDte?: number | undefined | null, strikeRange?: number | undefined | null, minTime?: string | Date | undefined | null, useMarketValue?: boolean | undefined | null, timeoutMs?: number | undefined | null): Array<GreeksThirdOrderTick>
|
|
350
351
|
/**
|
|
351
352
|
* Fetch end-of-day option data for a contract over a date range.
|
|
352
353
|
*
|
|
@@ -447,7 +448,7 @@ export declare class ThetaDataDx {
|
|
|
447
448
|
* - `version`: `"latest"`
|
|
448
449
|
* - `underlyer_use_nbbo`: `false`
|
|
449
450
|
*/
|
|
450
|
-
optionHistoryGreeksEOD(symbol: string, expiration: string | Date, startDate: string | Date, endDate: string | Date, strike?: string | undefined | null, right?: string | undefined | null, annualDividend?: number | undefined | null, rateType?: string | undefined | null, rateValue?: number | undefined | null, version?: string | undefined | null, underlyerUseNbbo?: boolean | undefined | null, maxDte?: number | undefined | null, strikeRange?: number | undefined | null, timeoutMs?: number | undefined | null): Array<
|
|
451
|
+
optionHistoryGreeksEOD(symbol: string, expiration: string | Date, startDate: string | Date, endDate: string | Date, strike?: string | undefined | null, right?: string | undefined | null, annualDividend?: number | undefined | null, rateType?: string | undefined | null, rateValue?: number | undefined | null, version?: string | undefined | null, underlyerUseNbbo?: boolean | undefined | null, maxDte?: number | undefined | null, strikeRange?: number | undefined | null, timeoutMs?: number | undefined | null): Array<GreeksAllTick>
|
|
451
452
|
/**
|
|
452
453
|
* Fetch all Greeks history for an option contract (intraday, sampled by interval).
|
|
453
454
|
*
|
|
@@ -465,7 +466,7 @@ export declare class ThetaDataDx {
|
|
|
465
466
|
* - `rate_type`: `"sofr"`
|
|
466
467
|
* - `version`: `"latest"`
|
|
467
468
|
*/
|
|
468
|
-
optionHistoryGreeksAll(symbol: string, expiration: string | Date, date: string | Date, strike?: string | undefined | null, right?: string | undefined | null, interval?: string | undefined | null, startTime?: string | Date | undefined | null, endTime?: string | Date | undefined | null, annualDividend?: number | undefined | null, rateType?: string | undefined | null, rateValue?: number | undefined | null, version?: string | undefined | null, strikeRange?: number | undefined | null, startDate?: string | Date | undefined | null, endDate?: string | Date | undefined | null, timeoutMs?: number | undefined | null): Array<
|
|
469
|
+
optionHistoryGreeksAll(symbol: string, expiration: string | Date, date: string | Date, strike?: string | undefined | null, right?: string | undefined | null, interval?: string | undefined | null, startTime?: string | Date | undefined | null, endTime?: string | Date | undefined | null, annualDividend?: number | undefined | null, rateType?: string | undefined | null, rateValue?: number | undefined | null, version?: string | undefined | null, strikeRange?: number | undefined | null, startDate?: string | Date | undefined | null, endDate?: string | Date | undefined | null, timeoutMs?: number | undefined | null): Array<GreeksAllTick>
|
|
469
470
|
/**
|
|
470
471
|
* Fetch all Greeks on each trade for an option contract.
|
|
471
472
|
*
|
|
@@ -482,7 +483,7 @@ export declare class ThetaDataDx {
|
|
|
482
483
|
* - `rate_type`: `"sofr"`
|
|
483
484
|
* - `version`: `"latest"`
|
|
484
485
|
*/
|
|
485
|
-
optionHistoryTradeGreeksAll(symbol: string, expiration: string | Date, date: string | Date, strike?: string | undefined | null, right?: string | undefined | null, startTime?: string | Date | undefined | null, endTime?: string | Date | undefined | null, annualDividend?: number | undefined | null, rateType?: string | undefined | null, rateValue?: number | undefined | null, version?: string | undefined | null, maxDte?: number | undefined | null, strikeRange?: number | undefined | null, startDate?: string | Date | undefined | null, endDate?: string | Date | undefined | null, timeoutMs?: number | undefined | null): Array<
|
|
486
|
+
optionHistoryTradeGreeksAll(symbol: string, expiration: string | Date, date: string | Date, strike?: string | undefined | null, right?: string | undefined | null, startTime?: string | Date | undefined | null, endTime?: string | Date | undefined | null, annualDividend?: number | undefined | null, rateType?: string | undefined | null, rateValue?: number | undefined | null, version?: string | undefined | null, maxDte?: number | undefined | null, strikeRange?: number | undefined | null, startDate?: string | Date | undefined | null, endDate?: string | Date | undefined | null, timeoutMs?: number | undefined | null): Array<GreeksAllTick>
|
|
486
487
|
/**
|
|
487
488
|
* Fetch first-order Greeks history (intraday, sampled by interval).
|
|
488
489
|
*
|
|
@@ -500,7 +501,7 @@ export declare class ThetaDataDx {
|
|
|
500
501
|
* - `rate_type`: `"sofr"`
|
|
501
502
|
* - `version`: `"latest"`
|
|
502
503
|
*/
|
|
503
|
-
optionHistoryGreeksFirstOrder(symbol: string, expiration: string | Date, date: string | Date, strike?: string | undefined | null, right?: string | undefined | null, interval?: string | undefined | null, startTime?: string | Date | undefined | null, endTime?: string | Date | undefined | null, annualDividend?: number | undefined | null, rateType?: string | undefined | null, rateValue?: number | undefined | null, version?: string | undefined | null, strikeRange?: number | undefined | null, startDate?: string | Date | undefined | null, endDate?: string | Date | undefined | null, timeoutMs?: number | undefined | null): Array<
|
|
504
|
+
optionHistoryGreeksFirstOrder(symbol: string, expiration: string | Date, date: string | Date, strike?: string | undefined | null, right?: string | undefined | null, interval?: string | undefined | null, startTime?: string | Date | undefined | null, endTime?: string | Date | undefined | null, annualDividend?: number | undefined | null, rateType?: string | undefined | null, rateValue?: number | undefined | null, version?: string | undefined | null, strikeRange?: number | undefined | null, startDate?: string | Date | undefined | null, endDate?: string | Date | undefined | null, timeoutMs?: number | undefined | null): Array<GreeksFirstOrderTick>
|
|
504
505
|
/**
|
|
505
506
|
* Fetch first-order Greeks on each trade for an option contract.
|
|
506
507
|
*
|
|
@@ -517,7 +518,7 @@ export declare class ThetaDataDx {
|
|
|
517
518
|
* - `rate_type`: `"sofr"`
|
|
518
519
|
* - `version`: `"latest"`
|
|
519
520
|
*/
|
|
520
|
-
optionHistoryTradeGreeksFirstOrder(symbol: string, expiration: string | Date, date: string | Date, strike?: string | undefined | null, right?: string | undefined | null, startTime?: string | Date | undefined | null, endTime?: string | Date | undefined | null, annualDividend?: number | undefined | null, rateType?: string | undefined | null, rateValue?: number | undefined | null, version?: string | undefined | null, maxDte?: number | undefined | null, strikeRange?: number | undefined | null, startDate?: string | Date | undefined | null, endDate?: string | Date | undefined | null, timeoutMs?: number | undefined | null): Array<
|
|
521
|
+
optionHistoryTradeGreeksFirstOrder(symbol: string, expiration: string | Date, date: string | Date, strike?: string | undefined | null, right?: string | undefined | null, startTime?: string | Date | undefined | null, endTime?: string | Date | undefined | null, annualDividend?: number | undefined | null, rateType?: string | undefined | null, rateValue?: number | undefined | null, version?: string | undefined | null, maxDte?: number | undefined | null, strikeRange?: number | undefined | null, startDate?: string | Date | undefined | null, endDate?: string | Date | undefined | null, timeoutMs?: number | undefined | null): Array<GreeksFirstOrderTick>
|
|
521
522
|
/**
|
|
522
523
|
* Fetch second-order Greeks history (intraday, sampled by interval).
|
|
523
524
|
*
|
|
@@ -535,7 +536,7 @@ export declare class ThetaDataDx {
|
|
|
535
536
|
* - `rate_type`: `"sofr"`
|
|
536
537
|
* - `version`: `"latest"`
|
|
537
538
|
*/
|
|
538
|
-
optionHistoryGreeksSecondOrder(symbol: string, expiration: string | Date, date: string | Date, strike?: string | undefined | null, right?: string | undefined | null, interval?: string | undefined | null, startTime?: string | Date | undefined | null, endTime?: string | Date | undefined | null, annualDividend?: number | undefined | null, rateType?: string | undefined | null, rateValue?: number | undefined | null, version?: string | undefined | null, strikeRange?: number | undefined | null, startDate?: string | Date | undefined | null, endDate?: string | Date | undefined | null, timeoutMs?: number | undefined | null): Array<
|
|
539
|
+
optionHistoryGreeksSecondOrder(symbol: string, expiration: string | Date, date: string | Date, strike?: string | undefined | null, right?: string | undefined | null, interval?: string | undefined | null, startTime?: string | Date | undefined | null, endTime?: string | Date | undefined | null, annualDividend?: number | undefined | null, rateType?: string | undefined | null, rateValue?: number | undefined | null, version?: string | undefined | null, strikeRange?: number | undefined | null, startDate?: string | Date | undefined | null, endDate?: string | Date | undefined | null, timeoutMs?: number | undefined | null): Array<GreeksSecondOrderTick>
|
|
539
540
|
/**
|
|
540
541
|
* Fetch second-order Greeks on each trade for an option contract.
|
|
541
542
|
*
|
|
@@ -552,7 +553,7 @@ export declare class ThetaDataDx {
|
|
|
552
553
|
* - `rate_type`: `"sofr"`
|
|
553
554
|
* - `version`: `"latest"`
|
|
554
555
|
*/
|
|
555
|
-
optionHistoryTradeGreeksSecondOrder(symbol: string, expiration: string | Date, date: string | Date, strike?: string | undefined | null, right?: string | undefined | null, startTime?: string | Date | undefined | null, endTime?: string | Date | undefined | null, annualDividend?: number | undefined | null, rateType?: string | undefined | null, rateValue?: number | undefined | null, version?: string | undefined | null, maxDte?: number | undefined | null, strikeRange?: number | undefined | null, startDate?: string | Date | undefined | null, endDate?: string | Date | undefined | null, timeoutMs?: number | undefined | null): Array<
|
|
556
|
+
optionHistoryTradeGreeksSecondOrder(symbol: string, expiration: string | Date, date: string | Date, strike?: string | undefined | null, right?: string | undefined | null, startTime?: string | Date | undefined | null, endTime?: string | Date | undefined | null, annualDividend?: number | undefined | null, rateType?: string | undefined | null, rateValue?: number | undefined | null, version?: string | undefined | null, maxDte?: number | undefined | null, strikeRange?: number | undefined | null, startDate?: string | Date | undefined | null, endDate?: string | Date | undefined | null, timeoutMs?: number | undefined | null): Array<GreeksSecondOrderTick>
|
|
556
557
|
/**
|
|
557
558
|
* Fetch third-order Greeks history (intraday, sampled by interval).
|
|
558
559
|
*
|
|
@@ -570,7 +571,7 @@ export declare class ThetaDataDx {
|
|
|
570
571
|
* - `rate_type`: `"sofr"`
|
|
571
572
|
* - `version`: `"latest"`
|
|
572
573
|
*/
|
|
573
|
-
optionHistoryGreeksThirdOrder(symbol: string, expiration: string | Date, date: string | Date, strike?: string | undefined | null, right?: string | undefined | null, interval?: string | undefined | null, startTime?: string | Date | undefined | null, endTime?: string | Date | undefined | null, annualDividend?: number | undefined | null, rateType?: string | undefined | null, rateValue?: number | undefined | null, version?: string | undefined | null, strikeRange?: number | undefined | null, startDate?: string | Date | undefined | null, endDate?: string | Date | undefined | null, timeoutMs?: number | undefined | null): Array<
|
|
574
|
+
optionHistoryGreeksThirdOrder(symbol: string, expiration: string | Date, date: string | Date, strike?: string | undefined | null, right?: string | undefined | null, interval?: string | undefined | null, startTime?: string | Date | undefined | null, endTime?: string | Date | undefined | null, annualDividend?: number | undefined | null, rateType?: string | undefined | null, rateValue?: number | undefined | null, version?: string | undefined | null, strikeRange?: number | undefined | null, startDate?: string | Date | undefined | null, endDate?: string | Date | undefined | null, timeoutMs?: number | undefined | null): Array<GreeksThirdOrderTick>
|
|
574
575
|
/**
|
|
575
576
|
* Fetch third-order Greeks on each trade for an option contract.
|
|
576
577
|
*
|
|
@@ -587,7 +588,7 @@ export declare class ThetaDataDx {
|
|
|
587
588
|
* - `rate_type`: `"sofr"`
|
|
588
589
|
* - `version`: `"latest"`
|
|
589
590
|
*/
|
|
590
|
-
optionHistoryTradeGreeksThirdOrder(symbol: string, expiration: string | Date, date: string | Date, strike?: string | undefined | null, right?: string | undefined | null, startTime?: string | Date | undefined | null, endTime?: string | Date | undefined | null, annualDividend?: number | undefined | null, rateType?: string | undefined | null, rateValue?: number | undefined | null, version?: string | undefined | null, maxDte?: number | undefined | null, strikeRange?: number | undefined | null, startDate?: string | Date | undefined | null, endDate?: string | Date | undefined | null, timeoutMs?: number | undefined | null): Array<
|
|
591
|
+
optionHistoryTradeGreeksThirdOrder(symbol: string, expiration: string | Date, date: string | Date, strike?: string | undefined | null, right?: string | undefined | null, startTime?: string | Date | undefined | null, endTime?: string | Date | undefined | null, annualDividend?: number | undefined | null, rateType?: string | undefined | null, rateValue?: number | undefined | null, version?: string | undefined | null, maxDte?: number | undefined | null, strikeRange?: number | undefined | null, startDate?: string | Date | undefined | null, endDate?: string | Date | undefined | null, timeoutMs?: number | undefined | null): Array<GreeksThirdOrderTick>
|
|
591
592
|
/**
|
|
592
593
|
* Fetch implied volatility history (intraday, sampled by interval).
|
|
593
594
|
*
|
|
@@ -760,8 +761,27 @@ export declare class ThetaDataDx {
|
|
|
760
761
|
* - `venue`: `"nqb"`
|
|
761
762
|
*/
|
|
762
763
|
stockHistoryOHLCRange(symbol: string, startDate: string | Date, endDate: string | Date, interval?: string | undefined | null, startTime?: string | Date | undefined | null, endTime?: string | Date | undefined | null, venue?: string | undefined | null, timeoutMs?: number | undefined | null): Array<OhlcTick>
|
|
763
|
-
/**
|
|
764
|
-
|
|
764
|
+
/**
|
|
765
|
+
* Start FPSS streaming and register a JS callback for incoming events.
|
|
766
|
+
*
|
|
767
|
+
* The dispatcher's drain thread routes every typed FPSS event through
|
|
768
|
+
* napi-rs `ThreadsafeFunction` to the Node main thread, where the user's
|
|
769
|
+
* `callback(event)` runs. The FPSS reader thread itself never touches V8:
|
|
770
|
+
* events cross the bounded `crossbeam_channel(8192)` queue inside the
|
|
771
|
+
* SSOT `StreamingDispatcher` first.
|
|
772
|
+
*
|
|
773
|
+
* Node's libuv requires JS callbacks on the main thread, so
|
|
774
|
+
* `ThreadsafeFunction` (with its internal `uv_async_t` queue) is the only
|
|
775
|
+
* safe path. This binding deliberately does NOT expose a
|
|
776
|
+
* `start_streaming_inline` opt-in: calling into V8 from any thread other
|
|
777
|
+
* than the main loop is undefined behavior.
|
|
778
|
+
*
|
|
779
|
+
* Backpressure: a slow callback fills the dispatcher queue and overflow
|
|
780
|
+
* events are dropped, observable via `droppedEventCount()`. The FPSS TLS
|
|
781
|
+
* reader is never blocked — vendor disconnects on slow consumers cannot
|
|
782
|
+
* happen on this path.
|
|
783
|
+
*/
|
|
784
|
+
startStreaming(callback: (event: FpssEvent) => void): void
|
|
765
785
|
/** Whether the streaming connection is active. */
|
|
766
786
|
isStreaming(): boolean
|
|
767
787
|
/** Subscribe to real-time quote data for a stock symbol. */
|
|
@@ -802,9 +822,14 @@ export declare class ThetaDataDx {
|
|
|
802
822
|
contractLookup(id: number): string | null
|
|
803
823
|
/** Get a snapshot of currently active subscriptions. */
|
|
804
824
|
activeSubscriptions(): any
|
|
805
|
-
/**
|
|
806
|
-
|
|
807
|
-
|
|
825
|
+
/**
|
|
826
|
+
* Reconnect FPSS streaming and re-register the previously installed callback.
|
|
827
|
+
*
|
|
828
|
+
* Requires a prior `startStreaming(callback)`; throws if no callback is
|
|
829
|
+
* registered. All active subscriptions are restored on the new connection
|
|
830
|
+
* — see `thetadatadx::ThetaDataDx::reconnect_streaming` for partial-failure
|
|
831
|
+
* semantics.
|
|
832
|
+
*/
|
|
808
833
|
reconnect(): void
|
|
809
834
|
/** Stop streaming while keeping the historical client usable. */
|
|
810
835
|
stopStreaming(): void
|
|
@@ -826,9 +851,9 @@ export interface CalendarDay {
|
|
|
826
851
|
* event as `event.quote.contract` / `event.trade.contract` / etc.
|
|
827
852
|
*/
|
|
828
853
|
export interface Contract {
|
|
829
|
-
|
|
854
|
+
symbol: string
|
|
830
855
|
secType: number
|
|
831
|
-
|
|
856
|
+
expiration?: number
|
|
832
857
|
isCall?: boolean
|
|
833
858
|
strike?: number
|
|
834
859
|
}
|
|
@@ -901,9 +926,11 @@ export interface FpssSimplePayload {
|
|
|
901
926
|
id?: number
|
|
902
927
|
}
|
|
903
928
|
|
|
904
|
-
/** Greeks tick
|
|
905
|
-
export interface
|
|
929
|
+
/** Full-union Greeks tick (option_*_greeks_all, option_*_greeks_eod). */
|
|
930
|
+
export interface GreeksAllTick {
|
|
906
931
|
msOfDay: number
|
|
932
|
+
bid: number
|
|
933
|
+
ask: number
|
|
907
934
|
impliedVolatility: number
|
|
908
935
|
delta: number
|
|
909
936
|
gamma: number
|
|
@@ -926,6 +953,68 @@ export interface GreeksTick {
|
|
|
926
953
|
epsilon: number
|
|
927
954
|
lambda: number
|
|
928
955
|
vera: number
|
|
956
|
+
underlyingMsOfDay: number
|
|
957
|
+
underlyingPrice: number
|
|
958
|
+
date: number
|
|
959
|
+
expiration: number
|
|
960
|
+
strike: number
|
|
961
|
+
right: string
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
/** First-order Greeks subset tick (option_*_greeks_first_order). */
|
|
965
|
+
export interface GreeksFirstOrderTick {
|
|
966
|
+
msOfDay: number
|
|
967
|
+
bid: number
|
|
968
|
+
ask: number
|
|
969
|
+
delta: number
|
|
970
|
+
theta: number
|
|
971
|
+
vega: number
|
|
972
|
+
rho: number
|
|
973
|
+
epsilon: number
|
|
974
|
+
lambda: number
|
|
975
|
+
impliedVolatility: number
|
|
976
|
+
ivError: number
|
|
977
|
+
underlyingMsOfDay: number
|
|
978
|
+
underlyingPrice: number
|
|
979
|
+
date: number
|
|
980
|
+
expiration: number
|
|
981
|
+
strike: number
|
|
982
|
+
right: string
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
/** Second-order Greeks subset tick (option_*_greeks_second_order). */
|
|
986
|
+
export interface GreeksSecondOrderTick {
|
|
987
|
+
msOfDay: number
|
|
988
|
+
bid: number
|
|
989
|
+
ask: number
|
|
990
|
+
gamma: number
|
|
991
|
+
vanna: number
|
|
992
|
+
charm: number
|
|
993
|
+
vomma: number
|
|
994
|
+
veta: number
|
|
995
|
+
impliedVolatility: number
|
|
996
|
+
ivError: number
|
|
997
|
+
underlyingMsOfDay: number
|
|
998
|
+
underlyingPrice: number
|
|
999
|
+
date: number
|
|
1000
|
+
expiration: number
|
|
1001
|
+
strike: number
|
|
1002
|
+
right: string
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
/** Third-order Greeks subset tick (option_*_greeks_third_order). */
|
|
1006
|
+
export interface GreeksThirdOrderTick {
|
|
1007
|
+
msOfDay: number
|
|
1008
|
+
bid: number
|
|
1009
|
+
ask: number
|
|
1010
|
+
speed: number
|
|
1011
|
+
zomma: number
|
|
1012
|
+
color: number
|
|
1013
|
+
ultima: number
|
|
1014
|
+
impliedVolatility: number
|
|
1015
|
+
ivError: number
|
|
1016
|
+
underlyingMsOfDay: number
|
|
1017
|
+
underlyingPrice: number
|
|
929
1018
|
date: number
|
|
930
1019
|
expiration: number
|
|
931
1020
|
strike: number
|
|
@@ -1032,7 +1121,7 @@ export interface OpenInterestTick {
|
|
|
1032
1121
|
|
|
1033
1122
|
/** Option contract. Contract specification. */
|
|
1034
1123
|
export interface OptionContract {
|
|
1035
|
-
|
|
1124
|
+
symbol: string
|
|
1036
1125
|
expiration: number
|
|
1037
1126
|
strike: number
|
|
1038
1127
|
right: string
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "thetadatadx",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.30",
|
|
4
4
|
"description": "Native ThetaData SDK for Node.js — powered by Rust via napi-rs",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"@napi-rs/cli": "^3.6.2"
|
|
31
31
|
},
|
|
32
32
|
"optionalDependencies": {
|
|
33
|
-
"thetadatadx-linux-x64-gnu": "8.0.
|
|
34
|
-
"thetadatadx-darwin-arm64": "8.0.
|
|
35
|
-
"thetadatadx-win32-x64-msvc": "8.0.
|
|
33
|
+
"thetadatadx-linux-x64-gnu": "8.0.30",
|
|
34
|
+
"thetadatadx-darwin-arm64": "8.0.30",
|
|
35
|
+
"thetadatadx-win32-x64-msvc": "8.0.30"
|
|
36
36
|
},
|
|
37
37
|
"engines": {
|
|
38
38
|
"node": ">= 20"
|