Symbols and data
The terminal hands your code the same market data its charts show: what each market is, its order sizes, closed bars, live quotes and pictures of the charts. Everything is cut at the replay clock in a backtest.
Find a market
import { createTerminal } from "@chartnaut/charts";
const terminal = createTerminal(document.getElementById("terminal")!, {});
async function find() {
const hits = await terminal.symbols.search("nasdaq", { market: "index", limit: 5 });
console.log(hits.map((h) => `${h.symbol} ${h.name}`));
const nas = await terminal.symbols.get("NAS100");
console.log(nas.tick_size, nas.coverage, nas.available.history_start, nas.egress);
}
find();search matches the way Chartnaut's market picker does and only returns markets this user can see here. get takes a symbol, an alias or a sym_ id and answers what the market is (tick_size, contract_multiplier, sessions, coverage), what this user may open (available: how far back their plan's history goes, futures, order flow) and egress: how far its numbers may leave the terminal for your code.
| Your code gets |
|---|---|
| Bars, quotes and script values |
| Screenshots only |
| Nothing beyond the chart itself |
A read refused for this reason fails with data_not_exportable.
Order sizes: lots, contracts or units
Every size carries its unit, and each market takes one. Ask the market before you send a size:
import { createTerminal } from "@chartnaut/charts";
const terminal = createTerminal(document.getElementById("terminal")!, {});
async function smallestBuy(symbol: string) {
const { order_size } = await terminal.symbols.get(symbol);
if (!order_size) return;
// EURUSD: { unit: "lots", min: 0.01, max: 100, step: 0.01 }
await terminal.orders.buy(symbol, { quantity: { quantity: order_size.min, unit: order_size.unit } });
}
smallestBuy("EURUSD");order_size is { unit, min, max, step }, where unit is lots, contracts or units. The unit belongs to the account, not the instrument: MetaTrader accounts trade lots. A size outside these is refused with invalid_args, and the market's sizes come with the error in details.order_size.
Bars
import { createTerminal, rows } from "@chartnaut/charts";
const terminal = createTerminal(document.getElementById("terminal")!, {
charts: { main: { symbol: "NAS100", timeframe: "15m" } },
});
async function lastBars() {
const bars = await terminal.chart("main").bars({ count: 200 });
const last = rows(bars).pop();
console.log(bars.symbol, bars.timeframe, last?.c);
const daily = await terminal.bars({ symbol: "EURUSD", timeframe: "1d", from: "2026-09-01T00:00Z" });
console.log(daily.t.length, "days");
}
lastBars();Bars come in columns (t, o, h, l, c, v, time in unix seconds); rows() turns them into one object per bar. Only closed bars, never past the replay clock. chart.bars() reads a chart's market and timeframe, or another timeframe with { timeframe }. chart.on("barClose") hears each new closed bar.
Bars count against your plan's data allowance: capabilities.sdk_limits says how many a request and an hour (Plans and limits).
Live quotes
In a live terminal (not a backtest, where prices are the replay's):
import { createTerminal } from "@chartnaut/charts";
const terminal = createTerminal(document.getElementById("terminal")!, {});
async function ticker() {
await terminal.ready;
if (terminal.capabilities?.mode !== "live") return; // a backtest's prices are the replay's
const off = await terminal.quotes.subscribe(["BTC", "ETH"], (q) => console.log(q.symbol, q.last, q.change_percent));
setTimeout(off, 60_000);
}
ticker();In React, useQuote(terminal, "BTC") re-renders at most once a frame. A backtest refuses quotes with not_allowed.
Screenshots
import { createTerminal } from "@chartnaut/charts";
const terminal = createTerminal(document.getElementById("terminal")!, {
charts: { main: { symbol: "NAS100", timeframe: "15m" } },
});
async function snap() {
const shot = await terminal.screenshot({ chart: "main", scale: 2 });
const img = document.createElement("img");
img.src = URL.createObjectURL(shot.image);
document.body.append(img);
}
snap();The whole layout, or one chart, as Chartnaut draws it, with the date only. At most one every 2 seconds.
Watchlists
In a live terminal, terminal.watchlists reads and edits the person's own watchlists: list, get, create, rename, add, remove, reorder, and on("change").
