@xbbg/core 1.2.2 → 1.2.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 CHANGED
@@ -46,8 +46,8 @@ cargo build -p napi-xbbg
46
46
  # Stage the current platform package template with the built addon
47
47
  npm --prefix js-xbbg run stage:native-package
48
48
 
49
- # Run JS smoke test from js-xbbg/
50
- npm test
49
+ # Run package smoke tests from js-xbbg/
50
+ npm run test:smoke
51
51
  ```
52
52
 
53
53
  The JS package automatically loads a local `js-xbbg/napi_xbbg.node` addon first, then falls back to packaged optional native dependencies for supported platforms.
@@ -78,7 +78,7 @@ Pass `{ allFields: true }` to `stream()` / `subscribe()` / service stream helper
78
78
 
79
79
  ### Subscription replay benchmark
80
80
 
81
- `npm run bench:subscription-replay` is a JS-only benchmark for one-update-at-a-time subscription processing. It does not change the production streaming API and does not batch updates by default. Use `--path legacy` for the original encode+decode measurement, `--path arrow-decode-only` to exclude benchmark-only IPC encoding from timed results, and `--path subscription-wrapper` to time the current JS `Subscription.next()` wrapper with fake native zero-copy descriptors. `--consume rows|vector|schema|none` controls how much decoded output is touched; `rows` remains the default for continuity with prior results. Use `--warmup-iterations N` for untimed replay warmup. Live capture exercises the default native subscription path and prints `sub.stats` telemetry; unsupported-schema diagnostics are surfaced when the native stream returns a schema the zero-copy bridge cannot describe.
81
+ `npm run bench:subscription-replay` is a TypeScript benchmark script for one-update-at-a-time subscription processing. It does not change the production streaming API and does not batch updates by default. Use `--path legacy` for the original encode+decode measurement, `--path arrow-decode-only` to exclude benchmark-only IPC encoding from timed results, and `--path subscription-wrapper` to time the current JS `Subscription.next()` wrapper with fake native zero-copy descriptors. `--consume rows|vector|schema|none` controls how much decoded output is touched; `rows` remains the default for continuity with prior results. Use `--warmup-iterations N` for untimed replay warmup. Live capture exercises the default native subscription path and prints `sub.stats` telemetry; unsupported-schema diagnostics are surfaced when the native stream returns a schema the zero-copy bridge cannot describe.
82
82
 
83
83
  ```bash
84
84
  # Synthetic one-update replay, no Bloomberg connection needed; row materialization is the default
@@ -137,7 +137,11 @@ const hist = await xbbg.blp.abdh(['AAPL US Equity'], ['PX_LAST'], '2024-01-01',
137
137
  const ref = await xbbg.blp.abdp(['AAPL US Equity'], ['PX_LAST', 'SECURITY_NAME']);
138
138
  const bulk = await xbbg.blp.abds(['ES1 Index'], ['FUT_CHAIN_LAST_TRADE_DATES']);
139
139
  const bars = await xbbg.blp.abdib('AAPL US Equity', '2024-12-01', 5);
140
- const ticks = await xbbg.blp.abdtick('AAPL US Equity', '2024-12-01T09:30:00', '2024-12-01T10:00:00');
140
+ const ticks = await xbbg.blp.abdtick(
141
+ 'AAPL US Equity',
142
+ '2024-12-01T09:30:00',
143
+ '2024-12-01T10:00:00',
144
+ );
141
145
 
142
146
  // Live streaming
143
147
  const sub = await xbbg.blp.asubscribe(['AAPL US Equity'], ['LAST_PRICE', 'BID', 'ASK']);
@@ -185,6 +189,7 @@ const corpBonds = await engine.corporateBonds('AAPL', { ccy: 'USD' });
185
189
  // Futures and CDX resolution
186
190
  const front = await engine.futTicker('ES1 Index', '20240301');
187
191
  const active = await engine.activeFutures('CL1 Comdty', '20240301', { freq: 'M' });
192
+ const curve = await engine.futuresCurve('ES1 Index', { maxContracts: 6 });
188
193
  const cdx = await engine.cdxTicker('CDX IG CDSI GEN 5Y Corp', '20240301');
189
194
  const activeCdx = await engine.activeCdx('CDX IG CDSI GEN 5Y Corp', '20240301', {
190
195
  lookbackDays: 10,
@@ -196,6 +201,17 @@ const turn = await engine.turnover(['AAPL US Equity'], '20240101', '20240131', {
196
201
  ccy: 'USD',
197
202
  });
198
203
  const holdings = await engine.etfHoldings('SPY US Equity');
204
+ const realizedYield = await engine.dividendYield('AAPL US Equity', '20230101', '20231231', {
205
+ dividendTypes: ['Regular Cash'],
206
+ });
207
+ const members = await engine.indexMembers('SPX Index', { field: 'INDX_MWEIGHT', asof: '20240102' });
208
+ const surface = await engine.volSurface('SPX Index', '20240102', '20240105', {
209
+ preset: 'MONEYNESS_30D',
210
+ includeDerived: true,
211
+ riskFreeRate: 0.05,
212
+ });
213
+ const resolved = await engine.resolveIsins(['US0378331005', 'INVALIDISIN000']);
214
+ const issuers = await engine.issuerIsins(['US037833FB15', 'INVALIDISIN000']);
199
215
 
200
216
  // Currency-converted prices
201
217
  const px = await engine.currencyConversion('700 HK Equity', 'USD', '20240101', '20240131');
package/dist/index.d.ts CHANGED
@@ -319,6 +319,13 @@ interface FuturesResolveOptions {
319
319
  freq?: string;
320
320
  backend?: BackendKind;
321
321
  }
322
+ interface FuturesCurveOptions {
323
+ asof?: DateLike;
324
+ chainField?: string;
325
+ fields?: readonly string[];
326
+ maxContracts?: number;
327
+ backend?: BackendKind;
328
+ }
322
329
  interface ActiveCdxOptions {
323
330
  lookbackDays?: number;
324
331
  backend?: BackendKind;
@@ -327,6 +334,11 @@ interface DividendOptions {
327
334
  dvdType?: string;
328
335
  backend?: BackendKind;
329
336
  }
337
+ interface DividendYieldOptions {
338
+ dividendTypes?: readonly string[];
339
+ windowDays?: number;
340
+ backend?: BackendKind;
341
+ }
330
342
  interface TurnoverOptions {
331
343
  ccy?: string;
332
344
  factor?: number;
@@ -336,6 +348,27 @@ interface EtfHoldingsOptions {
336
348
  fields?: readonly string[];
337
349
  backend?: BackendKind;
338
350
  }
351
+ type VolSurfacePreset = 'DELTA_1M_2M' | 'MONEYNESS_30D' | 'MONEYNESS_60D' | 'MONEYNESS_3M' | 'MONEYNESS_6M' | 'MONEYNESS_12M';
352
+ interface VolFieldSpec {
353
+ metric?: string;
354
+ tenor?: string;
355
+ pointType?: string;
356
+ point?: number;
357
+ }
358
+ interface VolSurfaceOptions {
359
+ preset?: VolSurfacePreset | readonly VolSurfacePreset[] | null;
360
+ fields?: readonly string[] | Record<string, VolFieldSpec>;
361
+ asDecimal?: boolean;
362
+ includeDerived?: boolean;
363
+ riskFreeRate?: number;
364
+ dividendYieldField?: string;
365
+ backend?: BackendKind;
366
+ }
367
+ interface IndexMembersOptions {
368
+ field?: 'INDX_MWEIGHT' | 'INDX_MEMBERS' | 'INDX_MEMBERS3';
369
+ asof?: DateLike;
370
+ backend?: BackendKind;
371
+ }
339
372
  interface RecipeBackendOptions {
340
373
  backend?: BackendKind;
341
374
  }
@@ -509,9 +542,9 @@ declare class FieldHandle {
509
542
  constructor(name: string);
510
543
  }
511
544
  declare class Tick {
512
- private readonly _update;
513
- private readonly _positions;
514
- constructor(_update: NativeSubscriptionUpdate);
545
+ private readonly update;
546
+ private readonly positions;
547
+ constructor(update: NativeSubscriptionUpdate);
515
548
  get topic(): string;
516
549
  get timestampUs(): number;
517
550
  get layoutVersion(): number;
@@ -522,14 +555,14 @@ declare class Tick {
522
555
  toObject(): Record<string, unknown>;
523
556
  }
524
557
  declare class ArrowSubscription implements AsyncIterator<Table>, AsyncIterable<Table> {
525
- private readonly _inner;
526
- constructor(_inner: NativeSubscription);
558
+ private readonly inner;
559
+ constructor(inner: NativeSubscription);
527
560
  next(): Promise<IteratorResult<Table>>;
528
561
  unsubscribe(drain?: boolean): Promise<Table[]>;
529
562
  [Symbol.asyncIterator](): this;
530
563
  }
531
564
  declare class Subscription implements AsyncIterator<Tick>, AsyncIterable<Tick> {
532
- private readonly _inner;
565
+ private readonly inner;
533
566
  constructor(inner: NativeSubscription);
534
567
  next(): Promise<IteratorResult<Tick>>;
535
568
  add(tickers: readonly string[]): Promise<void>;
@@ -544,7 +577,7 @@ declare class Subscription implements AsyncIterator<Tick>, AsyncIterable<Tick> {
544
577
  [Symbol.asyncIterator](): this;
545
578
  }
546
579
  declare class Engine {
547
- private _inner;
580
+ private inner;
548
581
  constructor(host?: string, port?: number);
549
582
  static withConfig(config?: EngineConfig): Engine;
550
583
  request(params: RequestInput): Promise<unknown>;
@@ -597,11 +630,17 @@ declare class Engine {
597
630
  corporateBonds(ticker: string, options?: CorporateBondsOptions): Promise<unknown>;
598
631
  futTicker(genTicker: string, dt: DateLike, options?: FuturesResolveOptions): Promise<unknown>;
599
632
  activeFutures(genTicker: string, dt: DateLike, options?: FuturesResolveOptions): Promise<unknown>;
633
+ futuresCurve(genTicker: string, options?: FuturesCurveOptions): Promise<unknown>;
600
634
  cdxTicker(genTicker: string, dt: DateLike, options?: RecipeBackendOptions): Promise<unknown>;
601
635
  activeCdx(genTicker: string, dt: DateLike, options?: ActiveCdxOptions): Promise<unknown>;
602
636
  dividend(tickers: string | readonly string[], startDate: DateLike, endDate: DateLike, options?: DividendOptions): Promise<unknown>;
637
+ dividendYield(tickers: string | readonly string[], startDate: DateLike, endDate: DateLike, options?: DividendYieldOptions): Promise<unknown>;
603
638
  turnover(tickers: string | readonly string[], startDate: DateLike, endDate: DateLike, options?: TurnoverOptions): Promise<unknown>;
604
639
  etfHoldings(etfTicker: string, options?: EtfHoldingsOptions): Promise<unknown>;
640
+ volSurface(tickers: string | readonly string[], startDate: DateLike, endDate: DateLike, options?: VolSurfaceOptions): Promise<unknown>;
641
+ indexMembers(index: string, options?: IndexMembersOptions): Promise<unknown>;
642
+ resolveIsins(isins: string | readonly string[], options?: RecipeBackendOptions): Promise<unknown>;
643
+ issuerIsins(bondIsins: string | readonly string[], options?: RecipeBackendOptions): Promise<unknown>;
605
644
  currencyConversion(ticker: string, targetCcy: string, startDate: DateLike, endDate: DateLike, options?: RecipeBackendOptions): Promise<unknown>;
606
645
  }
607
646
  declare function connect(config?: EngineConfig): Promise<Engine>;
@@ -623,73 +662,73 @@ declare function acdxInfo(ticker: string, options?: BdpOptions): Promise<unknown
623
662
  declare function acdxPricing(ticker: string, options?: CdxOptions): Promise<unknown>;
624
663
  declare function acdxRisk(ticker: string, options?: CdxOptions): Promise<unknown>;
625
664
  declare const blp: Readonly<{
626
- bdp: typeof bdp;
627
- bdh: typeof bdh;
628
- bds: typeof bds;
629
- bdib: typeof bdib;
630
- bdtick: typeof bdtick;
631
- subscribe: typeof subscribe;
632
- abdp: typeof abdp;
633
665
  abdh: typeof abdh;
634
- abds: typeof abds;
635
666
  abdib: typeof abdib;
667
+ abdp: typeof abdp;
668
+ abds: typeof abds;
636
669
  abdtick: typeof abdtick;
637
670
  asubscribe: typeof asubscribe;
671
+ bdh: typeof bdh;
672
+ bdib: typeof bdib;
673
+ bdp: typeof bdp;
674
+ bds: typeof bds;
675
+ bdtick: typeof bdtick;
676
+ subscribe: typeof subscribe;
638
677
  }>;
639
678
  declare const ext: Readonly<{
679
+ buildCorporateBondsQuery: (ticker: string, ccy?: string, extraFields?: readonly string[], activeOnly?: boolean) => string;
680
+ buildEarningHeaderRename: (headerRow: readonly StringPair[], dataColumns: readonly string[]) => StringPair[];
681
+ buildEtfHoldingsQuery: (etfTicker: string, extraFields?: readonly string[]) => string;
682
+ buildFuturesTicker: (prefix: string, monthCode: string, year: string, asset: string) => string;
683
+ buildFxPair: (fromCcy: string, toCcy: string) => FxPairInfo;
684
+ buildPreferredsQuery: (equityTicker: string, extraFields?: readonly string[]) => string;
685
+ buildYasOverrides: (settleDt?: string, yieldType?: number, spread?: number, yieldVal?: number, price?: number, benchmark?: string) => StringPair[];
686
+ calculateLevelPercentages: (values: readonly (number | null)[], levels: readonly (number | null)[]) => (number | null)[];
640
687
  cdx: Readonly<{
641
688
  acdx_info: typeof acdxInfo;
642
689
  acdx_pricing: typeof acdxPricing;
643
690
  acdx_risk: typeof acdxRisk;
644
691
  }>;
645
- parseDate: (dateStr: string) => number[];
646
- fmtDate: (year: number, month: number, day: number, fmt?: string) => string;
647
- pivotToWide: (ipcBuffer: Buffer) => Buffer;
648
- isLongFormat: (ipcBuffer: Buffer) => boolean;
649
- parseTicker: (ticker: string) => TickerParts;
650
- isSpecificContract: (ticker: string) => boolean;
651
- buildFuturesTicker: (prefix: string, monthCode: string, year: string, asset: string) => string;
652
- normalizeTickers: (tickers: readonly string[]) => string[];
653
- filterEquityTickers: (tickers: readonly string[]) => string[];
654
- generateFuturesCandidates: (genTicker: string, year: number, month: number, day: number, freq?: string, count?: number) => FuturesCandidate[];
655
- validateGenericTicker: (ticker: string) => void;
692
+ cdxGenToSpecific: (genTicker: string, series: number) => string;
693
+ clearExchangeOverride: (ticker?: string) => void;
656
694
  contractIndex: (genTicker: string) => number;
695
+ currenciesNeedingConversion: (currencies: readonly string[], target: string) => string[];
696
+ defaultBqrDatetimes: (startDatetime?: string, endDatetime?: string) => TimeRange;
697
+ defaultTurnoverDates: (startDate?: string, endDate?: string) => TimeRange;
698
+ deriveSessions: (dayStart: string, dayEnd: string, mic?: string, exchCode?: string) => SessionWindowsInfo;
657
699
  filterCandidatesByCycle: (candidates: readonly FuturesCandidate[], cycle: string) => FuturesCandidate[];
700
+ filterEquityTickers: (tickers: readonly string[]) => string[];
658
701
  filterValidContracts: (contracts: readonly StringPair[], year: number, month: number, day: number) => string[];
659
- parseCdxTicker: (ticker: string) => CdxTickerInfo;
660
- previousCdxSeries: (ticker: string) => string | null;
661
- cdxGenToSpecific: (genTicker: string, series: number) => string;
662
- buildFxPair: (fromCcy: string, toCcy: string) => FxPairInfo;
663
- sameCurrency: (ccy1: string, ccy2: string) => boolean;
664
- currenciesNeedingConversion: (currencies: readonly string[], target: string) => string[];
665
- renameDividendColumns: (columns: readonly string[]) => StringPair[];
666
- renameEtfColumns: (columns: readonly string[]) => StringPair[];
667
- getMonthCode: (monthName: string) => string | null;
668
- getMonthName: (code: string) => string | null;
669
- getFuturesMonths: () => StringPair[];
702
+ fmtDate: (year: number, month: number, day: number, fmt?: string) => string;
703
+ generateFuturesCandidates: (genTicker: string, year: number, month: number, day: number, freq?: string, count?: number) => FuturesCandidate[];
704
+ getDvdCols: () => StringPair[];
670
705
  getDvdType: (typ: string) => string | null;
671
706
  getDvdTypes: () => StringPair[];
672
- getDvdCols: () => StringPair[];
673
707
  getEtfCols: () => StringPair[];
674
- buildYasOverrides: (settleDt?: string, yieldType?: number, spread?: number, yieldVal?: number, price?: number, benchmark?: string) => StringPair[];
675
- buildEarningHeaderRename: (headerRow: readonly StringPair[], dataColumns: readonly string[]) => StringPair[];
676
- calculateLevelPercentages: (values: readonly (number | null)[], levels: readonly (number | null)[]) => (number | null)[];
677
- buildPreferredsQuery: (equityTicker: string, extraFields?: readonly string[]) => string;
678
- buildCorporateBondsQuery: (ticker: string, ccy?: string, extraFields?: readonly string[], activeOnly?: boolean) => string;
679
- buildEtfHoldingsQuery: (etfTicker: string, extraFields?: readonly string[]) => string;
680
- defaultTurnoverDates: (startDate?: string, endDate?: string) => TimeRange;
681
- defaultBqrDatetimes: (startDatetime?: string, endDatetime?: string) => TimeRange;
682
- deriveSessions: (dayStart: string, dayEnd: string, mic?: string, exchCode?: string) => SessionWindowsInfo;
708
+ getExchangeOverride: (ticker: string) => ExchangeInfoResult | null;
709
+ getFuturesMonths: () => StringPair[];
683
710
  getMarketRule: (mic?: string, exchCode?: string) => MarketRule | null;
711
+ getMonthCode: (monthName: string) => string | null;
712
+ getMonthName: (code: string) => string | null;
684
713
  inferTimezone: (countryIso: string) => string | null;
685
- setExchangeOverride: (ticker: string, input: ExchangeOverrideInput) => void;
686
- getExchangeOverride: (ticker: string) => ExchangeInfoResult | null;
687
- clearExchangeOverride: (ticker?: string) => void;
714
+ isLongFormat: (ipcBuffer: Buffer) => boolean;
715
+ isSpecificContract: (ticker: string) => boolean;
688
716
  listExchangeOverrides: () => ExchangeInfoResult[];
717
+ normalizeTickers: (tickers: readonly string[]) => string[];
718
+ parseCdxTicker: (ticker: string) => CdxTickerInfo;
719
+ parseDate: (dateStr: string) => number[];
720
+ parseTicker: (ticker: string) => TickerParts;
721
+ pivotToWide: (ipcBuffer: Buffer) => Buffer;
722
+ previousCdxSeries: (ticker: string) => string | null;
723
+ renameDividendColumns: (columns: readonly string[]) => StringPair[];
724
+ renameEtfColumns: (columns: readonly string[]) => StringPair[];
725
+ sameCurrency: (ccy1: string, ccy2: string) => boolean;
689
726
  sessionTimesToUtc: (startTime: string, endTime: string, exchangeTz: string, date: string) => TimeRange;
727
+ setExchangeOverride: (ticker: string, input: ExchangeOverrideInput) => void;
728
+ validateGenericTicker: (ticker: string) => void;
690
729
  }>;
691
730
  declare function version(): string;
692
731
  declare const setLogLevel: (level: string) => void;
693
732
  declare const getLogLevel: () => string;
694
733
 
695
- export { type ActiveCdxOptions, ArrowSubscription, type AuthConfig, Backend, type BackendKind, type BdhOptions, type BdibOptions, type BdpOptions, type BdtickOptions, type BeqsOptions, type BfldsOptions, type BlkpOptions, BlpError, BlpInternalError, BlpRequestError, BlpSessionError, BlpTimeoutError, BlpValidationError, type BqlOptions, type BqrOptions, type BsrchOptions, type BtaOptions, type CdxOptions, type CdxTickerInfo, type CorporateBondsOptions, type DateLike, type DateTimeLike, type DividendOptions, Engine, type EngineConfig, type EtfHoldingsOptions, type ExchangeInfoResult, type ExchangeOverrideInput, FieldHandle, type FieldInfo, Format, type FormatKind, type FuturesCandidate, type FuturesResolveOptions, type FxPairInfo, type MarketRule, type OverridesMap, type PreferredsOptions, type PrimitiveValue, type RecipeBackendOptions, type RequestInput, type RequestOptions, type ServerAddress, type SessionWindowsInfo, type Socks5Config, type StreamOptions, type StringPair, Subscription, type SubscriptionStats, Tick, type TickValue, type TickerParts, type TimeRange, type TlsConfig, type TurnoverOptions, type YasOptions, abdh, abdib, abdp, abds, abdtick, asubscribe, bdh, bdib, bdp, bds, bdtick, blp, configure, connect, ext, formatDate, formatDateTime, getLogLevel, setLogLevel, subscribe, version, wrapError };
734
+ export { type ActiveCdxOptions, ArrowSubscription, type AuthConfig, Backend, type BackendKind, type BdhOptions, type BdibOptions, type BdpOptions, type BdtickOptions, type BeqsOptions, type BfldsOptions, type BlkpOptions, BlpError, BlpInternalError, BlpRequestError, BlpSessionError, BlpTimeoutError, BlpValidationError, type BqlOptions, type BqrOptions, type BsrchOptions, type BtaOptions, type CdxOptions, type CdxTickerInfo, type CorporateBondsOptions, type DateLike, type DateTimeLike, type DividendOptions, type DividendYieldOptions, Engine, type EngineConfig, type EtfHoldingsOptions, type ExchangeInfoResult, type ExchangeOverrideInput, FieldHandle, type FieldInfo, Format, type FormatKind, type FuturesCandidate, type FuturesCurveOptions, type FuturesResolveOptions, type FxPairInfo, type IndexMembersOptions, type MarketRule, type OverridesMap, type PreferredsOptions, type PrimitiveValue, type RecipeBackendOptions, type RequestInput, type RequestOptions, type ServerAddress, type SessionWindowsInfo, type Socks5Config, type StreamOptions, type StringPair, Subscription, type SubscriptionStats, Tick, type TickValue, type TickerParts, type TimeRange, type TlsConfig, type TurnoverOptions, type VolFieldSpec, type VolSurfaceOptions, type VolSurfacePreset, type YasOptions, abdh, abdib, abdp, abds, abdtick, asubscribe, bdh, bdib, bdp, bds, bdtick, blp, configure, connect, ext, formatDate, formatDateTime, getLogLevel, setLogLevel, subscribe, version, wrapError };