Vela README

项目的 README,来自 github.com/LuxAlgo/Vela。合并为一个 markdown 文件:README.md。

Vela™ by LuxAlgo

Vela™

Fast, extensible financial charts for the web: the open-source core of Vela by LuxAlgo.
Headless core · native WebGL2 renderer · batteries-included workspace · plugin SDK

npm version Downloads License

Homepage · Quick start · Documentation · Plugin SDK · Changelog · License

Vela™ renders interactive financial charts with its own native renderer (WebGL2, with a canvas2d fallback) and keeps the chart itself headless: drive it entirely from code, or drop in the workspace for a complete chart app in one call. Every layer (data providers, scripting engines, renderers) plugs in behind a public port and can be swapped without touching the rest.

What's in the box

Vela package layout

Installing

npm install @luxalgo/vela

Quick start

The fastest path is the workspace, a complete chart app in one call:

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

const chart = new VelaWorkspace('#chart', {
    layout: false, // one chart; '2h' | '4' | '8' | … for a multi-chart grid
    symbol: 'BTCUSDT',
    timeframe: '60',
    live: true,
    theme: 'dark',
    providers: { binance: () => new BinanceProvider() },
    persist: true, // restore market, style, timezone, drawings and indicators from localStorage
});

Prefer full control? Use the headless core directly:

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

const chart = new Vela('#chart', { symbol: 'binance:BTCUSDT', timeframe: '60', live: true });
chart.data.registerProvider('binance', new BinanceProvider());
await chart.ready();

No provider, no network? Pass your own bars via the data option. See the quickstart.

Browser bundle

The package also ships self-contained browser builds for script-tag usage: dist/vela.global.js (readable, development) and dist/vela.global.min.js (minified, production). Either file attaches the library's public API, including the bundled providers, to window.Vela.

Indicators

Vela™ ships 70+ built-in studies — moving averages, bands and channels, momentum oscillators, trend and volatility measures, volume studies, and price-anchored overlays such as VWAP, SuperTrend, and Pivot Points. They compute from the chart's own bars (no scripting engine), and each one gets a legend row, a settings dialog, and persistence across reloads. Volume and the visible-range volume profile sit alongside them.

Custom scripts still run through pluggable engines. Vela™ ships none: install the addon for the language you want, or write one against the public ScriptingEngine port. Pine Script® lives in @luxalgo/vela-pinets (npm i @luxalgo/vela-pinets pinets), which is AGPL-3.0 because the PineTS runtime it executes is. Vela™ itself stays Apache-2.0 and carries no Pine code:

import { PineEngine } from '@luxalgo/vela-pinets';

chart.registerEngine('pine', new PineEngine());
chart.addIndicator(`//@version=6
indicator("EMA 20", overlay=true)
plot(ta.ema(close, 20), color=color.orange, linewidth=2)`);

Host tooling can execute-and-inject safely with chart.runIndicator(source) (structured errors, no dead legend rows) and read a running script's state, including its return value, via handle.context() (read-only snapshots, worker-safe). See the API reference, and Scripting engines for the addon and for writing your own.

The workspace takes an indicator manifest: inline JSON, a URL returning it, or an async loader (() => Promise<manifest>):

new VelaWorkspace('#chart', {
    // …
    engines: { pine: () => new PineEngine() },
    indicators: '/indicators.json', // or an inline [{ name, script | url, language?, enabled? }]
});

Extending (plugin SDK)

Custom chart types, canvas layers and drawing tools register through the public SDK, no fork needed:

import { registerChartType, registerRendererLayer } from '@luxalgo/vela/plugin';

// A new price style: bar transform + optional per-bar data engine + ticker modifier.
registerChartType({
    id: 'renko-like',
    label: 'Renko-like',
    barTransform: { full: (bars) => transformAll(bars), next: (bar) => transformOne(bar) },
});

// A custom canvas layer, painted every frame with the chart (its id = its data channel).
registerRendererLayer({
    id: 'renko-like',
    placement: 'above-data',
    create: () => ({ mount(canvas) {/* keep it */}, render({ bars, data, coords, scale, bounds }) {/* paint */} }),
});

A registered chart type automatically appears in the workspace's style dropdown, and a chart type's dataEngine pushes to its layer's channel with zero extra wiring. A drawing tool registered with defineDrawing joins the drawing toolbar the same way: you describe the shapes it paints, and placement, handles, settings, undo and saving follow. See docs/contributing/plugin-sdk.md.

Documentation

Full documentation lives in docs/: user guides (quickstart, the workspace, options, API reference), architecture, and contributing guides including the plugin SDK.

For coding agents

The package carries what a coding agent needs, versioned with the code: the docs, an llms.txt index, and agent skills (building charts, data providers, indicators and engines, drawing tools, extending with plugins, upgrading, plus the UI kit's three on using, theming and writing components). Give them to your agent with:

npx skills add LuxAlgo/Vela          # from this repository
npx skills experimental_sync         # or: link the ones shipped in node_modules

Development

npm install
npm run playground   # vite playground on http://localhost:5190
npm test             # vitest
npm run build        # tsup → dist/

License and attribution

Vela™ is licensed under the Apache License, Version 2.0 (see LICENSE). The NOTICE file adds an attribution requirement, and redistributions must include it per Apache-2.0 §4(d):

This is the same licensing model used by other popular charting libraries, and we're grateful when the watermark stays in a visible spot.

No scripting engine ships with this package; the Pine Script® addon (@luxalgo/vela-pinets) is AGPL-3.0 and licensed separately (see Indicators).

Vela (LuxAlgo/Vela)

正在搜索数据库…

1.3K ·GitHub
这是什么?Vela 是一个免费开源的库,用于在浏览器中构建高速金融图表,围绕一个无头核心构建,带有原生 WebGL2 渲染器(可回退 canvas2d)和一个插件 SDK,可替换自定义数据、脚本引擎和渲染器。
这是库,还是完整的图表应用?它是模块化的:@luxalgo/vela 是用代码驱动的无头图表核心,@luxalgo/vela/workspace 是现成的完整图表应用(一次调用即可),@luxalgo/vela/ui 是组件套件,@luxalgo/vela/plugin 是扩展 SDK。
怎么把它加进项目?安装 npm 包,然后要么一行调用 workspace 得到完整的图表应用,要么直接驱动无头核心。另外还提供一个自包含的浏览器 bundle(dist/vela.global.js),可以用 script 标签直接引入,无需任何构建步骤。
用它还需要行情数据提供商吗?不一定——Vela 自带 Binance、Coinbase 和 Hyperliquid 的即插即用 provider,但你也可以全部不用,传入自己的 OHLC K 线,实现完全离线运行。
它开箱就支持 Pine Script 吗?不支持——Vela 本身不带任何脚本引擎。Pine Script 支持来自独立的 @luxalgo/vela-pinets 附加组件,它采用 AGPL-3.0(不同于 Vela 本体的 Apache-2.0 核心),因为它运行的是 AGPL 许可的 PineTS 运行时。
Apache-2.0 许可证有什么附加条件?默认情况下每个图表都会显示一个小的 VelaTM 署名水印,NOTICE 文件要求:只有当同一页面的其他位置展示了同等的可见「VelaTM」链接时,你才可以把它关掉。
内置了哪些指标?70 多个内置指标——移动平均、通道带、动量振荡器、趋势和波动率指标、成交量类指标,以及 VWAP、SuperTrend、Pivot Points 等叠加指标——每个都带图例行、设置对话框和状态持久化。
我能加自己的图表类型或渲染层吗?可以,插件 SDK 让你无需 fork 项目就能注册自定义图表类型和 canvas 渲染层;注册的图表类型会自动出现在 workspace 的样式下拉框里。
现成的 workspace 应用都包含什么?一个完整的图表 UI,包括品种/周期/样式/指标顶栏、状态行、底栏(区间、时钟、时区)、对象树、键盘快捷键、命名单元格、同步组,以及一个可持久化的布局状态,全部一次调用即可配好。
开箱自带哪些数据源提供商?Binance、Coinbase 和 Hyperliquid 的 provider 注册即可用,你也可以接入自己的数据源。
作者
LuxAlgo
大小
10.4 MB
星标
1.3K
时长
4个月
提交 · 90 天