オープンソースのチャートエンジン
ミームのリアリティレイヤー
フィードの表示と実際の約定を区別します。インデクサーがスワップのない分を埋めた足は中抜きで、ページが誤ったプリントとして切り詰めたヒゲは両端に短い横線が付き、ツールチップに元の値を表示します(setBarFlags)。追跡している16のウォレットの上位300件の約定はアバターで表示し、足をまたいでクラスタリングします(markerCluster)。「+k」バッジをクリックするとその足の範囲にズームし、アバターをクリックするとイベントが返すマーカーオブジェクトからそのウォレットのカードを開きます。自分の約定は実際の約定価格に表示します(atPrice)。データはすべて合成データです。
ミームのリアリティレイヤー:ミームコインとウォレットのサンプル
setBarFlags · markerCluster · position: 'atPrice' · chart.on('click') · markerHover
コード
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 to = Math.floor(Date.now() / 60_000) * 60_000; // the last whole minute
const from = to - 120 * 60_000;
const range = 'symbol=MEME&from=' + from + '&to=' + to;
const bars = await fetch('/api/bars?interval=1m&' + range).then((r) => r.json());
const trades = await fetch('/api/trades?' + range).then((r) => r.json());
const n = bars.time.length;
// A feed is not the market (synthetic here): the indexer fills quiet minutes
// with flat bars, and a few bad prints leave absurd wicks.
const quiet = [...bars.volume].sort((a, b) => a - b)[Math.floor(n * 0.06)];
const filled = bars.time.map((_, i) => i > 0 && bars.volume[i] <= quiet);
filled.forEach((f, i) => { if (f) bars.open[i] = bars.high[i] = bars.low[i] = bars.close[i] = bars.close[i - 1]; });
[n - 96, n - 58, n - 21].forEach((i, k) => { filled[i] = false; if (k === 1) bars.low[i] *= 0.45; else bars.high[i] *= 1.8; });
// Clip wicks longer than 3 median ranges past the body; keep the raw prints.
const cap = 3 * bars.high.map((h, i) => h - bars.low[i]).sort((a, b) => a - b)[n >> 1];
const raw = new Map(); // bar index -> [high, low] as printed
for (let i = 0; i < n; i++) {
const top = Math.max(bars.open[i], bars.close[i]) + cap, bottom = Math.min(bars.open[i], bars.close[i]) - cap;
if (bars.high[i] <= top && bars.low[i] >= bottom) continue;
raw.set(i, [bars.high[i], bars.low[i]]);
bars.high[i] = Math.min(bars.high[i], top);
bars.low[i] = Math.max(bars.low[i], bottom);
}
const candles = chart.addCandlestickSeries({ markerCluster: 36 }); // one avatar and "+k" per 36 px
candles.setData(bars);
candles.setBarFlags(bars.time.flatMap((time, i) => (filled[i] || raw.has(i) ? [{ time, filled: filled[i], clipped: raw.has(i) }] : [])));
// 16 tracked wallets (synthetic) and the 300 largest trades, attributed to them.
const wallets = ['moonboy', 'gm_capital', 'ape_lord', 'sigma.sol', 'wenlambo', 'quiet_whale', 'degen_daily', 'early_bird',
'chart_wizard', 'delta_fund', 'pump_watch', 'cold_wallet', 'meme_queen', 'alpha_desk', 'ngmi_labs', 'flow_reader']
.map((name, i) => ({ name, kind: i % 2 ? 'Smart' : 'KOL', icon: 'w' + (i + 1), buys: 0, sells: 0, n: 0 }));
await Promise.all(wallets.map((w, i) => chart.registerIcon(w.icon, '/avatars/w' + String(i + 1).padStart(2, '0') + '.png')));
const fills = trades.time
.map((time, i) => ({ time, price: trades.price[i], usd: trades.price[i] * trades.size[i], buy: trades.side[i] > 0, wallet: wallets[(i * 7 + 3) % 16] }))
.sort((a, b) => b.usd - a.usd)
.slice(0, 300);
fills.forEach((f) => { f.wallet.n++; f.wallet[f.buy ? 'buys' : 'sells'] += f.usd; });
// Each marker carries its fill: events hand back the very object.
const markers = fills.map((fill, i) => ({
id: i + 1, fill, time: fill.time, position: fill.buy ? 'belowBar' : 'aboveBar', icon: fill.wallet.icon, size: 18,
color: '#1b1f2a', border: fill.buy ? '#2ee6b6' : '#ff5d73', borderWidth: fill.wallet.kind === 'Smart' ? 3 : 1.5,
}));
// Your own fills, at the price they executed (never clustered).
[0.2, 0.45, 0.7, 0.9].forEach((q, k) => {
const i = Math.floor(q * trades.time.length), buy = k % 2 === 0;
markers.push({ id: 1000 + k, mine: true, time: trades.time[i], position: 'atPrice', price: trades.price[i], shape: 'square',
label: 'ME', size: 16, color: buy ? '#2ee6b6' : '#ff5d73', text: (buy ? 'buy ' : 'sell ') + trades.price[i].toPrecision(4) });
});
candles.setMarkers(markers.sort((a, b) => a.time - b.time));
// Tooltips (hovered marker or flagged bar) and a wallet card (clicked avatar).
const usd = (v) => (v >= 1e6 ? '$' + (v / 1e6).toFixed(1) + 'M' : '$' + (v / 1e3).toFixed(0) + 'k');
let mark = null, bar = null, card = null; // tooltips of a marker and a flagged bar, a wallet card
const box = (ctx, x, y, rows) => {
const width = 16 + Math.max(...rows.map((r) => ctx.textWidth(r, 11)));
const height = 10 + rows.length * 16; // kept inside the plot
x = Math.max(ctx.rect.x, Math.min(x, ctx.rect.x + ctx.rect.width - width));
y = Math.max(ctx.rect.y, Math.min(y, ctx.rect.y + ctx.rect.height - height));
return [{ type: 'rect', x, y, width, height, color: 'rgba(17, 20, 28, 0.92)' },
...rows.map((text, i) => ({ type: 'text', x: x + 8, y: y + 5 + i * 16, text, size: 11, color: i ? '#e6ebf5' : '#8a93a6' }))];
};
const layer = chart.addLayer({ pane: 0, position: 'overlay', build: (ctx) => {
const tip = mark ?? bar;
return [...(card ? box(ctx, ctx.rect.x + 10, ctx.rect.y + 10, card) : []),
...(tip ? box(ctx, tip.x + 14, tip.y - 20, tip.rows) : [])];
} });
chart.on('markerHover', (e) => {
const f = e?.marker.fill;
mark = !e ? null : { x: e.x, y: e.y, rows:
e.overflow ? [e.overflow + ' more trades', 'over ' + (e.bars.to - e.bars.from + 1) + ' min, click to zoom']
: e.marker.mine ? ['your fill', e.marker.text]
: [f.wallet.name + ' (' + f.wallet.kind + ')', (f.buy ? 'buy ' : 'sell ') + usd(f.usd) + ' at ' + f.price.toPrecision(4)] };
chart.invalidateLayer(layer);
});
chart.on('crosshairMove', ({ point }) => {
const i = point ? Math.round(point.logicalIndex) : -1, w = raw.get(i);
const next = w ? ['wick clipped', 'printed high ' + w[0].toPrecision(4) + ', low ' + w[1].toPrecision(4)]
: filled[i] ? ['filled bar', 'no swaps this minute'] : null;
if (next || bar) { bar = next && { x: point.x, y: point.y, rows: next }; chart.invalidateLayer(layer); }
});
chart.on('click', (e) => {
const t = e.target;
if (t?.type === 'markerOverflow') return chart.setVisibleLogicalRange(t.bars.from - 10, t.bars.to + 10);
const w = t?.type === 'marker' && t.marker.fill?.wallet;
card = w ? [w.name + ' (' + w.kind + ')', w.n + ' trades in 2h', 'bought ' + usd(w.buys) + ', sold ' + usd(w.sells), 'net ' + (w.buys >= w.sells ? '+' : '-') + usd(Math.abs(w.buys - w.sells))] : null;
chart.invalidateLayer(layer);
});
chart.setBarSpacing(8);
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