オープンソースのチャートエンジン
表示範囲の出来高プロファイル
画面に表示されている範囲の出来高プロファイルを右端に表示し、POCとバリューエリアの上限・下限をチャート全体に引きます。レイヤープラグインが timeToX で表示中の足を見つけ、毎フレームプロファイルを再構築します。
表示範囲の出来高プロファイル:オーダーフローのサンプル
addLayer · ctx.timeToX · ctx.formatPrice
コード
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=5m&count=2000').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 };
}
// Recomputed every frame for the bars in view, so it follows panning and zooming.
chart.addLayer({
pane: 0,
position: 'belowSeries',
build(ctx) {
const { x, width } = ctx.rect, right = x + width;
let from = -1, to = -1;
bars.time.forEach((t, i) => {
const bx = ctx.timeToX(t);
if (bx !== null && bx >= x && bx <= right) { if (from < 0) from = i; to = i + 1; }
});
if (from < 0) return [];
// About 60 rows over the visible price range, in whole $5.
const span = Math.max(...bars.high.slice(from, to)) - Math.min(...bars.low.slice(from, to));
const p = profile(from, to, 5 * Math.max(1, Math.round(span / 300)));
const out = [], max = p.vol[p.poc];
p.vol.forEach((v, k) => {
const top = ctx.priceToY((p.lo + k + 1) * p.row), bottom = ctx.priceToY((p.lo + k) * p.row);
const w = (v / max) * width * 0.28;
const color = k === p.poc ? 'rgba(255, 181, 71, 0.85)' : k >= p.dn && k <= p.up ? 'rgba(255, 122, 61, 0.35)' : 'rgba(255, 122, 61, 0.14)';
out.push({ type: 'rect', x: right - w, y: top, width: w, height: Math.max(1, bottom - top - 1), color });
});
const level = (price, label, color) => {
const y = ctx.priceToY(price);
out.push({ type: 'line', x1: x, y1: y, x2: right, y2: y, color, width: 1, dash: 'dashed' });
out.push({ type: 'text', x: x + 8, y: y - 8, text: `${label} ${ctx.formatPrice(price)}`, color, size: 11, background: '#12151c', padding: 3 });
};
level((p.lo + p.poc + 0.5) * p.row, 'POC', '#ffb547');
level((p.lo + p.up + 1) * p.row, 'VAH', '#8a93a6');
level((p.lo + p.dn) * p.row, 'VAL', '#8a93a6');
return out;
},
});
chart.setBarSpacing(6);
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