correlation-regime
यह क्या करती है
यह स्किल समय के साथ संपत्तियों के एक साथ चलने की ताकत में बदलाव को ट्रैक करती है, और अचानक गिरावट में पहली चलने वाली संपत्ति ढूँढती है। यह जोखिम प्रबंधकों और ट्रेडरों के लिए है जो जानना चाहते हैं कि विविधीकरण कब विफल हो रहा है।
कब इस्तेमाल करें
- ✓जब आप जानना चाहें कि बाज़ार कब बहुत ज़्यादा सहसंबद्ध अवस्था में पहुँचा है।
- ✓जब आप जानना चाहें कि संकट या अचानक गिरावट के दौरान कौन-सी संपत्ति पहले चली।
- ✓जब आप ऐसी संपत्तियाँ पकड़ना चाहें जिनका बाज़ार से रिश्ता चुपचाप बदल गया है।
Skill का लिंक
https://github.com/HKUDS/Vibe-Trading/blob/main/agent/src/skills/correlation-regime/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“क्या हाल में क्रिप्टो बाज़ार बहुत ज़्यादा सहसंबद्ध अवस्था में पहुँचा है, और क्या हाल की गिरावट किसी संपत्ति ने आगे रहकर शुरू की?”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट समय के साथ संपत्तियों के आपसी जुड़ाव को ट्रैक करता है, और हिस्टेरेसिस विधि से अवस्थाएँ चिह्नित करता है, ताकि बार-बार अचानक बदलाव न हों। फिर वह संकट में पहली चलने वाली संपत्तियों को देखता है और हर श्रेय को उसके विश्वास स्तर के साथ लेबल करता है, जिसमें कारण अस्पष्ट होने पर वह यह भी कहता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Correlation-Regime Detection and Crisis Attribution
Overview
The correlation-analysis skill answers "how correlated are these assets?" — a snapshot.
This skill answers the temporal questions a snapshot cannot:
- When did the market fuse into one highly-correlated bloc, and when did it release? (Mode 1 — regime detection)
- What does a fused regime mean for position sizing? (Mode 2 — risk context)
- Who moved first when a crisis broke — is there a nameable trigger asset? (Mode 3 — first-mover attribution)
- Who quietly rewired their relationship to the rest of the market, even without a violent move? (Mode 4 — rewiring leaderboard)
The methodology comes from an open-source streaming pipeline (see References) whose public repository pins the regime machinery's math and an eight-event historical replay regression (COVID, May-2021, China ban, Nov-2021 top, LUNA, FTX, SVB, yen-carry — 17 crypto symbols, 1-minute bars) that its CI reproduces bit-for-bit. The finer-grained numbers quoted in this skill — 13 fused/defused regime cycles on the continuous 2020–2024 tape at a ~0.008/day calm false-alarm rate, and zero wrong culprit names across 10 labeled crises (2 held out-of-sample), including naming FTT roughly two days before the November 2022 collapse — are the author's unpublished internal replays on that same pipeline and are not independently verifiable. All of it is historical replay, never live results, and the method is market-agnostic even though the validation tape is crypto.
What this skill is NOT: a trade-timing signal. The same validation program tested regime-based exits head-to-head against a plain price stop and lost — correlation regimes cannot time tops, and the give-up cost of selling into a crash is a property of the tape, not of any signal. Use these modes for risk context, monitoring, and post-hoc attribution; never present them as buy/sell triggers.
Mode 1: Correlation-Regime Detection (Edge Density + Hysteresis)
Use case: Maintain a live, causal answer to "is the market currently one bloc?" Diversification quietly disappears when pairwise correlations fuse; a regime state machine turns that into an explicit, monitorable state with few false alarms.
Workflow
1. Compute rolling-window pairwise correlations of returns
2. Reduce each correlation matrix to one number: edge density
= fraction of asset pairs with |ρ| ≥ edge_threshold
3. Smooth the density series with a TRAILING window (causal — see warning below)
4. Run a hysteresis (Schmitt-trigger) state machine over the smoothed series:
enter FUSED when density ≥ enter_threshold, exit only when ≤ exit_threshold
5. Emit regime state + transition timestamps for monitoring / reporting
Two thresholds with a dead band between them are the entire trick: a single threshold chatters (fires dozens of times as density oscillates around it), while hysteresis yields a handful of clean regime cycles per market cycle.
import numpy as np
import pandas as pd
def compute_edge_density(
returns: pd.DataFrame,
corr_window: int = 60,
edge_threshold: float = 0.5,
) -> pd.Series:
"""Reduce rolling correlation matrices to an edge-density series.
Edge density is the fraction of distinct asset pairs whose rolling
|correlation| clears ``edge_threshold`` — a scalar "how fused is the
market" gauge in [0, 1].
Args:
returns: Multi-asset return matrix, columns are symbols
corr_window: Rolling window length (bars) for pairwise correlation
edge_threshold: |ρ| level at which a pair counts as an "edge"
Returns:
Edge-density series aligned to ``returns.index`` (NaN during warmup)
"""
n_assets = returns.shape[1]
n_pairs = n_assets * (n_assets - 1) // 2
upper_mask = np.triu(np.ones((n_assets, n_assets), dtype=bool), k=1)
density = pd.Series(np.nan, index=returns.index)
for i in range(corr_window, len(returns) + 1):
corr = returns.iloc[i - corr_window:i].corr().abs().to_numpy()
density.iloc[i - 1] = float((corr[upper_mask] >= edge_threshold).sum()) / n_pairs
return density
def detect_regimes(
density: pd.Series,
smooth_window: int = 5,
enter_threshold: float = 0.65,
exit_threshold: float = 0.45,
) -> pd.DataFrame:
"""Hysteresis (Schmitt-trigger) regime state machine on smoothed density.
The market is FUSED once smoothed density reaches ``enter_threshold`` an
अक्सर पूछे जाने वाले सवाल
जोखिम के लिए बहुत सहसंबद्ध होने का क्या मतलब है?
जब संपत्तियाँ एक साथ चलती हैं, तो विविधीकरण कमज़ोर पड़ता है, इसलिए इस स्किल से एक्सपोज़र समायोजित किया जा सकता है।
क्या यह कह सकती है कि कारण अस्पष्ट था?
हाँ। फ़ैसले को संकट-आधारित, मैक्रो-प्रेरित, अस्पष्ट या सबूत कमज़ोर होने पर परहेज़ के रूप में दिया जा सकता है।
क्या यह भविष्य की ओर देखती है?
नहीं। स्मूदिंग केवल कारण-आधारित है, यानी हर बिंदु पर सिर्फ़ तब उपलब्ध जानकारी इस्तेमाल होती है।
जानकारी
लेखक का मूल विवरण
Correlation-regime detection and crisis attribution — edge-density regime states with hysteresis, causal (no look-ahead) smoothing, regime-aware exposure context, first-mover crisis attribution with honest NAME / MACRO / AMBIGUOUS / ABSTAIN verdicts, and a correlation-rewiring leaderboard that catches slow bleed-outs
repo: HKUDS/Vibe-Trading
लोकप्रियता
- GitHub स्टार
- 37k
- रैंकिंग में स्थान
- #7506
- लाइसेंस
- MIT
- अपडेट की गई
- 1/11/2026
कमेंट
- …
इस repository की और skills
vibe-trading
37kयह आपके एजेंट को वित्त शोध का पूरा टूलकिट देती है, जिसमें बैकटेस्ट, फ़ैक्टर एनालिसिस, ऑप्शन प्राइसिंग और कई बाज़ारों का डेटा शामिल है।
adr-hshare
37kयह आपके एजेंट को दिखाती है कि कई बाज़ारों में लिस्टेड एक चीनी कंपनी के भाव की तुलना कैसे करें, जैसे अमेरिकी ADR और हॉन्गकॉन्ग शेयर।
akshare
37kयह आपके एजेंट को चीनी और वैश्विक शेयरों, फ़्यूचर्स, फ़ॉरेक्स और आर्थिक संकेतकों का मुफ़्त बाज़ार डेटा लेने देती है, बिना API key के।
alpha-zoo
37kयह आपके एजेंट को बने-बनाए स्टॉक फ़ैक्टरों की लाइब्रेरी देखने और चुने हुए बाज़ार पर उनके पूरे समूह के रिटर्न की भविष्यवाणी की क्षमता जाँचने देती है।
मिलती-जुलती skills
gitcrawl
394kयह आपके एजेंट को GitHub issues और pull requests के सेव आर्काइव में खोजने, मिलते-जुलते मामलों को समूह में रखने और लाइव स्थिति जांचने देती है।
slacrawl
394kयह आपके एजेंट को स्थानीय Slack आर्काइव में संदेश खोजने और गिनने, उसकी ताज़गी जांचने और ज़रूरत पड़ने पर उसे ताज़ा करने देती है।
goplaces
394kयह आपके एजेंट को Google Places से जगहें खोजने, उनका विवरण और समीक्षाएं पाने, और जगह के नाम हल करने में मदद करती है, स्क्रिप्ट के लिए JSON आउटपुट के साथ।