Skip to content

StocksPackageConfig

Defined in: packages/engine/src/packages/stocks/types.ts:23

Configuration for createStocksPackage. See StocksPackage.ts’s module doc for the full “bring your own data source” rationale.

optional enableBareTickerRecognition?: boolean;

Defined in: packages/engine/src/packages/stocks/types.ts:49

Enable the bare-ticker grammar (AAPL alone, no stock(...) wrapper) for the small bundled allow-list in MajorTickers.ts. Default false, a bare all-caps word is genuinely ambiguous with a variable name (:AAPL = 5), so this is opt-in even though the package itself is already opt-in. The stock(TICKER) function-call form works regardless of this setting and is the only ALWAYS- reachable syntax. See StocksPackage.ts’s module doc.


optional fetchHistoricalQuote?: (ticker, isoDate, signal) => Promise<StockHistoricalQuote>;

Defined in: packages/engine/src/packages/stocks/types.ts:38

Fetch a historical quote for ticker on isoDate (YYYY-MM-DD). Required for the on <date> / close on <date> / volume on <date> forms, when omitted, those expressions resolve to an honest STOCKS_NOT_CONFIGURED error Value.

ParameterType
tickerstring
isoDatestring
signalAbortSignal

Promise<StockHistoricalQuote>


optional fetchQuote?: (ticker, signal) => Promise<StockQuote>;

Defined in: packages/engine/src/packages/stocks/types.ts:30

Fetch the current quote for ticker (already upper-cased). Required for stock(TICKER) / N stock(TICKER) to return real data, when omitted, those expressions resolve to an honest STOCKS_NOT_CONFIGURED error Value, never a faked/zero price.

ParameterType
tickerstring
signalAbortSignal

Promise<StockQuote>


optional historicalStaleTimeMs?: number;

Defined in: packages/engine/src/packages/stocks/types.ts:64

TanStack Query staleTime for HISTORICAL (on <date>) lookups, in ms. Default 30 days, a closing price for a specific past date is immutable, so this is set long purely to avoid pointless repeat fetches, not because the data could go stale.


optional staleTimeMs?: number;

Defined in: packages/engine/src/packages/stocks/types.ts:56

TanStack Query staleTime for CURRENT-price lookups, in ms. Default 60s , intraday quotes move continuously, so a short stale window keeps re-evaluation reasonably fresh without re-fetching on every keystroke.