jpskill.com
📦 その他 コミュニティ

trading-visualization

ローソク足チャートや資産曲線、ドローダウン、相関ヒートマップ、リターン分布など、プロのトレーダーが使うような高度な取引チャートを視覚的に分かりやすく表示するSkill。

📜 元の英語説明(参考)

Professional trading charts including candlesticks, equity curves, drawdowns, correlation heatmaps, and return distributions

🇯🇵 日本人クリエイター向け解説

一言でいうと

ローソク足チャートや資産曲線、ドローダウン、相関ヒートマップ、リターン分布など、プロのトレーダーが使うような高度な取引チャートを視覚的に分かりやすく表示するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o trading-visualization.zip https://jpskill.com/download/10449.zip && unzip -o trading-visualization.zip && rm trading-visualization.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/10449.zip -OutFile "$d\trading-visualization.zip"; Expand-Archive "$d\trading-visualization.zip" -DestinationPath $d -Force; ri "$d\trading-visualization.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して trading-visualization.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → trading-visualization フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

[Skill 名] trading-visualization

トレーディングの可視化

可視化は、トレーダーとデータ間の主要なインターフェースです。チャートは、表や数値ではわからないパターンを明らかにします。戦略の破綻、レジームの移行、損失の集中、リスクの形状などです。適切に設計されたチャートは、統計の1ページよりも多くの情報を一目で伝えます。

トレーディングチャートの3つの用途:

  1. パターン認識 — 定量的なフィルターが見逃す、価格、出来高、モメンタムの構造的な変化を見抜きます。
  2. 戦略評価 — エクイティカーブ、ドローダウンプロット、およびリターンの分布は、戦略が堅牢であるか、カーブフィッティングであるかを明らかにします。
  3. レポート — パブリケーション品質のビジュアルで、利害関係者、ジャーナル、または将来の自分自身にパフォーマンスを伝えます。

対象となるチャートの種類

チャートの種類 目的 ライブラリ
Candlestick OHLCV の価格変動とオーバーレイ mplfinance
Equity curve 経時的なポートフォリオの価値 matplotlib
Drawdown 水面下の資本プロット matplotlib
Return distribution ヒストグラム + 正規分布適合 matplotlib
Correlation heatmap アセット間の相関行列 matplotlib / seaborn
Trade markers 価格チャート上のエントリー/イグジットポイント mplfinance / matplotlib
Indicator panels 価格チャートの下の RSI, MACD mplfinance
Position timeline ポジションが保持されていた期間 matplotlib

ライブラリ

mplfinance

ローソク足チャートに最適です。matplotlib をベースに、金融に特化したデフォルト設定がされています。

uv pip install mplfinance
import mplfinance as mpf

# DatetimeIndex を持つ DataFrame からの基本的なローソク足
# Columns: Open, High, Low, Close, Volume
mpf.plot(df, type="candle", volume=True, style="charles")

主な機能:

  • ネイティブ OHLCV サポート — DataFrame を直接渡します
  • 組み込みの出来高バー
  • オーバーレイ用の addplot (移動平均、Bollinger Bands)
  • mpf.make_mpf_style() によるカスタムスタイル

matplotlib

汎用性が高く、最も柔軟性があります。レイアウトを完全に制御する必要がある場合に使用します。

uv pip install matplotlib
import matplotlib.pyplot as plt

fig, axes = plt.subplots(2, 1, figsize=(14, 8), height_ratios=[3, 1],
                         sharex=True)
axes[0].plot(dates, equity, color="#00ff88")
axes[1].fill_between(dates, drawdown, 0, color="#ff4444", alpha=0.5)

plotly

HTML としてレンダリングされるインタラクティブなチャートです。探索やダッシュボードに最適です。

uv pip install plotly
import plotly.graph_objects as go

fig = go.Figure(data=[go.Candlestick(
    x=df.index, open=df["Open"], high=df["High"],
    low=df["Low"], close=df["Close"]
)])
fig.update_layout(template="plotly_dark")
fig.write_html("chart.html")

スタイリング: ダークテーマのデフォルト

トレーディングターミナルは、デフォルトで暗い背景を使用します。このスキルのすべてのチャートは、その慣例に従います。

簡単なダークテーマの設定

import matplotlib.pyplot as plt

plt.style.use("dark_background")
plt.rcParams.update({
    "figure.facecolor": "#1a1a2e",
    "axes.facecolor": "#1a1a2e",
    "axes.edgecolor": "#333333",
    "grid.color": "#333333",
    "grid.alpha": 0.4,
    "text.color": "#e0e0e0",
    "xtick.color": "#aaaaaa",
    "ytick.color": "#aaaaaa",
})

トレーディングカラースキーム

要素 Hex
Bullish / profit Green #00ff88
Bearish / loss Red #ff4444
Neutral / info Blue #4488ff
Warning Amber #ffaa00
MA short Orange #ff6600
MA long Blue #3399ff
MA signal Yellow #ffcc00

完全なタイポグラフィ、レイアウト比率、およびエクスポート設定については、references/styling_guide.md を参照してください。


チャート構成: マルチパネルレイアウト

ほとんどのトレーディングチャートは、複数の同期されたパネルを必要とします — 上部に価格、中央に出来高、下部にインジケーター。

X軸を共有する積み重ねられたパネル

import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec

fig = plt.figure(figsize=(14, 10))
gs = gridspec.GridSpec(3, 1, height_ratios=[3, 1, 1], hspace=0.05)

ax_price = fig.add_subplot(gs[0])
ax_volume = fig.add_subplot(gs[1], sharex=ax_price)
ax_rsi = fig.add_subplot(gs[2], sharex=ax_price)

# 上のパネルの x-tick ラベルを非表示にする
ax_price.tick_params(labelbottom=False)
ax_volume.tick_params(labelbottom=False)

パネルの高さの比率

レイアウト 比率 ユースケース
Price + Volume [3, 1] シンプルな OHLCV チャート
Price + Volume + Indicator [3, 1, 1] 標準的な分析ビュー
Equity + Drawdown [2, 1] パフォーマンスレビュー
Price + RSI + MACD [3, 1, 1] 完全なインジケータースタック

オーバーレイ付きのローソク足チャート

import mplfinance as mpf
import pandas as pd

# df: DatetimeIndex, columns Open/High/Low/Close/Volume を持つ DataFrame
ema20 = df["Close"].ewm(span=20).mean()
ema50 = df["Close"].ewm(span=50).mean()

ap = [
    mpf.make_addplot(ema20, color="#ff6600", width=1.2),
    mpf.make_addplot(ema50, color="#3399ff", width=1.2),
]

style = mpf.make_mpf_style(
    base_mpf_style="nightclouds",
    marketcolors=mpf.make_marketcolors(
        up="#00ff88", down="#ff4444",
        wick={"up": "#00ff88", "down": "#ff4444"},
        edge={"up": "#00ff88", "down": "#ff4444"},
        volume={"up": "#00ff88", "down": "#ff4444"},
    ),
    facecolor="#1a1a2e", figcolor="#1a1a2e",
    gridcolor="#333333", gridstyle="--",
)

mpf.plot(df, type="candle", style=style, addplot=ap,
         volume=True, figsize=(14, 8),
         title="Token / SOL — 15m", savefig="candles.png")

ドローダウンパネル付きのエクイティカーブ


import numpy as np
import matplotlib.pyplot as plt

def plot_equity_drawdown(equity: pd.Series, title: str = "Portfolio") -> plt.Figure:
    """Plot equity curve with drawdown panel below."""
    peak = equity.cummax()
    drawdown = (equity - peak) / peak

    fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(14, 8),
                                    height_ratios=[2, 1], sharex=True)
    ax1.plot(equity.index, equity, color="#00ff88", linewidt
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Trading Visualization

Visualization is the primary interface between a trader and their data. Charts reveal patterns that tables and numbers cannot: breakdowns in strategy, regime transitions, clustering of losses, and the shape of risk. A well-designed chart communicates more in a glance than a page of statistics.

Three uses of trading charts:

  1. Pattern recognition — Spot structural changes in price, volume, and momentum that quantitative filters miss.
  2. Strategy evaluation — Equity curves, drawdown plots, and return distributions expose whether a strategy is robust or curve-fit.
  3. Reporting — Communicate performance to stakeholders, journals, or your future self with publication-quality visuals.

Chart Types Covered

Chart Type Purpose Library
Candlestick OHLCV price action with overlays mplfinance
Equity curve Portfolio value over time matplotlib
Drawdown Underwater equity plot matplotlib
Return distribution Histogram + normal fit matplotlib
Correlation heatmap Cross-asset correlation matrix matplotlib / seaborn
Trade markers Entry/exit points on price chart mplfinance / matplotlib
Indicator panels RSI, MACD below price chart mplfinance
Position timeline When positions were held matplotlib

Libraries

mplfinance

Best for candlestick charts. Built on matplotlib with finance-specific defaults.

uv pip install mplfinance
import mplfinance as mpf

# Basic candlestick from a DataFrame with DatetimeIndex
# Columns: Open, High, Low, Close, Volume
mpf.plot(df, type="candle", volume=True, style="charles")

Key features:

  • Native OHLCV support — pass a DataFrame directly
  • Built-in volume bars
  • addplot for overlays (moving averages, Bollinger Bands)
  • Custom styles via mpf.make_mpf_style()

matplotlib

General purpose, most flexible. Use when you need full control over layout.

uv pip install matplotlib
import matplotlib.pyplot as plt

fig, axes = plt.subplots(2, 1, figsize=(14, 8), height_ratios=[3, 1],
                         sharex=True)
axes[0].plot(dates, equity, color="#00ff88")
axes[1].fill_between(dates, drawdown, 0, color="#ff4444", alpha=0.5)

plotly

Interactive charts rendered as HTML. Best for exploration and dashboards.

uv pip install plotly
import plotly.graph_objects as go

fig = go.Figure(data=[go.Candlestick(
    x=df.index, open=df["Open"], high=df["High"],
    low=df["Low"], close=df["Close"]
)])
fig.update_layout(template="plotly_dark")
fig.write_html("chart.html")

Styling: Dark Theme Default

Trading terminals use dark backgrounds by default. All charts in this skill follow that convention.

Quick dark theme setup

import matplotlib.pyplot as plt

plt.style.use("dark_background")
plt.rcParams.update({
    "figure.facecolor": "#1a1a2e",
    "axes.facecolor": "#1a1a2e",
    "axes.edgecolor": "#333333",
    "grid.color": "#333333",
    "grid.alpha": 0.4,
    "text.color": "#e0e0e0",
    "xtick.color": "#aaaaaa",
    "ytick.color": "#aaaaaa",
})

Trading color scheme

Element Color Hex
Bullish / profit Green #00ff88
Bearish / loss Red #ff4444
Neutral / info Blue #4488ff
Warning Amber #ffaa00
MA short Orange #ff6600
MA long Blue #3399ff
MA signal Yellow #ffcc00

See references/styling_guide.md for complete typography, layout ratios, and export settings.


Chart Composition: Multi-Panel Layout

Most trading charts need multiple synchronized panels — price on top, volume in the middle, indicators at the bottom.

Stacked panels with shared x-axis

import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec

fig = plt.figure(figsize=(14, 10))
gs = gridspec.GridSpec(3, 1, height_ratios=[3, 1, 1], hspace=0.05)

ax_price = fig.add_subplot(gs[0])
ax_volume = fig.add_subplot(gs[1], sharex=ax_price)
ax_rsi = fig.add_subplot(gs[2], sharex=ax_price)

# Hide x-tick labels on upper panels
ax_price.tick_params(labelbottom=False)
ax_volume.tick_params(labelbottom=False)

Panel height ratios

Layout Ratios Use Case
Price + Volume [3, 1] Simple OHLCV chart
Price + Volume + Indicator [3, 1, 1] Standard analysis view
Equity + Drawdown [2, 1] Performance review
Price + RSI + MACD [3, 1, 1] Full indicator stack

Candlestick Charts with Overlays

import mplfinance as mpf
import pandas as pd

# df: DataFrame with DatetimeIndex, columns Open/High/Low/Close/Volume
ema20 = df["Close"].ewm(span=20).mean()
ema50 = df["Close"].ewm(span=50).mean()

ap = [
    mpf.make_addplot(ema20, color="#ff6600", width=1.2),
    mpf.make_addplot(ema50, color="#3399ff", width=1.2),
]

style = mpf.make_mpf_style(
    base_mpf_style="nightclouds",
    marketcolors=mpf.make_marketcolors(
        up="#00ff88", down="#ff4444",
        wick={"up": "#00ff88", "down": "#ff4444"},
        edge={"up": "#00ff88", "down": "#ff4444"},
        volume={"up": "#00ff88", "down": "#ff4444"},
    ),
    facecolor="#1a1a2e", figcolor="#1a1a2e",
    gridcolor="#333333", gridstyle="--",
)

mpf.plot(df, type="candle", style=style, addplot=ap,
         volume=True, figsize=(14, 8),
         title="Token / SOL — 15m", savefig="candles.png")

Equity Curve with Drawdown Panel

import numpy as np
import matplotlib.pyplot as plt

def plot_equity_drawdown(equity: pd.Series, title: str = "Portfolio") -> plt.Figure:
    """Plot equity curve with drawdown panel below."""
    peak = equity.cummax()
    drawdown = (equity - peak) / peak

    fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(14, 8),
                                    height_ratios=[2, 1], sharex=True)
    ax1.plot(equity.index, equity, color="#00ff88", linewidth=1.5)
    ax1.plot(equity.index, peak, color="#555555", linewidth=0.8,
             linestyle="--", label="Peak")
    ax1.set_title(title, fontsize=14, fontweight="bold", color="white")
    ax1.set_ylabel("Portfolio Value", fontsize=11)
    ax1.legend(loc="upper left")
    ax1.grid(True, alpha=0.3)

    ax2.fill_between(equity.index, drawdown, 0, color="#ff4444", alpha=0.5)
    ax2.set_ylabel("Drawdown", fontsize=11)
    ax2.set_xlabel("Date", fontsize=11)
    ax2.grid(True, alpha=0.3)

    fig.tight_layout()
    return fig

Return Distribution

from scipy import stats

def plot_return_distribution(returns: pd.Series) -> plt.Figure:
    """Histogram of returns with normal fit and risk metrics."""
    fig, ax = plt.subplots(figsize=(10, 6))

    ax.hist(returns, bins=50, density=True, alpha=0.7,
            color="#4488ff", edgecolor="#333333")

    # Normal fit overlay
    mu, sigma = returns.mean(), returns.std()
    x = np.linspace(returns.min(), returns.max(), 200)
    ax.plot(x, stats.norm.pdf(x, mu, sigma), color="#ffaa00",
            linewidth=2, label=f"Normal(μ={mu:.4f}, σ={sigma:.4f})")

    # VaR line
    var_95 = returns.quantile(0.05)
    ax.axvline(var_95, color="#ff4444", linestyle="--",
               label=f"VaR 95%: {var_95:.4f}")

    ax.set_title("Return Distribution", fontsize=14, fontweight="bold")
    ax.set_xlabel("Return", fontsize=11)
    ax.legend()
    ax.grid(True, alpha=0.3)
    fig.tight_layout()
    return fig

Correlation Heatmap

def plot_correlation_heatmap(returns_df: pd.DataFrame) -> plt.Figure:
    """Correlation matrix heatmap with annotations."""
    corr = returns_df.corr()
    fig, ax = plt.subplots(figsize=(10, 8))
    im = ax.imshow(corr, cmap="RdYlGn", vmin=-1, vmax=1, aspect="auto")

    ax.set_xticks(range(len(corr.columns)))
    ax.set_yticks(range(len(corr.columns)))
    ax.set_xticklabels(corr.columns, rotation=45, ha="right")
    ax.set_yticklabels(corr.columns)

    for i in range(len(corr)):
        for j in range(len(corr)):
            ax.text(j, i, f"{corr.iloc[i, j]:.2f}",
                    ha="center", va="center", fontsize=9,
                    color="black" if abs(corr.iloc[i, j]) < 0.5 else "white")

    fig.colorbar(im, ax=ax, shrink=0.8)
    ax.set_title("Correlation Matrix", fontsize=14, fontweight="bold")
    fig.tight_layout()
    return fig

Trade Markers on Price Chart

def plot_trades_on_price(
    price: pd.Series,
    entries: pd.DataFrame,  # columns: date, price, side
    exits: pd.DataFrame,    # columns: date, price, pnl
) -> plt.Figure:
    """Price chart with entry/exit markers."""
    fig, ax = plt.subplots(figsize=(14, 7))
    ax.plot(price.index, price, color="#aaaaaa", linewidth=1)

    # Entry markers
    buy_mask = entries["side"] == "long"
    ax.scatter(entries.loc[buy_mask, "date"], entries.loc[buy_mask, "price"],
               marker="^", color="#00ff88", s=100, zorder=5, label="Buy")
    ax.scatter(entries.loc[~buy_mask, "date"], entries.loc[~buy_mask, "price"],
               marker="v", color="#ff4444", s=100, zorder=5, label="Short")

    # Exit markers
    win_mask = exits["pnl"] > 0
    ax.scatter(exits.loc[win_mask, "date"], exits.loc[win_mask, "price"],
               marker="x", color="#00ff88", s=80, zorder=5)
    ax.scatter(exits.loc[~win_mask, "date"], exits.loc[~win_mask, "price"],
               marker="x", color="#ff4444", s=80, zorder=5)

    ax.set_title("Trades on Price", fontsize=14, fontweight="bold")
    ax.legend()
    ax.grid(True, alpha=0.3)
    fig.tight_layout()
    return fig

Output Formats

Format Method Use Case
PNG fig.savefig("chart.png", dpi=150) Sharing, embedding
SVG fig.savefig("chart.svg") Editing, scaling
HTML fig.write_html("chart.html") (plotly) Interactive exploration
Inline plt.show() Jupyter notebooks

Saving with dark background

fig.savefig("chart.png", dpi=150, facecolor=fig.get_facecolor(),
            edgecolor="none", bbox_inches="tight")

Integration with Other Skills

Skill Integration
pandas-ta Compute indicators, pass to addplot overlays
vectorbt Extract equity curve and trade list for visualization
portfolio-analytics Plot Sharpe, drawdown, and return metrics
risk-management Visualize position limits and exposure over time
position-sizing Chart position size vs account equity over time
regime-detection Color background by detected market regime
correlation-analysis Generate correlation heatmaps from return data

Files

References

  • references/chart_recipes.md — Complete code recipes for six common chart types
  • references/styling_guide.md — Dark theme setup, colors, typography, layout, and export settings

Scripts

  • scripts/chart_generator.py — Generate four chart types from synthetic data (candlestick, equity, returns, trades)
  • scripts/performance_report.py — Multi-chart performance report with summary statistics