mcpField
S
sentiment-analysis

sentiment-analysis

github.com/agiprolabsデータ・データベース495484 回インストール8 週間前に更新
リポジトリ

sentiment-analysis について

sentiment-analysis は、ソーシャルメディア、ニュース、オンチェーンのシグナルから市場心理を測るスキルです。トレンドや投資家のポジション、極端なセンチメントを追うための指標とスコアリング手法を紹介します。

主な機能

  1. 01ソーシャル・ニュースセンチメント指標
  2. 02言及速度の追跡
  3. 03オンチェーンセンチメント代理指標
  4. 04複合センチメントスコア
  5. 05逆張りシグナルの検出
  6. 06インフルエンサー活動の監視

活用シーン

  1. 01ポジション変更前に群衆心理を確認
  2. 02トークンへの言及急増を検知
  3. 03システム取引戦略にセンチメント指標を統合

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/agiprolabs/claude-trading-skills --skill sentiment-analysis

インストール後、Claude Code で/sentiment-analysisを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

references/
data_sources.md
scoring_methods.md
scripts/
keyword_sentiment.py
sentiment_scanner.py

詳細

センチメント分析

ソーシャルメディア、ニュースフィード、オンチェーンデータから市場センチメントを抽出して定量化し、群衆のポジション状況や逆張りの機会を特定します。

このスキルを使用する場面

  • ポジションのエントリーまたは決済前に、群衆のセンチメントを把握する
  • 反転に先行する陶酔感やパニックの極端な状態を検出する
  • ソーシャルメディアでの言及頻度の変化を監視し、トレンドを早期に検出する
  • 特定のトークンに関するインフルエンサーの活動を追跡する
  • システマティック戦略向けに複合センチメントスコアを構築する

基本概念

センチメントデータソース
ソースデータの種類アクセス方法
Twitter/X投稿テキスト、エンゲージメント、フォロワー数API(有料プラン)
Redditサブレディットの投稿、コメント、アップボートReddit API
Telegramチャンネルのメッセージ、メンバー数Bot API またはスクレイピング
Discordサーバーのアクティビティ、メッセージ量Bot 統合
ニュース見出し、記事テキストNewsAPI、RSS フィード
CoinGeckoコミュニティ統計、開発者の活動無料 API
Alternative.meFear & Greed Index無料 API
オンチェーン資金調達率、取引所フロー取引所 API

各ソースの API の詳細、レート制限、アクセスパターンについては、references/data_sources.md を参照してください。

センチメント指標

言及頻度の変化 — 時間経過に伴うトークンの言及率:

mention_velocity = mentions_last_hour / baseline_hourly_mentions
# > 3.0 = trending, > 10.0 = viral

センチメントの極性 — 肯定的なトーンと否定的なトーンの比較:

polarity = (positive_count - negative_count) / total_count
# Range: -1.0 (all negative) to +1.0 (all positive)

Fear & Greed Index — 市場心理の複合指標(0~100):

範囲ラベル典型的なシグナル
0-24極度の恐怖蓄積ゾーンの可能性
25-44恐怖平均を下回るセンチメント
45-55中立明確な方向性の偏りなし
56-74強欲平均を上回るセンチメント
75-100極度の強欲分配ゾーンの可能性

ソーシャルボリューム — プラットフォーム全体の総言及数:

social_volume_z = (current_volume - mean_30d) / std_30d
# z > 2.0 suggests unusual activity
オンチェーンのセンチメント代理指標

オンチェーンデータからは、参加者が何を言っているかだけでなく、何をしているかが分かります。

資金調達率 — 無期限先物のキャリーコスト:

# Positive funding = longs pay shorts (bullish crowding)
# Negative funding = shorts pay longs (bearish crowding)
funding_sentiment = -1.0 * normalize(funding_rate, -0.1, 0.1)
# Inverted: high positive funding is contrarian bearish

ロング/ショート比率 — レバレッジポジションの割合:

ls_ratio = long_accounts / short_accounts
# > 2.0 = crowded long, < 0.5 = crowded short
ls_sentiment = -1.0 * normalize(ls_ratio, 0.5, 2.0)

取引所フロー — 純入金額/純出金額:

net_flow = exchange_inflows - exchange_outflows
# Positive net flow (deposits) = bearish (selling pressure)
# Negative net flow (withdrawals) = bullish (accumulation)
flow_sentiment = -1.0 * normalize(net_flow, -threshold, threshold)
キーワードベースのセンチメントスコアリング

厳選した単語リストを使用する、LLM 不要のシンプルな方法:

BULLISH_KEYWORDS = {
    "moon": 2, "bullish": 2, "pump": 1, "breakout": 2,
    "buy": 1, "long": 1, "accumulate": 2, "undervalued": 2,
    "gem": 1, "rocket": 1, "ath": 1, "rally": 2,
}
BEARISH_KEYWORDS = {
    "dump": 2, "bearish": 2, "crash": 2, "scam": 3,
    "rug": 3, "sell": 1, "short": 1, "overvalued": 2,
    "dead": 2, "rekt": 1, "ponzi": 3, "exit": 1,
}

def score_text(text: str) -> float:
    """Score text from -1.0 (bearish) to +1.0 (bullish)."""
    words = text.lower().split()
    bull_score = sum(BULLISH_KEYWORDS.get(w, 0) for w in words)
    bear_score = sum(BEARISH_KEYWORDS.get(w, 0) for w in words)
    total = bull_score + bear_score
    if total == 0:
        return 0.0
    return (bull_score - bear_score) / total

完全な手法、時間減衰による重み付け、複合スコアの構築については、references/scoring_methods.md を参照してください。

複合センチメントスコア

複数のシグナルを単一のスコアにまとめます。

def composite_sentiment(
    social_polarity: float,    # -1.0 to +1.0
    mention_velocity: float,   # 0 to inf
    fear_greed: int,           # 0 to 100
    funding_rate: float,       # -0.1 to +0.1
    weights: dict | None = None,
) -> float:
    """Compute weighted composite sentiment score (-100 to +100).

    Args:
        social_polarity: Average polarity of social mentions.
        mention_velocity: Current velocity vs baseline.
        fear_greed: Fear & Greed index reading.
        funding_rate: Current perpetual funding rate.
        weights: Optional custom weights.

    Returns:
        Composite score from -100 (extreme fear) to +100 (extreme greed).
    """
    w = weights or {
        "social": 0.30,
        "velocity": 0.15,
        "fear_greed": 0.30,
        "funding": 0.25,
    }
    # Normalize each component to -1.0 to +1.0
    s_social = social_polarity
    s_velocity = min(mention_velocity / 10.0, 1.0)  # Cap at 10x
    s_fg = (fear_greed - 50) / 50.0  # 0-100 -> -1 to +1
    s_funding = -10.0 * funding_rate  # Contrarian: high funding = bearish
    s_funding = max(-1.0, min(1.0, s_funding))

    raw = (
        w["social"] * s_social
        + w["velocity"] * s_velocity
        + w["fear_greed"] * s_fg
        + w["funding"] * s_funding
    )
    return round(raw * 100, 1)
逆張りシグナル

センチメントが極端な値を示すと、反転に先行することがよくあります。

条件解釈
Composite < -70極度の恐怖 — 過去の傾向では買いゾーン
Composite > +70極度の強欲 — 過去の傾向では売りゾーン
Velocity > 10x + polarity > 0.6陶酔感を伴う急上昇 — 逆張りの可能性
Velocity > 10x + polarity < -0.6パニックによる急落 — 反発の可能性
Funding > 0.05% + LS ratio > 2.0ロングに偏りすぎ — 清算リスク
Funding < -0.05% + LS ratio < 0.5ショートに偏りすぎ — 踏み上げリスク

重要な原則:センチメントが極端なときに、最も有用な情報が得られます。中立的な値(複合スコアが -30~+30)は、予測力が低い傾向にあります。

インフルエンサーの追跡

フォロワー数の多いアカウントを監視し、シグナルを早期に検出します。

def influencer_signal(
    posts: list[dict],
    min_followers: int = 50_000,
    lookback_hours: int = 24,
) -> dict:
    """Detect influencer activity around a token.

    Args:
        posts: List of posts with 'followers', 'timestamp', 'sentiment'.
        min_followers: Minimum follower count to qualify as influencer.
        lookback_hours: Time window in hours.

    Returns:
        Dict with influencer_count, avg_sentiment, total_reach.
    """
    cutoff = time.time() - (lookback_hours * 3600)
    relevant = [
        p for p in posts
        if p["followers"] >= min_followers and p["timestamp"] >= cutoff
    ]
    if not relevant:
        return {"influencer_count": 0, "avg_sentiment": 0.0, "total_reach": 0}
    return {
        "influencer_count": len(relevant),
        "avg_sentiment": sum(p["sentiment"] for p in relevant) / len(relevant),
        "total_reach": sum(p["followers"] for p in relevant),
    }

他のスキルとの連携

スキル連携ポイント
position-sizing極度の強欲時にはサイズを縮小し、極度の恐怖時には拡大する
risk-managementセンチメントが価格と乖離したときにストップを厳しくする
regime-detectionセンチメントを使ってレジーム分類を裏付ける、または否定する
feature-engineeringセンチメント指標を ML の特徴量として利用する
signal-classificationセンチメントをシグナルスコアリングモデルの入力として利用する
whale-trackingクジラの活動とソーシャルセンチメントを組み合わせる
token-holder-analysis保有者の増減をセンチメントの代理指標として利用する

実践的なワークフロー

1. Fetch fear/greed index          → Market-wide mood
2. Pull social data for token      → Token-specific sentiment
3. Score text with keyword method  → Polarity scores
4. Compute mention velocity        → Trending detection
5. Check on-chain proxies          → Funding, flows
6. Calculate composite score       → Single decision input
7. Flag contrarian signals         → Extreme readings
8. Integrate with position sizing  → Adjust allocation

制限事項と警告

  • センチメントにはノイズがあります。 個々の値は信頼性が低いため、傾向や極端な値を活用してください。
  • ソーシャルデータは操作可能です。 ボットの活動によって言及数が水増しされる可能性があります。
  • キーワードによるスコアリングは大まかです。 皮肉、文脈、ニュアンスを捉えられません。
  • タイムラグがあります。 センチメントを測定できる頃には、価格がすでに変動している可能性があります。
  • 金融アドバイスではありません。 センチメントデータは、情報提供および分析のみを目的としています。
  • API へのアクセス条件は変わります。 Twitter/X API の料金は頻繁に変更されています。それに応じて予算を設定してください。
  • 生存者バイアスがあります。 ゼロになったトークンは話題にされなくなるため、言及がないこともシグナルです。

ファイル

リファレンス
  • references/data_sources.md — すべてのセンチメントデータソースの API 詳細、レート制限、アクセス方法
  • references/scoring_methods.md — キーワードリスト、複合スコアリング手法、時間経過による減衰、逆張りロジック
スクリプト
  • scripts/sentiment_scanner.py — 無料 API からリアルタイムのセンチメントデータを取得し、複合スコアを計算して、逆張りシグナルにフラグを付けます
  • scripts/keyword_sentiment.py — 合成デモデータを使った、キーワードベースのスタンドアロンテキストセンチメント分析ツール

コメント