شعار Backtesting Ml Models Against Transaction Costs

Backtesting Ml Models Against Transaction Costs

المجتمع
HimanshuJ16
backtesting-ml-models-against-transaction-costs

استخدمه عندما يغيّر نموذج ML توقعه مع كل شريط تقريبًا ويعتمد Sharpe على معدل دوران التداول؛ فهو يطبّق تكاليف على كل عملية دوران ويستخدم حدًا أدنى للثقة قبل تقييم الاستراتيجية. أما إسناد التكاليف على مستوى الأوامر فيندرج ضمن transaction-cost-analysis-tca-integration.

Add to TypingMind

نظرة عامة

الناشرHimanshuJ16
المستودعAlgo-Trading-Skills
اسم المهارةbacktesting-ml-models-against-transaction-costs
النجوم
50
التفريعات
7
الملفات المرفقة
5
الترخيصApache-2.0
الروابط
  • تعليمات بصيغة Markdown

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

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

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

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

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

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

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

التثبيت

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

1

التثبيت في TypingMind

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

  1. افتح التطبيق وانتقل إلى «الإضافات» ثم «المهارات».
  2. اختر «تثبيت من GitHub».
  3. الصق رابط مجلد المهارة الموضّح أدناه وأكّد التثبيت.
    https://github.com/HimanshuJ16/Algo-Trading-Skills/tree/main/skills/backtesting-ml-models-against-transaction-costs
  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/backtesting-ml-models-against-transaction-costs .claude/skills/backtesting-ml-models-against-transaction-costs
أعد تشغيل Claude Code بعد النسخ ليتعرّف على المهارة الجديدة.

استخدمها في TypingMind

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

يُحمّل النموذج مهارة Backtesting Ml Models Against Transaction Costs تلقائيًا بمجرد ورود طلب ذي صلة بها.

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

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

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

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

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

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

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

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

When to Use

Machine learning models inherently generate highly active signals (e.g., changing predictions from slightly positive to slightly negative on every bar). Without strict Transaction Cost Analysis (TCA) and confidence thresholding, these models achieve massive theoretical Sharpe ratios that instantly collapse in live trading due to Turnover Drag. Invoke this skill to evaluate ML model predictions against realistic slippage and commission models, filtering out low-confidence trades that do not cover their own execution costs.

When NOT to Use

  • Order-level cost attribution. This skill models cost as a flat bps charge per unit of turnover. To decompose realised shortfall into delay, spread, and market impact, use transaction-cost-analysis-tca-integration.
  • Size-dependent impact. The flat-rate model has no ADV or participation term, so it will understate cost for orders that are large relative to available liquidity. Pair it with liquidity-adjusted-position-sizing and strategy-capacity-estimation-before-scaling-capital before scaling capital.
  • Continuous or leveraged target weights. Positions here are discrete {-1, 0, +1}. A continuous-weight portfolio needs turnover computed on the weight vector — see portfolio-construction-with-transaction-cost-awareness.

Prerequisites

  • An array of numerical ML predictions (e.g., predicted forward returns or continuous signal strength).
  • An array of actual underlying returns, already aligned so that element i is the return realised after predictions[i] was observable. The backtester cannot detect misalignment.
  • Estimated transaction costs in basis points (bps) per half-turn (e.g., 5 bps for slippage + fee), calibrated against your own execution data rather than a folklore constant.

Workflow

  1. Align predictions to forward returns: pair predictions[t] with the return earned by acting on it (t → t+1, or t+1 → t+2 if your execution lags the signal by a bar). Getting this wrong is the single most common way to produce a spectacular, meaningless backtest.
  2. Clean the inputs: drop or impute NaN/Inf predictions before the backtest. A NaN prediction silently classified as "flat" is a hidden regime change in the strategy, not a neutral default — MlTcaBacktester rejects non-finite input rather than absorbing it.
  3. Set the hurdle: the entry threshold must clear the round-trip cost. A position that is entered and later exited pays 2 units of turnover, so require signal_threshold >= 2 * bps_cost_half_turn / 10_000 in decimal-return units. Below this line, a correct prediction is still a losing trade.
  4. Generate positions: map predictions to {+1, -1, 0} against the threshold.
  5. Decide whether to apply a buy/hold spread: if the model churns around the threshold boundary, set exit_threshold < signal_threshold so an open position is held until conviction genuinely decays, rather than being closed and re-entered on noise.
  6. Calculate turnover: costs are charged on position changes only. Flat→long is 1 unit; long→short is 2 units; a position still open on the final bar owes its exit half-turn (liquidate_at_end, on by default).
  7. Apply cost drag and compute net returns: subtract turnover × bps_cost_half_turn / 10_000 from gross returns each period.
  8. Sweep the threshold out-of-sample: pick signal_threshold/exit_threshold on training folds and confirm them on held-out data. Choosing the threshold that maximises net return on the same sample you report is parameter mining, not cost control — see walk-forward-optimization-window-management.
  9. Stress the cost assumption: re-run at 2–3× your estimated bps. A strategy whose net edge disappears when costs double has no margin for a bad execution day.

Full procedure: see references/workflows.md. Standards reference: see references/standards.md. Printable pre-flight checklist: see assets/checklist.md.

Common Pitfalls

  • Ignoring State Persistence: Charging a transaction cost on every bar simply because the model predicted "Buy", even though the portfolio is already in a "Buy" state. Costs are only incurred on position changes (Turnover).
  • Zero Thresholding: Taking trades on microscopic predictions (e.g., model predicts +0.0001% return) which guarantees a net loss when the transaction cost is 0.05%. A threshold of exactly 0 is worse than useless — it makes the long and short conditions overlap, so a neutral prediction can be classified as a short.
  • Symmetric Costs: Forgetting that crossing the spread (market order) costs money on both entry and exit (half-turns).
  • The Free Exit: Ending the backtest with an open position and never charging the closing half-turn. On a low-trade-count strategy this can hide a meaningful slice of total cost.
  • Contemporaneous Returns: Multiplying predictions[t] by the return of the bar the prediction was made on. This is look-ahead bias, and the resulting equity curve survives any cost assumption you throw at it — see lookahead-bias-elimination.
  • NaN as Neutral: Letting missing predictions default to "flat". The backtest then reports a strategy nobody can trade, and a NaN in the return series silently poisons every compounded metric.
  • Threshold Mined In-Sample: Sweeping signal_threshold across the full history and reporting the best net result. The threshold is a free parameter, and cost-aware backtests overfit it as readily as any other.

Verification

  • Simulate an ML model that perfectly predicts 10% returns but flips direction every day. Apply a 6% (600 bps) per-half-turn cost. The gross return will be massive, but the net return must be decisively negative — covered by test_perfect_but_churning_model_is_net_negative.
  • Confirm a held position is charged once, not once per bar: two consecutive identical long signals must produce 1 unit of turnover, not 2.
  • Confirm a neutral (0.0) prediction maps to flat, never to short.
  • Run python -m unittest discover -s skills/backtesting-ml-models-against-transaction-costs/scripts and confirm a 100% pass rate.

Related Skills

  • transaction-cost-analysis-tca-integration
  • execution-cost-model-recalibration-cadence
  • lookahead-bias-elimination
  • execution-realistic-simulation
  • walk-forward-optimization-window-management
  • portfolio-construction-with-transaction-cost-awareness

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

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

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

ماذا تفعل مهارة الذكاء الاصطناعي Backtesting Ml Models Against Transaction Costs؟

استخدمه عندما يغيّر نموذج ML توقعه مع كل شريط تقريبًا ويعتمد Sharpe على معدل دوران التداول؛ فهو يطبّق تكاليف على كل عملية دوران ويستخدم حدًا أدنى للثقة قبل تقييم الاستراتيجية. أما إسناد التكاليف على مستوى الأوامر فيندرج ضمن transaction-cost-analysis-tca-integration.

لماذا تستخدم Backtesting Ml Models Against Transaction Costs على TypingMind؟

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

كيف أثبّت Backtesting Ml Models Against Transaction Costs في TypingMind؟

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

ما نماذج الذكاء الاصطناعي التي يمكنها استخدام Backtesting Ml Models Against Transaction Costs؟

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

كم نموذج ذكاء اصطناعي يمكنني استخدامه مع Backtesting Ml Models Against Transaction Costs؟

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

هل مهارة الذكاء الاصطناعي Backtesting Ml Models Against Transaction Costs مجانية؟

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

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

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

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

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

عرض الكل
شعار openclaw

Clawdtributor

openclaw
مؤسسةشائع

طلبات السحب من Clawtributor هنا أو من الأسبوع الماضي أو ضمن فترة أخرى: اكتشف مراجع المحادثات، وأعِد التحقق من GitHub، ورتّب حسب التأثير.

82.2K
391K
التعليمات
عرض
شعار openclaw

Clawsweeper

openclaw
مؤسسةشائع

استخدم هذا لكل أعمال ClawSweeper: تقارير فحص مشكلات/طلبات سحب OpenClaw، ومهام الإصلاح، وطلبات السحب لإصلاحات السحابة، وأوامر منشن المشرفين @clawsweeper، والإصلاح التلقائي/الدمج التلقائي الموثوق الذي راجعه ClawSweeper، ومراقبة GitHub Actions…

82.2K
391K
الملفات: 1
عرض
شعار openclaw

Control Ui E2e

openclaw
مؤسسةشائع

استخدم هذا عند تصميم واجهة OpenClaw Control UI الرسومية أو اختبارها أو إصلاحها أو توسيعها، بما في ذلك معارض اختبار الإجهاد للواجهة مع مدخلات الملاحظات، وفحوص Vitest + Playwright الشاملة، وتدفقات Gateway المحاكية…

82.2K
391K
الملفات: 1
عرض
شعار openclaw

Deslop

openclaw
مؤسسةشائع

تنظيف مقتصر على تغييرات الفرع من الحشو البرمجي المولّد بالذكاء الاصطناعي: أزِل حشو التعليقات، وفحوص التحوط الزائدة، وتمويه الأنواع، وانحراف الأسلوب من تغييرات الفرع الحالية قبل المراجعة التلقائية.

82.2K
391K
التعليمات
عرض

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

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