شعار Correlation Aware Exposure Limits

Correlation Aware Exposure Limits

المجتمع
HimanshuJ16
correlation-aware-exposure-limits

استخدمه عندما تضم المحفظة عدة أدوات تتأثر بعامل القطاع أو العامل الاقتصادي الكلي نفسه، فتُخفي الحدود المفروضة على كل رمز حجم التركّز الفعلي. يجمع الأدوات في مجموعات حسب الارتباط الثنائي، ويضع حدًا لإجمالي الانكشاف لكل مجموعة.

Add to TypingMind

نظرة عامة

الناشرHimanshuJ16
المستودعAlgo-Trading-Skills
اسم المهارةcorrelation-aware-exposure-limits
النجوم
50
التفريعات
7
الملفات المرفقة
5
الترخيصApache-2.0
الروابط
  • تعليمات بصيغة Markdown

    ملف SKILL.md يُحمّله النموذج عند الحاجة، فلا يستهلك توكنات إلا عندما يَرِد طلب ذو صلة فعلًا.

  • تعمل مع أي نموذج لغوي كبير

    مهارات الذكاء الاصطناعي مكتوبة بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا تعمل مع GPT أو Claude أو Gemini أو Grok أو نموذج محلي.

  • الملفات المرفقة: 5

    نصوص برمجية وقوالب ومراجع يمكن للنموذج قراءتها أثناء عمله. الملفات للقراءة فقط ولا تُنفّذ أبدًا.

  • مفتوحة المصدر

    نشرها HimanshuJ16 على GitHub. اطّلع على المصدر قبل تثبيتها.

التثبيت

ثبّت مهارة الذكاء الاصطناعي Correlation Aware Exposure Limits في TypingMind لاستخدامها مع أي نموذج لغوي كبير، أو أضفها إلى وكيل ذكاء اصطناعي آخر يقرأ SKILL.md.

1

التثبيت في TypingMind

يُثبّت TypingMind المهارة مباشرةً من مجلدها على GitHub — فيقرأ SKILL.md، ويجمع ملفات الموارد في حزمة، ويحفظ النتيجة محليًا.

  1. افتح التطبيق وانتقل إلى «الإضافات» ثم «المهارات».
  2. اختر «تثبيت من GitHub».
  3. الصق رابط مجلد المهارة الموضّح أدناه وأكّد التثبيت.
    https://github.com/HimanshuJ16/Algo-Trading-Skills/tree/main/skills/correlation-aware-exposure-limits
  4. فعّل المهارة في كل محادثة تريد إتاحتها فيها.
الإضافات ← المهارات ← إضافة مهارة ← من رابط GitHub، ثم الصق رابط المجلد واضغط على «متابعة».
2

التثبيت في وكيل ذكاء اصطناعي آخر

يمكن لأي وكيل ذكاء اصطناعي يقرأ تنسيق Agent Skills استخدام هذه المهارة — انسخ المجلد إلى مجلد المهارات الخاص بذلك الوكيل.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/HimanshuJ16/Algo-Trading-Skills.git /tmp/Algo-Trading-Skills
mkdir -p .claude/skills
cp -r /tmp/Algo-Trading-Skills/skills/correlation-aware-exposure-limits .claude/skills/correlation-aware-exposure-limits
أعد تشغيل Claude Code بعد النسخ ليتعرّف على المهارة الجديدة.

استخدمها في TypingMind

فعّل Correlation Aware Exposure Limits في أي محادثة على TypingMind وسيتولى النموذج الباقي. تتضمن مطالبة النظام اسمها ووصفها، وبمجرد ورود طلب ذي صلة، يُحمّل النموذج التعليمات الكاملة تلقائيًا — فلا تحتاج إلى استدعائها يدويًا، ولا تستهلك أي توكنات حتى تُستخدم فعليًا.

يُحمّل النموذج مهارة Correlation Aware Exposure Limits تلقائيًا بمجرد ورود طلب ذي صلة بها.

تعمل مع أي نموذج ذكاء اصطناعي

مهارات الذكاء الاصطناعي هي تعليمات بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا لا ترتبط Correlation Aware Exposure Limits بالنموذج الذي كُتبت له. ثبّتها مرة واحدة في TypingMind واستخدمها مع GPT-5 أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو نموذج محلي تشغّله بنفسك — كل ذلك باستخدام مفاتيح API الخاصة بك.

  • تُحمَّل عند الحاجة فقط

    تتضمن مطالبة النظام الاسم والوصف فقط. وتُجلب التعليمات عند أول طلب ذي صلة، لذا لا تستهلك تعليمات المهارة أي توكنات ما دامت المهارة غير مستخدمة.

  • بدّل النماذج أثناء المحادثة

    لأن المهارة تعليمات وليست شيفرة، فإن تغيير النموذج لا يعطّلها — فالنموذج التالي يقرأ ملف SKILL.md نفسه.

تعليمات المهارة

هذا هو محتوى SKILL.md الذي يُحمّله النموذج. اقرأه قبل التثبيت — فالمهارة عبارة عن تعليمات سيتبعها نموذجك.

When to Use

Invoke this whenever a portfolio trades multiple instruments within the same sector, asset class, or macro factor (e.g., holding multiple tech stocks NVDA, AMD, MSFT, or crypto assets BTC, ETH, SOL). Setting individual position limits per ticker alone creates hidden concentration risk: when correlated instruments fall in tandem during market sell-offs, total portfolio drawdown spikes unexpectedly. Estimating rolling return correlation matrices ($C_{i,j}$), grouping instruments into correlated clusters ($\rho \ge 0.70$), and capping total cluster exposure (e.g. $\le 30%$ NAV) before approving order executions is mandatory.

When NOT to Use

  • As the only pre-trade control. Cluster caps bound concentration, not leverage, margin adequacy, drawdown, or per-symbol size. Compose with the risk skills under Related Skills; SEC Rule 15c3-5 expects a control suite, not a single check.
  • When the correlation estimate cannot be trusted. Fewer than ~30 overlapping returns, a newly listed instrument, or a regime break makes the Pearson estimate too noisy to cluster on. The module fails closed on a missing matrix, but it cannot detect a statistically weak one — widen the lookback or fall back to sector-only clustering.
  • For linear factor-risk budgeting. Connected-component clustering answers "which names move together enough to share a cap," not "how much of my variance is one factor." Use a factor/covariance model for the latter; a single 0.70 edge can chain a long clustering chain into one pocket.
  • As a substitute for netting-aware margin math. Exposure here is deliberately GROSS, so it will not match broker margin, which does grant offsets. Do not drive collateral decisions from these numbers.
  • For a single-instrument or deliberately paired mandate, unless caps are set to what the mandate actually authorises.

Prerequisites

  • Historical return series for portfolio instruments over rolling lookback window (e.g. 60 days).
  • Defined correlation threshold $\rho_{\text{threshold}}$ (default 0.70).
  • Defined maximum allowed cluster exposure cap, expressed as an absolute notional (default 1,000,000; convert a NAV-percentage policy to notional as $\text{cap} = \text{pct} \times \text{NAV}$ at construction time).

Workflow

  1. Estimate Rolling Correlation Matrix:

    • Compute pairwise Pearson correlation matrix $C$ over historical return vectors $R_1, R_2, \dots, R_K$: $$C_{i,j} = \frac{\text{Cov}(R_i, R_j)}{\sigma_i \cdot \sigma_j}$$
    • Price series must be chronological, positive, finite, and date-aligned at their most recent point; differing lengths are correlated over their most recent overlapping returns. Bad data (zero/negative/NaN prices) is rejected, never silently correlated.
  2. Form Correlation Clusters:

    • Group assets into connected clusters $G_1, G_2, \dots, G_m$ where pairwise correlation $C_{i,j} \ge \rho_{\text{threshold}}$ (transitively: A–B and B–C at threshold join A, B, C even if A–C is below). Symbols sharing a sector_mapping label are forced into one cluster regardless of measured correlation — sector co-membership is treated as one risk pocket.
  3. Compute Current Cluster Exposures:

    • Calculate current GROSS dollar exposure for cluster $k$ (sum of absolute notionals; netting longs against shorts inside a correlated cluster is deliberately not done, because correlations converge in stress and the hedge fails exactly when it matters): $$\text{Exposure}(G_k) = \sum_{i \in G_k} |w_i \cdot \text{Position}_i|$$ where $w_i$ is the underlying delta (options delta-adjusted to underlying-equivalent exposure). Divide by NAV for a percentage view.
  4. Validate Proposed Order Execution:

    • Fail closed: if no correlation matrix has been built, evaluation raises — never approve orders against silently-empty clusters. A stale matrix (default > 7 days) either warns or blocks, per stale_matrix_policy.
    • Check the aggregate portfolio cap on post-trade GROSS notional, counting the proposed leg even when the symbol is not yet in the book — an opening order in a fresh symbol must consume portfolio headroom like any other. This cap is raw notional (not delta-adjusted); the cluster cap below is delta-adjusted.
    • For a proposed signed increment $V_{\text{proposed}}$ on symbol $i$, compute the exact post-trade cluster exposure: $\text{Exposure}(G_k) + |V_{\text{proposed}}|$ for a new position, or $|\text{Position}i + V{\text{proposed}}|$ netting against an existing one — risk-REDUCING orders are never vetoed, even when a cluster is already over cap (they are approved with a remediation flag).
    • If post-trade exposure exceeds the cap and the order does not reduce it, veto with RiskCheckResult(approved=False); allowed_notional carries the indicative downsized size.

Full step-by-step procedure with broker-specific detail: see references/workflows.md. Broker/framework coverage table for this skill: see references/standards.md. Printable pre-flight checklist: see assets/checklist.md.

Common Pitfalls

  • Per-Ticker Limit Blind Spot: Assuming single-ticker limits (e.g. 5% per stock) prevent risk concentration across 8 tech stocks (40% total tech exposure).
  • Static Correlation Assumptions: Using static historical correlations without updating rolling matrices, missing correlation breakdown during market crashes.
  • Fail-Open Risk Gates: Approving orders when the correlation matrix is missing or stale turns every symbol into an uncorrelated singleton and silently disables cluster limits. Missing matrix must block; stale matrix should block in production (stale_matrix_policy="block").
  • Vetoing De-Risking Orders: Adding $|V_{\text{proposed}}|$ on top of current exposure vetoes position REDUCTIONS when a cluster sits near its cap. Net the increment against the existing position and only block exposure-increasing orders.
  • Asymmetric Delta Treatment: Delta-adjusting the proposed option order but counting existing options at full notional overstates exposure — apply underlying delta weights to both sides.
  • Netting Longs Against Shorts in a Cluster: Netted cluster exposure assumes the correlation hedge holds through the crash; gross (sum of absolute) exposure is the conservative basis for concentration caps.
  • Misaligned Return Windows: Correlating truncated prefixes of different-length histories compares returns from different dates. Align on the most recent overlapping returns, and reject (don't skip) bad price data.
  • Aggregate Cap Blind to New Positions: Computing the post-trade portfolio total by iterating only over symbols already held silently exempts every opening order from the aggregate cap — the book grows past the limit one new symbol at a time while each individual cluster check still passes. Count the proposed leg explicitly when the symbol is absent from the current book.
  • Check-Then-Trade Races: two concurrent orders can each pass against the same cap and jointly breach it. The manager serializes its own matrix/audit state, but the caller must serialize check-then-place sequences when orders can arrive from multiple threads.

Verification

  • Submit returns for highly correlated assets (NVDA & AMD, $\rho = 0.85$) and verify CorrelationExposureManager groups them into the same cluster.
  • Submit proposed order that breaches the cluster notional limit and verify it is vetoed: RiskCheckResult(approved=False) with the indicative allowed_notional for downsizing.
  • Verify an opening order in a symbol not yet held is vetoed when it would push post-trade portfolio gross notional past max_portfolio_notional.
  • Verify a risk-reducing order on an at-cap cluster is approved, and that evaluating any order before update_correlation_matrix() raises CorrelationMatrixUnavailableError.
  • Run unit test suite python -m unittest discover -s skills/correlation-aware-exposure-limits/scripts and confirm 100% pass rate.

Related Skills

  • broker-account-margin-call-handling
  • survivorship-bias-free-universe-construction
  • ensemble-signal-combination-without-overfitting

الملفات المرفقة

يقرأ النموذج هذه الملفات عند الحاجة ما دامت المهارة محمّلة. وهي متاحة للقراءة ولا تُنفّذ أبدًا.

الأسئلة الشائعة

ماذا تفعل مهارة الذكاء الاصطناعي Correlation Aware Exposure Limits؟

استخدمه عندما تضم المحفظة عدة أدوات تتأثر بعامل القطاع أو العامل الاقتصادي الكلي نفسه، فتُخفي الحدود المفروضة على كل رمز حجم التركّز الفعلي. يجمع الأدوات في مجموعات حسب الارتباط الثنائي، ويضع حدًا لإجمالي الانكشاف لكل مجموعة.

لماذا تستخدم Correlation Aware Exposure Limits على TypingMind؟

لأنك تثبّتها مرة واحدة وتستخدمها مع أي نموذج. مهارة Correlation Aware Exposure Limits عبارة عن نص Markdown وليست شيفرة خاصة بمزود بعينه، لذا تعمل المهارة نفسها مع GPT-5 أو Claude أو Gemini أو Grok أو نموذج محلي، ويمكنك تبديل النموذج أثناء المحادثة دون تعطّل المهارة. يعمل TypingMind بمفاتيح API الخاصة بك، فتدفع للمزودين مباشرةً بدلًا من اشتراك لكل مقعد، وتبقى مهاراتك ومحادثاتك في مساحة التخزين الخاصة بك.

كيف أثبّت Correlation Aware Exposure Limits في TypingMind؟

في TypingMind، افتح «الإضافات»، ثم «المهارات»، ثم اختر «التثبيت من GitHub» والصق https://github.com/HimanshuJ16/Algo-Trading-Skills/tree/main/skills/correlation-aware-exposure-limits. يقرأ TypingMind ملف SKILL.md الخاص بالمهارة، ويجمع ملفاتها ويثبّتها كمهارة يمكنك تفعيلها لكل محادثة على حدة.

ما نماذج الذكاء الاصطناعي التي يمكنها استخدام Correlation Aware Exposure Limits؟

أي نموذج تربطه في TypingMind. مهارات الذكاء الاصطناعي عبارة عن تعليمات Markdown وليست شيفرة خاصة بمزود بعينه، لذا يمكن لكل من GPT وClaude وGemini وGrok والنماذج المحلية تحميل هذه المهارة عندما يتوافق الطلب معها.

كم نموذج ذكاء اصطناعي يمكنني استخدامه مع Correlation Aware Exposure Limits؟

أي عدد تريده. ما دام النموذج يدعم المهارات، يمكنك استخدام Correlation Aware Exposure Limits معه، سواء كان GPT أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو غيرها، وكل ذلك على TypingMind باستخدام مفاتيح API الخاصة بك.

هل مهارة الذكاء الاصطناعي Correlation Aware Exposure Limits مجانية؟

نعم. نشرها HimanshuJ16 على GitHub بموجب ترخيص Apache-2.0. لا تدفع إلا لمزود الذكاء الاصطناعي الخاص بك مقابل التوكنات التي تستخدمها.

ما هي مهارات الذكاء الاصطناعي؟

مهارة الذكاء الاصطناعي حزمة تعليمات قابلة لإعادة الاستخدام تعلّم نموذج الذكاء الاصطناعي كيفية تنفيذ مهمة محددة. وتتبع تنسيق Agent Skills المفتوح: ملف SKILL.md يتضمن اسمًا ووصفًا، إلى جانب أي نصوص برمجية أو قوالب أو ملفات مرجعية قد يحتاج إليها النموذج. لا يقرأ النموذج التعليمات إلا عندما يتوافق طلبك مع المهارة، لذا لا تترتب على المهارة المثبتة أي تكلفة حتى تُستخدم.

كيف تختلف مهارات الذكاء الاصطناعي عن الإضافات أو موصلات MCP؟

تمنح الإضافة أو موصل MCP النموذج أدوات جديدة يمكنه استدعاؤها، وهي شيفرة تُنفَّذ في مكان ما وتُرجع نتيجة. أما مهارة الذكاء الاصطناعي فتزوّد النموذج بالمعرفة ومنهجية العمل: كيفية التعامل مع مهمة، والخطوات التي ينبغي اتباعها، وما ينبغي أن تكون عليه المخرجات الجيدة. المهارات عبارة عن نصوص Markdown، لذا لا تحتاج إلى خادم أو مفتاح API أو بيئة تشغيل، وتعمل مع أي نموذج.

عرض الكل

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا الإخبارية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇