Skip to content

This site describes solve-engine as it is on main: 2.43.0, which npm does not have yet. npm installs 2.40.0, so a page may show an answer that version does not give yet.

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:71

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 provider?: string;

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

The provider’s name, recorded on every quote this package fetches so a host can say where a figure came from and when (see vm/Provenance.ts). Defaults to "host", since the fetch is the host’s own.


optional refetchIntervalMs?: number;

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

Cadence, in ms, for proactive background refresh of a CURRENT quote that is on screen (say 60_000 to refresh a live price once a minute). Omit (the default) to keep the current quote pull-only, refreshing on the next re-evaluation once stale. It applies only to the current-price resolver, a historical close never refreshes, and takes effect only when the engine has backgroundRefresh.enabled.


optional staleTimeMs?: number;

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

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.