Index of every page on this site: llms.txt
All skills
luxalgo avatar

/building-vela-charts

@3d2179b
by luxalgoluxalgo/vela1.4k stars
285
Run it yourself

Builds financial charts with Vela (@luxalgo/vela) - a full chart app or a multi-chart grid with VelaWorkspace, or the bare Vela chart - fed by offline bars or a data provider (Binance, Coinbase, Hyperliquid or your own), with Pine Script indicators through @luxalgo/vela-pinets, themes, drawings and saved state. Use when adding a candlestick or trading chart to a web app, wiring market data or indicators into Vela, or debugging a Vela chart that stays empty, shows no indicator or loses its state, even if the user only asks for "a trading chart" or "a price chart".

Use this Skill: https://skilld.dev/gh/luxalgo/vela/building-vela-charts

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈148 tokens for metadata: the name and description. ≈1.3k when used: this file.

Description uses 7.4% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈592 characters, or 7.4%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

Building Vela charts

Install @luxalgo/vela (its UI kit, @luxalgo/vela-ui, comes with it). Vela runs in the browser: in a server-rendered app, create the chart in client-only code.

Pick the entry point

Need Use
A chart app: topbar, symbol search, timeframes, indicators, drawings, settings VelaWorkspace from @luxalgo/vela/workspace with layout: false
Several synchronized charts under one chrome VelaWorkspace with layout: '2h', '4', …
Only the chart surface, your own UI around it Vela from @luxalgo/vela

Default to VelaWorkspace: it is the batteries-included app, and the same options configure a bare chart.

A complete chart app

import { VelaWorkspace } from '@luxalgo/vela/workspace';
import { BinanceProvider } from '@luxalgo/vela/providers/binance';

const ws = new VelaWorkspace('#chart', {
    layout: false,                                       // one chart
    symbol: 'BTCUSDT',
    timeframe: '60',                                     // minutes; '4h', '1d', 'D', 'W', 'M' also parse
    live: true,                                          // stream the forming bar
    providers: { binance: () => new BinanceProvider() }, // public API, no key
    theme: 'dark',                                       // or 'light', or a createTheme(...) result
    persist: true,                                       // save layout, indicators, drawings
});
await ws.chart.ready();

The container needs a size: give #chart a height (the workspace fills it).

The bare chart, offline

import { Vela } from '@luxalgo/vela';

// time: the bar's open time in epoch milliseconds
const bars = [{ time: 1730419200000, open: 100, high: 104, low: 99, close: 103, volume: 1200 } /* … */];
const chart = new Vela('#chart', { data: bars, timeframe: '1h', theme: 'dark', height: 480 });
await chart.ready();

data and provider fetching are exclusive: with data, symbol is ignored. To fetch instead, set symbol and register a provider: chart.data.registerProvider('binance', new BinanceProvider()).

Indicators

Built-in studies need nothing: chart.addNativeIndicator('rsi'), or the Indicators menu in the workspace. Scripts need an engine, and Vela ships none. For Pine Script install @luxalgo/vela-pinets and pinets, then:

import { VelaWorkspace } from '@luxalgo/vela/workspace';
import { PineWorkerEngine } from '@luxalgo/vela-pinets';

// workspace: one engine per chart, off the main thread
new VelaWorkspace('#chart', { /* … */ engines: { pine: () => new PineWorkerEngine() } });

// bare chart
chart.registerEngine('pine', new PineWorkerEngine());
const ema = chart.addIndicator(`//@version=5
indicator("EMA", overlay=true)
plot(ta.ema(close, 20))`);
ema.on('ready', () => console.log('computed'));

addIndicator returns its handle at once; values arrive later (ready). Use runScript(source) when you need the computed values and a clean failure instead.

Rules that prevent the common bugs

  1. An empty chart usually means no provider serves the symbol (the load waits, the data:unresolved event fires), the provider refuses that timeframe for the symbol (data:unavailable fires with its finest timeframe), or the container has no height.
  2. A script that never shows means no engine is registered for its language.
  3. Read state through the chart, not from your copies. chart.market is the current market; switch it in place with chart.setMarket({ symbol, timeframe }) (indicators and drawings survive), and listen to market:changed.
  4. Do not remove the bottom-left Vela mark unless the page shows an equivalent visible attribution ("Vela" linking to the project): the license requires one. chart.renderer.set('attribution', false) turns it off.
  5. Tear down with ws.destroy() or chart.destroy(); call chart.resize() after the container changes size without a window resize.
  6. Themes: createTheme, checkTheme and registerTheme come from @luxalgo/vela, the css tag for part restyles from @luxalgo/vela/ui; the theming-vela-ui skill (shipped with @luxalgo/vela-ui) covers restyling in depth.

Check your work

  1. await ws.chart.ready() (or chart.ready()) resolves, and candles are visible.
  2. chart.inspect() lists the series and drawings the chart generated, a check that does not depend on pixels.
  3. For indicators, the handle's ready event fires and its legend row appears.

Further reading

The docs ship with the package, matching the installed version:

  • node_modules/@luxalgo/vela/docs/user/workspace.md: layouts, cells, sync, persistence, composing the topbar and the sidebar.
  • node_modules/@luxalgo/vela/docs/user/options.md: every option.
  • node_modules/@luxalgo/vela/docs/user/api-reference.md: the chart's methods, events and control surfaces (renderer, panes, data, drawings, marks, replay).
  • Related skills: using-vela-data-providers (venues, symbols, writing a provider), adding-vela-indicators (built-in studies, Pine Script®, custom indicators and engines), using-vela-drawing-tools (the toolbar, drawings from code, saving them), extending-vela-with-plugins (buttons, menus, panels and chart types).

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts13d3 checks · Risk SAFE
  • Gen Agent Trust Hub13d

    The skill provides documentation and code examples for building financial charts using the LuxAlgo Vela library. It includes instructions for setting up workspaces, handling market data from providers like Binance, and integrating Pine Script indicators. All referenced packages and services are official components of the LuxAlgo ecosystem or standard financial data providers. No security risks were identified.

  • Socket13d

    No alerts

  • Snyk13d

    Risk: LOW · No issues

Signed by skilld at 3d2179b. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 days ago.

Activeupdated 2 weeks ago

README badge

README badge for luxalgo/vela/building-vela-charts