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.
Properties
Section titled “Properties”enableBareTickerRecognition?
Section titled “enableBareTickerRecognition?”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.
fetchHistoricalQuote?
Section titled “fetchHistoricalQuote?”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
ticker | string |
isoDate | string |
signal | AbortSignal |
Returns
Section titled “Returns”Promise<StockHistoricalQuote>
fetchQuote?
Section titled “fetchQuote?”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
ticker | string |
signal | AbortSignal |
Returns
Section titled “Returns”Promise<StockQuote>
historicalStaleTimeMs?
Section titled “historicalStaleTimeMs?”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.
staleTimeMs?
Section titled “staleTimeMs?”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.