@xbbg/core 1.3.1 → 1.4.2

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
@@ -104,6 +104,7 @@ npm run bench:subscription-replay -- --fixture tmp/xbtusd-ticks.jsonl --iteratio
104
104
 
105
105
  ```typescript
106
106
  import * as xbbg from '@xbbg/core';
107
+ import { bdp, ovr } from '@xbbg/core';
107
108
 
108
109
  xbbg.configure({
109
110
  host: 'localhost',
@@ -138,6 +139,19 @@ const zfpEngine = await xbbg.connect({
138
139
  const hist = await xbbg.blp.abdh(['AAPL US Equity'], ['PX_LAST'], '2024-01-01', '2024-12-31');
139
140
  const ref = await xbbg.blp.abdp(['AAPL US Equity'], ['PX_LAST', 'SECURITY_NAME']);
140
141
  const bulk = await xbbg.blp.abds(['ES1 Index'], ['FUT_CHAIN_LAST_TRADE_DATES']);
142
+
143
+ // Composable override helper
144
+ await bdp(['AAPL US Equity'], ['CRNCY_ADJ_PX_LAST'], {
145
+ overrides: ovr({ EQY_FUND_CRNCY: 'EUR' }),
146
+ });
147
+ await bdp(['AAPL US Equity', 'MSFT US Equity'], ['CRNCY_ADJ_PX_LAST'], {
148
+ overrides: ovr({
149
+ EQY_FUND_CRNCY: 'USD',
150
+ 'AAPL US Equity': ovr({ EQY_FUND_CRNCY: 'EUR' }),
151
+ 'MSFT US Equity': ovr({ EQY_FUND_CRNCY: 'JPY' }),
152
+ }),
153
+ });
154
+
141
155
  const bars = await xbbg.blp.abdib('AAPL US Equity', '2024-12-01', 5);
142
156
  const ticks = await xbbg.blp.abdtick(
143
157
  'AAPL US Equity',
@@ -230,6 +244,7 @@ const px = await engine.currencyConversion('700 HK Equity', 'USD', '20240101', '
230
244
  - `zfpRemote` (`'8194'` or `'8196'`) for Bloomberg-assigned ZFP endpoints in an entitled environment; do not combine it with `host`/`port`/`servers`/`socks5`
231
245
  - `socks5` for proxied access to already-provisioned direct Bloomberg endpoints
232
246
  - `retryPolicy`, `numStartAttempts`, and recovery settings for reconnect behavior
247
+ - `shardRequests`, `shardThreshold`, `shardChunkSize`, and `shardMaxConcurrent` for opt-in sharding of wide multi-security `bdp`/`bdh` requests
233
248
 
234
249
  The JS binding forwards these fields directly to the Rust engine, so Node can configure the same auth and transport features already available in the core runtime. Invalid transport combinations such as `zfpRemote` plus direct hosts fail during configuration instead of silently connecting to `localhost:8194`.
235
250
 
package/dist/index.d.ts CHANGED
@@ -74,6 +74,26 @@ interface StringPair {
74
74
  key: string;
75
75
  value: string;
76
76
  }
77
+ type SeatType = 'BPS' | 'NONBPS' | 'INVALID';
78
+ interface EntitlementReport {
79
+ entitled: boolean;
80
+ failedEids: number[];
81
+ }
82
+ interface BloombergMetadataError {
83
+ category?: string;
84
+ code?: string | number;
85
+ subcategory?: string;
86
+ message?: string;
87
+ }
88
+ interface BloombergFieldException extends BloombergMetadataError {
89
+ field?: string;
90
+ }
91
+ interface ResultMetadata {
92
+ metadata: Record<string, string>;
93
+ eidData?: Record<string, number[]>;
94
+ securityErrors?: Record<string, BloombergMetadataError>;
95
+ fieldExceptions?: Record<string, BloombergFieldException[]>;
96
+ }
77
97
  interface ServerAddress {
78
98
  host: string;
79
99
  port: number;
@@ -122,6 +142,14 @@ interface EngineConfig {
122
142
  zfpRemote?: '8194' | '8196';
123
143
  requestPoolSize?: number;
124
144
  subscriptionPoolSize?: number;
145
+ /** Enable request sharding for eligible multi-security bdp/bdh requests. Default false. */
146
+ shardRequests?: boolean;
147
+ /** Minimum securities before request sharding applies. Default 20. */
148
+ shardThreshold?: number;
149
+ /** Maximum securities per sharded request. Default 16. */
150
+ shardChunkSize?: number;
151
+ /** Maximum concurrent shard requests per user request. Default 4. */
152
+ shardMaxConcurrent?: number;
125
153
  validationMode?: string;
126
154
  subscriptionFlushThreshold?: number;
127
155
  maxEventQueueSize?: number;
@@ -161,7 +189,7 @@ interface RequestInput {
161
189
  securities?: readonly string[];
162
190
  security?: string;
163
191
  fields?: readonly string[];
164
- overrides?: readonly StringPair[];
192
+ overrides?: OverridesInput;
165
193
  elements?: readonly StringPair[];
166
194
  kwargs?: readonly StringPair[];
167
195
  jsonElements?: string;
@@ -177,6 +205,7 @@ interface RequestInput {
177
205
  options?: readonly StringPair[];
178
206
  fieldTypes?: readonly StringPair[];
179
207
  includeSecurityErrors?: boolean;
208
+ returnEids?: boolean;
180
209
  validateFields?: boolean;
181
210
  searchSpec?: string;
182
211
  fieldIds?: readonly string[];
@@ -197,21 +226,49 @@ interface FieldInfo {
197
226
  }
198
227
  type PrimitiveValue = string | number | boolean;
199
228
  type OverridesMap = Record<string, PrimitiveValue>;
229
+ type OverrideValue = PrimitiveValue | Date | {
230
+ toJSDate: () => Date;
231
+ };
232
+ interface OverrideObject {
233
+ readonly [key: string]: OverrideValue | OverrideNestedSource;
234
+ }
235
+ type OverrideNestedSource = OverrideObject | OverrideSpecLike | readonly OverrideEntry[];
236
+ interface SecurityOverrideSpec {
237
+ readonly security: string;
238
+ readonly overrides: readonly StringPair[];
239
+ }
240
+ interface OverrideSpecLike {
241
+ readonly pairs: readonly StringPair[];
242
+ readonly securityOverrides: readonly SecurityOverrideSpec[];
243
+ toPairs(): StringPair[];
244
+ toObject(): OverridesMap;
245
+ toSecurityOverrides(): SecurityOverrideSpec[];
246
+ merge(...sources: OverrideSource[]): OverrideSpecLike;
247
+ forSecurity(security: string, ...sources: OverrideSource[]): OverrideSpecLike;
248
+ }
249
+ type OverrideEntry = {
250
+ readonly key: string;
251
+ readonly value: OverrideValue | OverrideNestedSource;
252
+ } | readonly [string, OverrideValue | OverrideNestedSource];
253
+ type OverrideSource = OverrideObject | OverrideSpecLike | readonly OverrideEntry[];
254
+ type OverridesInput = OverrideSource;
200
255
  interface BdpOptions {
201
- overrides?: OverridesMap;
256
+ overrides?: OverridesInput;
202
257
  kwargs?: OverridesMap;
203
258
  format?: string;
204
259
  backend?: BackendKind;
205
260
  includeSecurityErrors?: boolean;
261
+ returnEids?: boolean;
206
262
  validateFields?: boolean;
207
263
  }
208
264
  interface BdhOptions {
209
265
  start?: DateLike;
210
266
  end?: DateLike;
211
- overrides?: OverridesMap;
267
+ overrides?: OverridesInput;
212
268
  kwargs?: OverridesMap;
213
269
  format?: string;
214
270
  backend?: BackendKind;
271
+ returnEids?: boolean;
215
272
  validateFields?: boolean;
216
273
  }
217
274
  interface BdibOptions {
@@ -253,13 +310,13 @@ interface BeqsOptions {
253
310
  asof?: DateLike;
254
311
  screenType?: string;
255
312
  group?: string;
256
- overrides?: OverridesMap;
313
+ overrides?: OverridesInput;
257
314
  kwargs?: OverridesMap;
258
315
  format?: string;
259
316
  backend?: BackendKind;
260
317
  }
261
318
  interface BsrchOptions {
262
- overrides?: OverridesMap;
319
+ overrides?: OverridesInput;
263
320
  kwargs?: OverridesMap;
264
321
  format?: string;
265
322
  backend?: BackendKind;
@@ -289,7 +346,7 @@ interface BlkpOptions {
289
346
  backend?: BackendKind;
290
347
  }
291
348
  interface RequestOptions {
292
- overrides?: OverridesMap;
349
+ overrides?: OverridesInput;
293
350
  kwargs?: OverridesMap;
294
351
  format?: string;
295
352
  backend?: BackendKind;
@@ -474,6 +531,7 @@ interface NativeArrowZeroCopyBatch {
474
531
  readonly kind: 'zeroCopy';
475
532
  readonly numRows: number;
476
533
  readonly columns: NativeArrowColumn[];
534
+ readonly metadata: Record<string, string>;
477
535
  }
478
536
  type NativeUpdateValue = null | boolean | number | string;
479
537
  interface NativeSubscriptionUpdate {
@@ -533,6 +591,18 @@ declare function formatDateTime(value: DateTimeLike | undefined | null): string
533
591
  declare const CDX_INFO_FIELDS: readonly string[];
534
592
  declare const CDX_PRICING_FIELDS: readonly string[];
535
593
  declare const CDX_RISK_FIELDS: readonly string[];
594
+ declare class OverrideSpec implements OverrideSpecLike {
595
+ readonly pairs: readonly StringPair[];
596
+ readonly securityOverrides: readonly SecurityOverrideSpec[];
597
+ constructor(pairs: readonly StringPair[], securityOverrides?: readonly SecurityOverrideSpec[]);
598
+ [Symbol.iterator](): Iterator<StringPair>;
599
+ toPairs(): StringPair[];
600
+ toObject(): OverridesMap;
601
+ toSecurityOverrides(): SecurityOverrideSpec[];
602
+ merge(...sources: OverrideSource[]): OverrideSpec;
603
+ forSecurity(security: string, ...sources: OverrideSource[]): OverrideSpec;
604
+ }
605
+ declare function ovr(...sources: OverrideSource[]): OverrideSpec;
536
606
  interface RawStudy {
537
607
  studyType?: string;
538
608
  study?: string;
@@ -595,6 +665,30 @@ declare class Engine {
595
665
  * session timeout) — prefer this factory in servers.
596
666
  */
597
667
  static connect(config?: EngineConfig): Promise<Engine>;
668
+ /**
669
+ * Return the Bloomberg identity seat type: "BPS", "NONBPS", or "INVALID".
670
+ *
671
+ * Identity operations authorize lazily using the engine auth config when
672
+ * configured, otherwise the Desktop terminal OS-logon user. The first call
673
+ * may block for a few seconds and transient failures are retryable.
674
+ */
675
+ seatType(): Promise<SeatType>;
676
+ /**
677
+ * Check whether the authorized identity is entitled to all supplied EIDs.
678
+ *
679
+ * Identity operations authorize lazily using the engine auth config when
680
+ * configured, otherwise the Desktop terminal OS-logon user. The first call
681
+ * may block for a few seconds and transient failures are retryable.
682
+ */
683
+ checkEntitlements(service: string, eids: readonly number[]): Promise<EntitlementReport>;
684
+ /**
685
+ * Return whether the authorized identity may use the Bloomberg service.
686
+ *
687
+ * Identity operations authorize lazily using the engine auth config when
688
+ * configured, otherwise the Desktop terminal OS-logon user. The first call
689
+ * may block for a few seconds and transient failures are retryable.
690
+ */
691
+ identityIsAuthorized(service: string): Promise<boolean>;
598
692
  request(params: RequestInput): Promise<unknown>;
599
693
  requestRaw(params: RequestInput): Promise<Buffer>;
600
694
  bdp(tickers: readonly string[], fields: readonly string[], options?: BdpOptions): Promise<unknown>;
@@ -665,7 +759,7 @@ declare function abdp(tickers: string | readonly string[], fields: string | read
665
759
  declare function bdp(tickers: string | readonly string[], fields: string | readonly string[], options?: BdpOptions): Promise<unknown>;
666
760
  declare function abdh(tickers: string | readonly string[], fields: string | readonly string[], start?: DateLike | BdhOptions, end?: DateLike, options?: BdhOptions): Promise<unknown>;
667
761
  declare function bdh(tickers: string | readonly string[], fields: string | readonly string[], options?: BdhOptions): Promise<unknown>;
668
- declare function abds(tickers: string | readonly string[], fields: string | readonly string[], overrides?: OverridesMap, options?: BdpOptions): Promise<unknown>;
762
+ declare function abds(tickers: string | readonly string[], fields: string | readonly string[], overrides?: OverridesInput, options?: BdpOptions): Promise<unknown>;
669
763
  declare function bds(tickers: string | readonly string[], fields: string | readonly string[], options?: BdpOptions): Promise<unknown>;
670
764
  declare function abdib(ticker: string, dt?: DateTimeLike | BdibOptions, interval?: number | BdibOptions, options?: BdibOptions): Promise<unknown>;
671
765
  declare function bdib(ticker: string, options?: BdibOptions): Promise<unknown>;
@@ -746,4 +840,4 @@ declare function version(): string;
746
840
  declare const setLogLevel: (level: string) => void;
747
841
  declare const getLogLevel: () => string;
748
842
 
749
- 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, BlpLimitError, BlpRequestError, BlpSessionError, BlpTimeoutError, BlpValidationError, type BqlOptions, type BqrOptions, type BsrchOptions, type BtaOptions, CDX_INFO_FIELDS, CDX_PRICING_FIELDS, CDX_RISK_FIELDS, 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 };
843
+ export { type ActiveCdxOptions, ArrowSubscription, type AuthConfig, Backend, type BackendKind, type BdhOptions, type BdibOptions, type BdpOptions, type BdtickOptions, type BeqsOptions, type BfldsOptions, type BlkpOptions, type BloombergFieldException, type BloombergMetadataError, BlpError, BlpInternalError, BlpLimitError, BlpRequestError, BlpSessionError, BlpTimeoutError, BlpValidationError, type BqlOptions, type BqrOptions, type BsrchOptions, type BtaOptions, CDX_INFO_FIELDS, CDX_PRICING_FIELDS, CDX_RISK_FIELDS, type CdxOptions, type CdxTickerInfo, type CorporateBondsOptions, type DateLike, type DateTimeLike, type DividendOptions, type DividendYieldOptions, Engine, type EngineConfig, type EntitlementReport, 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 OverrideEntry, type OverrideNestedSource, type OverrideObject, type OverrideSource, OverrideSpec, type OverrideSpecLike, type OverrideValue, type OverridesInput, type OverridesMap, type PreferredsOptions, type PrimitiveValue, type RecipeBackendOptions, type RequestInput, type RequestOptions, type ResultMetadata, type SeatType, type SecurityOverrideSpec, 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, ovr, setLogLevel, subscribe, version, wrapError };