@qtsurfer/sdk
    Preparing search index...

    Class AuthenticatedClient

    Authenticated SDK session.

    Returned by authenticate. Wraps the underlying api-client, owns a JWT (in memory by default, or in the provided TokenStore), and transparently re-exchanges the apikey for a fresh JWT on 401.

    Multi-session note: the session mutates the api-client singleton config on every call. Concurrent sessions in the same process will race; today the SDK targets the one-session-per-process pattern.

    Index
    baseUrl: string
    • Drop the cached token (in memory and in the store).

      Returns Promise<void>

    • Soft-delete a dataset. Refreshes once on 401.

      Parameters

      • datasetId: string

      Returns Promise<void>

    • Release a registered strategy. Refreshes the token once on 401 before retrying. See QTSurfer.deleteStrategy for what this does and does not undo.

      Parameters

      • strategyId: string

      Returns Promise<void>

    • Run a backtest end-to-end (compile → prepare → execute), sending the currently cached token (minting one first if none is cached). Unlike downloadTickers()/downloadKlines(), a 401 here is not auto-retried: the underlying stage errors carry no HTTP status, so a token that expires mid-backtest surfaces as QTSPreparationError/QTSExecutionError rather than triggering a refresh.

      Parameters

      Returns Promise<ResultMap>

    • Queue ingest after upload succeeds. Refreshes once on 401.

      Parameters

      • datasetId: string
      • uploadId: string

      Returns Promise<{ jobId: string }>

    • Read a dataset and its current-version metadata. Refreshes once on 401.

      Parameters

      • datasetId: string

      Returns Promise<DatasetWithLinks>

    • Read an external-history import's state. Refreshes once on 401.

      Parameters

      • datasetId: string
      • importId: string

      Returns Promise<DatasetImportState>

    • List owned datasets; includeDeleted: true includes deleted rows with deletedAt. Refreshes once on 401.

      Parameters

      • Optionaloptions: { includeDeleted?: boolean }

      Returns Promise<Dataset[]>

    • Read ingestion state for one upload session. Refreshes once on 401.

      Parameters

      • datasetId: string
      • uploadId: string

      Returns Promise<DatasetUploadState>

    • List the exchanges the platform serves. Refreshes the token once on 401 before retrying.

      Returns Promise<Exchange[]>

    • List an exchange's instruments, optionally for a specific segment. Refreshes the token once on 401 before retrying. See QTSurfer.getInstruments for what the unwrapped HAL envelope leaves out.

      Parameters

      • exchangeId: string
      • Optionalsegment: string

      Returns Promise<InstrumentDetail[]>

    • Parameters

      • runId: string
      • Optionalquery: {
            currency?: string;
            cursor?: string;
            differential?: boolean;
            instrument?: string;
            limit?: number;
            measure?: "realisedPnl" | "totalPnl";
            outMode?: EquityCurveOutMode;
            resample?: number;
            sinceMs?: number;
        }
        • Optionalcurrency?: string

          One account's quote currency, e.g. USDT. May be left out when the run has a single account, or none yet, or when instrument is given.

        • Optionalcursor?: string

          Continue from a previous page's _links.next. Giving it turns the answer into one page of the raw curve; it cannot be combined with resample.

        • Optionaldifferential?: boolean

          Delta-encode both fields from the second point onward (from the second point of each page, when paging).

        • Optionalinstrument?: string

          One instrument of the account, as BASE/QUOTE: answers its cumulative realised PnL instead of the account's equity. Its account is its quote currency; a currency that is another one is a 400. In a run started with accounts: instrument it selects the account of that instrument instead and the answer is the account's own equity curve.

        • Optionallimit?: number

          Page size, in entries (a gap is one). Giving it turns the answer into one page of the raw curve; it cannot be combined with resample.

        • Optionalmeasure?: "realisedPnl" | "totalPnl"

          With instrument: realisedPnl (the default) or totalPnl, which adds the unrealised value of its open position at each mark. Without instrument it is a 400, and so it is in a run started with accounts: instrument, whose accounts have one curve.

        • OptionaloutMode?: EquityCurveOutMode

          Requested JSON shape. May be overridden by the server's size guard; meta.outMode in the response is the source of truth.

        • Optionalresample?: number

          Downsample to at most this many points (extrema-preserving — the global max/min and the exact first/last point are always kept). Omit for no downsampling.

        • OptionalsinceMs?: number

          Start from this market time (epoch ms), inclusive. Ignored when cursor is given.

      Returns Promise<LivePaperEquityCurve>

    • Parameters

      • runId: string
      • Optionalquery: {
            cursor?: string;
            instrument?: string;
            limit?: number;
            sinceMs?: number;
            type?: "hint" | "info" | "marker" | "command" | "paper";
        }

      Returns Promise<LiveSignalPage>

    • Read a DEX exchange's pool array. Refreshes once on 401.

      Parameters

      • exchangeId: string
      • Optionalsegment: string

      Returns Promise<PoolDetail[]>

    • List strategies, most recently compiled first. Pass includeDeleted: true to include deleted entries with deletedAt. Refreshes the token once on 401 before retrying. See QTSurfer.getStrategies.

      Parameters

      • Optionaloptions: { includeDeleted?: boolean }

      Returns Promise<StrategySummary[]>

    • Read a strategy's recorded state, including its validation verdict. Refreshes the token once on 401 before retrying. See StrategyState for why a 'passed' verdict is a floor rather than a guarantee.

      Parameters

      • strategyId: string

      Returns Promise<StrategyState>

    • Read back a strategy's exact registered source. Refreshes the token once on 401 before retrying. See QTSurfer.getStrategyCode for what its 404 covers.

      Parameters

      • strategyId: string

      Returns Promise<string>

    • Start an external-history dataset import. Refreshes once on 401.

      Parameters

      • request: DatasetImportRequest

      Returns Promise<DatasetImportCreated>

    • Open or recover an upload session for another version of a dataset.

      Parameters

      • datasetId: string

      Returns Promise<DatasetUploadSession>

    • Run the full compile → prepare → executeSweep pipeline and resolve once the platform has accepted the sweep, handing back a Sweep that keeps polling the leaderboard in the background. See QTSurfer.sweep for why the sweep is one call rather than composable stages, and Sweep.result for how to read what it found.

      The currently cached token is sent (minting one first if none is cached), but as with backtest() a 401 here is not auto-retried: the underlying stage errors carry no HTTP status, so a token that expires mid-pipeline surfaces as QTSPreparationError/QTSExecutionError rather than triggering a refresh.

      The background leaderboard poll and Sweep.sensitivity sit outside the policy for a second, independent reason: both run after this promise has already resolved, so a token that expires while a sweep is in flight surfaces on Sweep.result whatever the stage errors carry.

      Parameters

      Returns Promise<Sweep>

    • PUT raw CSV bytes to the upload session's presigned URL.

      Parameters

      • upload: DatasetUploadSession
      • file: BodyInit

      Returns Promise<void>