Candlesticks Canvas
The candlesticks renderer provides the kline scenario.
Spawn
config is a JSON string. It must contain exactly one stock identifier field:
tagcode, an alias oftag
Do not provide both fields.
canvas_spawn({
kind: 'candlesticks',
scenario: 'kline',
config: JSON.stringify({
code: '000001.SZ',
interval_unit: 'Day',
interval_value: 1,
adjust_kind: 'None',
limit: 120,
}),
});
Valid mainland identifiers use a six-digit code and an exchange suffix, for example
000001.SZ, 600519.SH, or a valid Beijing exchange code ending in .BJ.
Optional config fields:
data_file: absolute JSON or CSV OHLCV file pathinterval_unit:Minute,Day,Week,Month, orYearinterval_value: positive interval multiplieradjust_kind:None,Forward, orBackwardlimit: number of candles, from 1 to 2000
Config Recovery
canvas_spawn waits for candlesticks to validate the config and load its data. When it returns
success: false, read id and error, correct the reported field, and call canvas_update for
that same ID. Do not call canvas_spawn again unless the original Canvas was closed.
canvas_update({
id: 'candlesticks-...',
config: JSON.stringify({ code: '000001.SZ' }),
});
canvas_update also waits for the renderer and returns success: false with the exact error when
the replacement config or its data cannot be applied. Config errors are not delivered as actions.
Interaction
- Click a candle to select it.
- Press
ato attach summarized chart context to the next user prompt. - Press Enter to ask the LLM to analyze the selected or visible range.
- Press
eto export the visible range as a JSON artifact.
When canvas_wait is available, call it with this Canvas ID while waiting for an interactive
selection or analysis request. Otherwise, rely on the host's automatic Canvas event delivery.