nexustrade 5.1.0 → 5.2.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.
@@ -377,6 +377,9 @@ class PortfolioHandle {
377
377
  };
378
378
  if (options.baseline !== undefined)
379
379
  input.baseline = options.baseline;
380
+ if (options.baselineAsset !== undefined) {
381
+ input.baselineAsset = options.baselineAsset;
382
+ }
380
383
  if (options.interval !== undefined)
381
384
  input.interval = options.interval;
382
385
  if (options.initialValue !== undefined) {
@@ -176,6 +176,8 @@ export interface NexusTradeClientOptions {
176
176
  baseUrl?: string;
177
177
  workspaceSession?: string;
178
178
  transport?: Transport;
179
+ /** Per-request HTTP timeout for the built-in transport (default 30). */
180
+ requestTimeoutSeconds?: number;
179
181
  }
180
182
  export interface WaitOptions {
181
183
  timeoutSeconds?: number;
@@ -241,7 +243,7 @@ export declare function waitForOperation(fetch: (operationId: string) => Promise
241
243
  export declare class NexusTradeClient {
242
244
  private readonly transport;
243
245
  constructor(options?: NexusTradeClientOptions);
244
- static fromEnvironment(): NexusTradeClient;
246
+ static fromEnvironment(options?: Pick<NexusTradeClientOptions, "requestTimeoutSeconds">): NexusTradeClient;
245
247
  /** Return the anonymous workspace token after the first API call bootstraps it. */
246
248
  exportWorkspaceSession(): string | undefined;
247
249
  /** Resume an existing anonymous workspace without creating a replacement. */
@@ -500,6 +500,7 @@ const BACKTEST_ARG_NAMES = [
500
500
  ["start_date", "startDate"],
501
501
  ["end_date", "endDate"],
502
502
  ["baseline_symbol", "baseline"],
503
+ ["baseline_asset", "baselineAsset"],
503
504
  ["interval", "interval"],
504
505
  ["initial_value", "initialValue"],
505
506
  ["generate_events", "generateEvents"],
@@ -778,6 +779,10 @@ export class NexusTradeClient {
778
779
  transport;
779
780
  constructor(options = {}) {
780
781
  if (options.transport) {
782
+ if (options.requestTimeoutSeconds !== undefined) {
783
+ throw new Error("requestTimeoutSeconds applies only to the built-in HTTP transport; " +
784
+ "configure a custom transport directly.");
785
+ }
781
786
  this.transport = options.transport;
782
787
  return;
783
788
  }
@@ -791,10 +796,11 @@ export class NexusTradeClient {
791
796
  apiKey,
792
797
  baseUrl: baseUrl ?? DEFAULT_API_BASE_URL,
793
798
  workspaceSession: options.workspaceSession,
799
+ timeoutSeconds: options.requestTimeoutSeconds,
794
800
  });
795
801
  }
796
- static fromEnvironment() {
797
- return new NexusTradeClient();
802
+ static fromEnvironment(options = {}) {
803
+ return new NexusTradeClient(options);
798
804
  }
799
805
  /** Return the anonymous workspace token after the first API call bootstraps it. */
800
806
  exportWorkspaceSession() {