@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
    • get token(): AuthTokenResponse | null

      Currently cached token, if any.

      Returns AuthTokenResponse | null

    • 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>

    • Load a previously-persisted token from the store. If none, mint one. Called automatically by every workflow method.

      Returns Promise<AuthTokenResponse>

    • 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>

    • List datasets owned by the authenticated caller. Refreshes once on 401.

      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

      Returns Promise<InstrumentDetail[]>

    • List every strategy you have registered and not deleted, most recently compiled first. Refreshes the token once on 401 before retrying. See QTSurfer.getStrategies.

      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>

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

      Parameters

      • datasetId: string

      Returns Promise<DatasetUploadSession>

    • Force a fresh JWT exchange. Bypasses the cache.

      Returns Promise<AuthTokenResponse>

    • 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>