オープンソースのチャートエンジン
アンカー型・固定範囲プロファイル
2つの出来高プロファイルを、それぞれの時間範囲内に描画します。1つは固定した足の区間、もう1つはスイング高値を起点に最新の足まで伸びるものです。レイヤープラグインが描画し、足をクリックするとアンカーが移動して invalidateLayer で再描画されます。
アンカー型・固定範囲プロファイル:オーダーフローのサンプル
addLayer · chart.on('click') · invalidateLayer
コード
import { FerroChart } from '@ferrochart/core';
const canvas = document.querySelector('canvas');
// Market data: the synthetic FerroChart demo API. Use your own feed.
const chart = await FerroChart.create(canvas, { theme: 'dark' });
const bars = await fetch('/api/bars?symbol=BTCUSD&interval=15m&count=500').then((r) => r.json());
chart.addCandlestickSeries().setData(bars);
// Volume at price over bars [from, to): each bar's volume is spread evenly over
// the rows it spans. Row k covers (lo + k) * row to (lo + k + 1) * row.
function profile(from, to, row) {
const lo = Math.floor(Math.min(...bars.low.slice(from, to)) / row);
const hi = Math.floor(Math.max(...bars.high.slice(from, to)) / row);
const vol = new Array(hi - lo + 1).fill(0);
for (let i = from; i < to; i++) {
const a = Math.floor(bars.low[i] / row) - lo, b = Math.floor(bars.high[i] / row) - lo;
for (let k = a; k <= b; k++) vol[k] += bars.volume[i] / (b - a + 1);
}
// Point of control, then the value area: add the busier neighbour until 70% of the volume.
const total = vol.reduce((s, v) => s + v, 0);
const poc = vol.indexOf(Math.max(...vol));
let up = poc, dn = poc, sum = vol[poc];
while (sum < 0.7 * total) {
const above = vol[up + 1] ?? -1, below = vol[dn - 1] ?? -1;
sum += above >= below ? vol[++up] : vol[--dn];
}
return { lo, row, vol, poc, up, dn };
}
const n = bars.time.length, ROW = 20;
// A fixed range of bars, and a profile anchored at the highest high of the last 300 bars
// that runs to the latest bar. Click a bar to move the anchor.
let anchor = bars.high.indexOf(Math.max(...bars.high.slice(n - 300)), n - 300);
let ranges;
const update = () => {
ranges = [
{ label: 'Fixed range', from: n - 420, to: n - 300, ...profile(n - 420, n - 300, ROW) },
{ label: 'Anchored', from: anchor, to: n, ...profile(anchor, n, ROW) },
];
};
update();
const layer = chart.addLayer({
pane: 0,
position: 'belowSeries',
build(ctx) {
const out = [];
for (const r of ranges) {
const x0 = ctx.timeToX(bars.time[r.from]), x1 = ctx.timeToX(bars.time[r.to - 1]);
if (x0 === null || x1 === null) continue;
const top = ctx.priceToY((r.lo + r.vol.length) * ROW), bottom = ctx.priceToY(r.lo * ROW);
out.push({ type: 'rect', x: x0, y: top, width: x1 - x0, height: bottom - top, color: 'rgba(255, 122, 61, 0.06)' });
out.push({ type: 'text', x: x0 + 4, y: top - 17, text: r.label, color: '#ff9a66', size: 11 });
const max = r.vol[r.poc];
r.vol.forEach((v, k) => {
const y0 = ctx.priceToY((r.lo + k + 1) * ROW), y1 = ctx.priceToY((r.lo + k) * ROW);
const color = k === r.poc ? '#ffb547' : k >= r.dn && k <= r.up ? 'rgba(255, 122, 61, 0.45)' : 'rgba(255, 122, 61, 0.18)';
out.push({ type: 'rect', x: x0, y: y0, width: (v / max) * (x1 - x0) * 0.5, height: Math.max(1, y1 - y0 - 1), color });
});
const poc = ctx.priceToY((r.lo + r.poc + 0.5) * ROW);
out.push({ type: 'line', x1: x0, y1: poc, x2: x1, y2: poc, color: '#ffb547', width: 1, dash: 'dashed' });
}
return out;
},
});
chart.on('click', (e) => {
const i = bars.time.indexOf(e.time);
if (i >= 0 && i < n - 10) { anchor = i; update(); chart.invalidateLayer(layer); }
});
chart.setBarSpacing(2);
chart.scrollToRealtime();ティック単位のデータのために。
Apple M4 Max · Chrome + WebGPUブラウザで 100 万本の足を読み込み、最初のフレームを描画
WASM · WebGPU
ネイティブで 1,000 万本の足を読み込み(LOD ピラミッド構築を含む)
ネイティブ Rust
パン、ズーム、ストリーミング中のフレームあたりのヒープアロケーション
定常状態
WebAssembly パッケージのサイズ(gzip)
全機能込み
ブラウザの数値は Google Chrome + WebGPU、1,000 万本の読み込みはネイティブ Rust での計測です。バーは各数値の目標に対する割合を示します(読み込み 300 ms、アロケーションなし、パッケージ 1.5 MB)。
サンプル
313 のサンプル、
20 のユースケース。
どのサンプルも FerroChart がブラウザ上でリアルタイムに描画するチャートで、ソースコード付きです。データはすべて合成データです。



プライスアクション
25 件のサンプル →あらゆる市場のローソク足、バー、ラインをリアルタイムでストリーミング表示します。



オーダーフロー
20 件のサンプル →フットプリント、板のヒートマップ、マーケットプロファイルをコンピュートシェーダーで描画します。



暗号資産デリバティブ
15 件のサンプル →資金調達率、建玉、清算、ベーシスを価格の下のペインに表示します。



オプションとボラティリティ
18 件のサンプル →インプライド対実現ボラティリティ、スキュー、予想変動幅、ディーラーのエクスポージャーを時系列で表示します。



ポートフォリオ・リスク・クオンツ
24 件のサンプル →資産曲線、ドローダウン、ローリング統計、ファクターリサーチ、リスクチェックを扱います。



カスタムシリーズとプラグイン
11 件のサンプル →積み上げ、グループ、箱ひげ、ブラシ選択のシリーズを、同じGPUフレーム上のレイヤープラグインで描画します。
20 のユースケースをすべて見る
プライスアクション
足の種類と変換
テクニカル分析
オーダーフロー
執行とトレードレビュー
暗号資産デリバティブ
オンチェーン
DeFiとAMM
ミームコインとウォレット
株式とファンダメンタルズ
中国A株
オプションとボラティリティ
金利・為替・マクロ
先物とコモディティ
ファンドとETF
ポートフォリオ・リスク・クオンツ
プライベート市場と個人の資産管理
予測市場
カスタムシリーズとプラグイン
ラボとフラッグシップ
ローソク足と出来高
1 / 25The classic view. A day of real one-minute bars, updating every second, on a GPU-rendered price scale with a volume histogram below. Drag to pan, scroll or pinch to zoom.
FerroChart.createaddCandlestickSeriesaddVolumeSeriesドラッグでパン · ホイールまたはピンチでズーム · ダブルクリックでリセットリアルタイムデータ · OKXcandles
特長
市場データのための設計。
クロスプラットフォームの描画
ひとつの Rust コアで、ブラウザでは WebGPU と WebGL2、ネイティブアプリでは wgpu により Metal、Vulkan、DirectX 12、サーバーでは CPU レンダラーを使います。ゴールデンイメージテストで各バックエンドの出力を揃えています。
データ量に左右されない性能
足のデータは GPU 上に置かれ、座標変換はシェーダーで行うため、パンやズームでは少数の uniform を更新するだけです。LOD ピラミッドにより数千万本の足でも軽快に動きます。
30 の組み込みインジケーター
SMA から一目均衡表まで、移動平均、チャネル、オシレーター。値はティックごとにインクリメンタルに更新され、参照データでテストされています。
29 の描画ツール
トレンドライン、チャネル、フィボナッチ、ピッチフォーク、ギャンファン、パターン、エリオット波動、レンジ、ポジション、テキスト。元に戻す・やり直しに対応し、描画とチャートの状態は JSON に保存できます。
チャートの同期
同期グループで、複数のチャートのクロスヘアと表示範囲を連動させます。
拡張性
カスタムシリーズ、レイヤー、描画ツールのためのプラグインインターフェース。JavaScript、Rust、Python のバインディングと、C#、C++、Qt、Flutter 向けの C ABI を提供します。
はじめる
どの言語でも、同じ API。
どのバインディングも同じモデルです。チャートを作成し、シリーズを追加し、データを設定し、インジケーターを追加します。データは型付き配列、Rust のスライス、DataFrame から列として渡します。
- JavaScript・TypeScript
- Rust
- Python・Jupyter
- C、C#、C++
import { FerroChart } from '@ferrochart/core';
const chart = await FerroChart.create(canvas, { theme: 'dark' });
const candles = chart.addCandlestickSeries();
chart.addVolumeSeries(candles);
candles.setData(bars); // [{ time, open, high, low, close, volume }, ...]
chart.addIndicator(candles, 'ema', { n: 20 });
chart.addIndicator(candles, 'macd'); // in a new pane