Meme 真實性圖層

開源圖表引擎

Meme 真實性圖層

把資料源顯示的內容和真實成交區分開。索引器在沒有兌換的分鐘裡補出的 K 棒畫成空心;頁面當作錯誤報價截斷的影線兩端各有一道短橫,游標停留時提示框顯示原始報價(setBarFlags)。16 個追蹤錢包的最大 300 筆成交以頭像呈現,並跨 K 棒聚合(markerCluster)。點擊「+k」徽章會放大到它涵蓋的 K 棒;點擊頭像會以事件傳回的標記物件開啟該錢包的卡片。你自己的成交畫在實際成交價上(atPrice)。所有資料皆為模擬資料。

Apache-2.0

Meme 真實性圖層:迷因幣與錢包範例

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 萬根 K 線並繪出第一個畫面

WASM · WebGPU

原生載入 1,000 萬根 K 線,含多層級細節金字塔

原生 Rust

平移、縮放與即時串流時每個畫面的堆積記憶體配置次數

穩定狀態

WebAssembly 套件大小(gzip)

包含全部功能

瀏覽器數據:Google Chrome + WebGPU;1,000 萬根 K 線的載入為原生 Rust。長條表示各項數據相對於目標的比例:載入 300 毫秒、零配置、套件 1.5 MB。

範例

313 個範例,
涵蓋 20 個應用情境。

每個範例都是 FerroChart 在你的瀏覽器中即時渲染的圖表,並附上原始碼。所有資料均為模擬資料。

K 線回放
即時串流
K 線 + 成交量
01

價格走勢

25 個範例 →

適用於任何市場的 K 線、棒線與折線,即時串流更新。

深度熱力圖
Delta 足跡圖
足跡圖
04

訂單流

20 個範例 →

足跡圖、深度熱力圖與市場輪廓,走 compute shader 路徑。

隱含波動率 · 基差
多空比 · CVD
資金費率 · 未平倉量 · 清算
06

加密貨幣衍生性商品

15 個範例 →

資金費率、未平倉量、清算與基差,顯示在價格下方的窗格中。

風險逆轉 · 蝶式
到期前的預期波動
隱含與實現波動率 · IV Rank
12

選擇權與波動率

18 個範例 →

隱含波動率與實現波動率對照、偏斜、預期波動幅度與造市商曝險的時間變化。

同步回撤
水下曲線 · 最大回撤
權益曲線 · 回撤
16

投資組合、風險與量化

24 個範例 →

權益曲線、回撤、滾動統計、因子研究與風險檢查。

分組柱狀圖
堆疊柱狀圖
100% 堆疊區域圖
19

自訂系列與外掛

11 個範例 →

堆疊、分組、箱形與筆刷選取系列:在同一個 GPU 影格上疊加圖層外掛。

瀏覽全部 20 個應用情境

價格走勢

K 線類型與轉換

技術分析

訂單流

執行與交易檢討

加密貨幣衍生性商品

鏈上資料

DeFi 與 AMM

迷因幣與錢包

股票與基本面

中國 A 股

選擇權與波動率

利率、外匯與總體經濟

期貨與大宗商品

基金與 ETF

投資組合、風險與量化

私募市場與個人理財

預測市場

自訂系列與外掛

實驗室與旗艦範例

特色

為行情資料而設計。

01

跨平台渲染

同一個 Rust 核心:瀏覽器中使用 WebGPU 與 WebGL2 後端,原生應用程式透過 wgpu 在 Metal、Vulkan 與 DirectX 12 上執行,伺服器上則使用 CPU 渲染器。黃金影像測試確保各後端輸出一致。

02

效能與資料量無關

K 線資料常駐 GPU,座標轉換在著色器中完成,平移與縮放只需更新少量 uniform。多層級細節金字塔讓數千萬根 K 線依然流暢。

03

30 個內建指標

從 SMA 到一目均衡表的均線、通道與震盪指標。每個 tick 增量更新,並以參考資料測試。

04

29 種繪圖工具

趨勢線、通道、費波那契工具、叉子線、江恩角度線、型態、艾略特波浪、區間、部位與文字,支援復原與重做。繪圖與圖表狀態可序列化為 JSON。

05

多圖連動

同步群組可在多個圖表之間連動十字游標與可見範圍。

06

易於擴充

自訂系列、圖層與繪圖工具的外掛介面。提供 JavaScript、Rust 與 Python 繫結,以及供 C#、C++、Qt 與 Flutter 使用的 C ABI。

開始使用

每種語言,同一套 API。

所有繫結都遵循同一模型:建立圖表、加入系列、設定資料、加入指標。資料以欄的形式傳入,可以是型別化陣列、Rust 切片或 DataFrame。

  • JavaScript 與 TypeScript
  • Rust
  • Python 與 Jupyter
  • C、C#、C++
閱讀文件
main.js
$ npm install @ferrochart/core
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

FerroChart

每一個市場。
每一塊螢幕。
同一個引擎。

以 Apache-2.0 開源,從瀏覽器到交易桌。