شعار Ml4t Exposure Analysis

Ml4t Exposure Analysis

مؤسسة
ml4t
ml4t-exposure-analysis

Decompose portfolio into factor, sector, and concentration exposures. Use when checking for unintended bets or risk concentrations.

نظرة عامة

الناشرml4t
المستودعskills
اسم المهارةml4t-exposure-analysis
النجوم
45
التفريعات
13
الملفات المرفقة
تعليمات فقط
الترخيصApache-2.0
الروابط
  • تعليمات بصيغة Markdown

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

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

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

  • مكتفية بذاتها

    كل ما يحتاجه النموذج موجود في التعليمات — لا ملفات إضافية لمزامنتها.

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

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

التثبيت

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

1

التثبيت في TypingMind

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

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

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

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

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

استخدمها في TypingMind

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

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

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

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

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

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

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

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

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

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

Exposure Analysis

A portfolio of 50 stocks can look diversified by count while having 80% of its risk in a single factor. Without exposure decomposition, you cannot distinguish between intended alpha bets and unintended factor tilts.

The Problem

Position weights tell you what you own, not what risks you are taking. A "diversified" tech-heavy portfolio may have a market beta of 1.4, a momentum loading of +0.6, and 60% sector concentration in technology - meaning most of its variance comes from three correlated bets, not 50 independent ones. Exposure analysis decomposes portfolio risk into factor loadings, sector weights, and concentration measures so you can verify that the portfolio matches your thesis.

The Pattern

WRONG

python
import numpy as np

# Only look at position weights
weights = np.array([0.05, 0.04, 0.03, ...])  # 50 stocks
print(f"Number of positions: {len(weights)}")
print(f"Max position: {weights.max():.1%}")
# "50 positions, max 5% - looks diversified!"
# But 35 of them are correlated growth stocks with beta > 1.3

CORRECT

python
import numpy as np
from sklearn.linear_model import LinearRegression

# Factor exposure via regression
# portfolio_returns: (T,), factor_returns: (T, K) - market, size, value, momentum
model = LinearRegression().fit(factor_returns, portfolio_returns)
betas = dict(zip(["market", "size", "value", "momentum"], model.coef_))
alpha = model.intercept_ * 252  # annualized

# Concentration: Herfindahl-Hirschman Index
hhi = (weights ** 2).sum()
effective_n = 1.0 / hhi  # equivalent number of equal-weight positions

# Net / gross exposure
net = weights.sum()
gross = np.abs(weights).sum()

print(f"Factor betas: {betas}")
print(f"Annualized alpha: {alpha:.2%}")
print(f"HHI: {hhi:.4f} (effective N={effective_n:.0f})")
print(f"Net: {net:.1%} | Gross: {gross:.1%}")

Sector Concentration

python
def sector_exposure(weights, sectors):
    """Aggregate weights by sector to detect concentration."""
    exposure = {}
    for w, s in zip(weights, sectors):
        exposure[s] = exposure.get(s, 0) + w
    return dict(sorted(exposure.items(), key=lambda x: -abs(x[1])))

# Flag any sector > 30% of gross exposure
for sector, wt in sector_exposure(weights, sectors).items():
    flag = " ** CONCENTRATED **" if abs(wt) > 0.30 else ""
    print(f"  {sector:20s} {wt:+.1%}{flag}")

Rolling Factor Exposures

Factor betas drift over time. Use rolling regression to detect style drift:

python
def rolling_betas(port_ret, factor_ret, window=63):
    """63-day rolling factor loadings."""
    T = len(port_ret)
    betas = np.full((T, factor_ret.shape[1]), np.nan)
    for t in range(window, T):
        model = LinearRegression().fit(
            factor_ret[t - window:t], port_ret[t - window:t])
        betas[t] = model.coef_
    return betas  # plot to see regime changes

Guardrails

  • Factor betas are unstable over short windows - use at least 63 days for daily data
  • Sector weights should align with investment thesis - large unintended tilts signal construction error
  • HHI above 0.10 (effective N < 10) means the portfolio is concentrated regardless of position count
  • Compare exposures to benchmark - net active bets should be intentional

Production Implementation

ml4t-diagnostic provides factor exposure and rolling attribution tools:

python
from ml4t.diagnostic.evaluation.factor import FactorAnalysis, FactorData

factor_data = FactorData.from_dataframe(factors_df, rf_column="RF")
analysis = FactorAnalysis(strategy_returns, factor_data)
static = analysis.static_model()
rolling = analysis.rolling_model(window=63)

Checklist

  • Factor exposures computed (market, size, value, momentum at minimum)
  • Sector/industry concentration measured and flagged if > 30%
  • HHI and effective N reported (not just position count)
  • Net and gross exposure tracked
  • Rolling betas monitored for style drift

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

ماذا تفعل مهارة الذكاء الاصطناعي Ml4t Exposure Analysis؟

Decompose portfolio into factor, sector, and concentration exposures. Use when checking for unintended bets or risk concentrations.

لماذا تستخدم Ml4t Exposure Analysis على TypingMind؟

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

كيف أثبّت Ml4t Exposure Analysis في TypingMind؟

في TypingMind، افتح «الإضافات»، ثم «المهارات»، ثم اختر «التثبيت من GitHub» والصق https://github.com/ml4t/skills/tree/main/portfolio/exposure-analysis. يقرأ TypingMind ملف SKILL.md الخاص بالمهارة ويثبّتها كمهارة يمكنك تفعيلها لكل محادثة على حدة.

ما نماذج الذكاء الاصطناعي التي يمكنها استخدام Ml4t Exposure Analysis؟

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

كم نموذج ذكاء اصطناعي يمكنني استخدامه مع Ml4t Exposure Analysis؟

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

هل مهارة الذكاء الاصطناعي Ml4t Exposure Analysis مجانية؟

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

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

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

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

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

عرض الكل

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

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