Reference
The things you reach for most, in one place. Every prop, type and export is in the full API reference on GitHub.
AstroneumChart props
| Prop | Type | What it does |
|---|
symbol | SymbolInfo | The symbol to show. Required. |
period | Period | The timeframe, e.g. { multiplier: 1, timespan: 'hour', text: '1H' }. Required. |
datafeed | Datafeed | Where bars come from. Required. Read when the chart mounts, so use a new key to change it. |
theme | 'dark' | 'light' | The theme. Follows the operating system if left out. |
styles | DeepPartial<Styles> | Style overrides, including the chart type: { candle: { type: 'line' } }. Applies live. |
mainIndicators | { name, calcParams? }[] | Indicators drawn on the price chart. EMA 7, 25 and 99 if left out. Follows changes. |
subIndicators | string[] | Indicators in their own panes (['VOL'] by default). Follows changes. |
historyCache | boolean | { namespace?, maxBars? } | Save loaded bars in the browser. Off by default. |
periods | Period[] | The timeframes offered in the period bar. |
drawingBarVisible | boolean | Show the drawing tools on the left. true by default. |
locale, timezone | string | Language (18 built in) and IANA time zone. |
plugins | ChartPlugin[] | Plugins mounted with the chart. |
accessible | boolean | Make the chart focusable and announce the crosshair prices to screen readers. |
priceScale | 'linear' | 'log' | 'percent' | How the price axis is scaled. |
watermark | string | Node | What is drawn faintly behind the bars. The Astroneum logo if left out. |
ariaLabel | string | The label a screen reader announces for the chart. Used with accessible. |
barStyle | 'candle' | 'heikin_ashi' | Converts history only. For a live Heikin-Ashi chart use createTransformedDatafeed. |
style, className | | Sizing and styling of the container. Give it a height. |
The handle (ref)
| Method | What it does |
|---|
setSymbol / getSymbol | Change or read the symbol |
setPeriod / getPeriod | Change or read the timeframe |
setTheme / getTheme | Change or read the theme |
setStyles / getStyles | Change or read styles |
setLocale / setTimezone | Language and time zone (with matching getters) |
serializeState / loadState | Save and restore the chart as JSON, drawings and indicators included |
getDataListLength, getLastDataTimestamp | How many bars are loaded, and the newest timestamp |
onCrosshairMove, setCrosshair | Follow or drive the crosshair, e.g. to link two charts. onCrosshairMove returns a function that stops listening. |
lockAllDrawings | Lock or unlock every drawing |
Chart type values
| Chart type | How to get it |
|---|
| Candlestick | styles.candle.type: 'candle_solid' |
| Hollow candles | 'candle_up_stroke' (also 'candle_stroke', 'candle_down_stroke') |
| OHLC bars | 'ohlc' |
| Line | 'line' |
| Area | 'area' |
| Heikin-Ashi | createTransformedDatafeed(feed, () => heikinAshi) |
| Renko | createTransformedDatafeed(feed, h => bars => generateRenko(bars, brick)) |
| Range bars | createTransformedDatafeed(feed, h => bars => generateRangeBars(bars, range)) |
Imports
| Import | You get |
|---|
astroneum | AstroneumChart, createStandardCryptoDatafeed, createTransformedDatafeed, heikinAshi, generateRenko, generateRangeBars, configureIndicatorWorkers, clearHistoryCache, registerIndicator, getSupportedIndicators, formatters and more |
astroneum/style.css | The stylesheet. Import it once. |
astroneum/replay | BarReplay |
astroneum/multichart | MultiChartLayout |
astroneum/watchlist, portfolio, alerts, script | WatchlistManager, PortfolioTracker, AlertManager, ScriptEngine |
astroneum/datafeeds/crypto, polygon, webtransport | The datafeeds on their own |