オープンソースのチャートエンジン
先物の週末ギャップ
レイヤープラグインが各週末を網掛けし、先物市場の金曜の終値と日曜の再開値の間のギャップを描きます。ここではどちらも24時間取引の現物ローソク足から取っています。価格が金曜の終値まで戻るとギャップは灰色に、まだ開いている間は琥珀色になります。
先物の週末ギャップ:暗号資産デリバティブのサンプル
addLayer · { type: 'rect' } · ctx.priceToY
コード
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=2h&count=900').then((r) => r.json());
// Dated futures close on Friday at 22:00 UTC and reopen on Sunday at 22:00 UTC, while spot
// trades through the weekend: the reopen often gaps away from Friday's close.
const H2 = 2 * 3_600_000; // bar length
const gaps = [];
bars.time.forEach((t, i) => {
const d = new Date(t);
if (d.getUTCDay() !== 0 || d.getUTCHours() !== 22) return;
const fri = bars.time.findIndex((u) => u === t - 2 * 86_400_000 - H2);
if (fri < 0) return;
const close = bars.close[fri], open = bars.open[i];
if (Math.abs(open / close - 1) < 0.004) return;
let filled = null;
for (let j = i; j < bars.time.length && filled === null; j++) {
if (bars.low[j] <= close && bars.high[j] >= close) filled = bars.time[j];
}
gaps.push({ from: bars.time[fri] + H2, reopen: t, filled, lo: Math.min(close, open), hi: Math.max(close, open) });
});
chart.addCandlestickSeries().setData(bars);
chart.addLayer({
pane: 0,
build(ctx) {
const out = [];
const right = ctx.rect.x + ctx.rect.width;
for (const g of gaps) {
const x0 = ctx.timeToX(g.from), x1 = ctx.timeToX(g.reopen);
if (x0 === null || x1 === null || x0 > right) continue;
const x2 = g.filled === null ? right : ctx.timeToX(g.filled);
if (x2 === null || x2 < ctx.rect.x) continue;
const y0 = ctx.priceToY(g.hi), y1 = ctx.priceToY(g.lo);
out.push({ type: 'rect', x: x0, y: ctx.rect.y, width: x1 - x0, height: ctx.rect.height, color: 'rgba(138, 147, 166, 0.07)' });
const open = g.filled === null;
const edge = open ? '#ffb547' : '#5c6577';
out.push({ type: 'rect', x: x0, y: y0, width: x2 - x0, height: Math.max(2, y1 - y0), color: open ? 'rgba(255, 181, 71, 0.16)' : 'rgba(138, 147, 166, 0.16)' });
out.push({ type: 'line', x1: x0, y1: y0, x2, y2: y0, color: edge, width: 1 });
out.push({ type: 'line', x1: x0, y1: y1, x2, y2: y1, color: edge, width: 1 });
const pct = (g.hi / g.lo - 1) * 100;
out.push({ type: 'text', x: x0 + 4, y: y0 - 18, text: `gap ${pct.toFixed(1)}%${open ? ', open' : ', filled'}`, color: edge, size: 10, background: '#0b0d12', padding: 2 });
}
return out;
},
});
chart.setBarSpacing(4.5);
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