Capital Efficiency Across Cross Margined Strategies logo

Capital Efficiency Across Cross Margined Strategies

Community
HimanshuJ16
capital-efficiency-across-cross-margined-strategies

Use when several strategies share one portfolio-margined account and you need to estimate how much collateral cross-margining frees versus margining each sleeve standalone, using SPAN-style spread credits.

Overview

PublisherHimanshuJ16
RepositoryAlgo-Trading-Skills
Skill namecapital-efficiency-across-cross-margined-strategies
Stars
50
Forks
7
Bundled files
5
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 5 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by HimanshuJ16 on GitHub. Read the source before you install it.

Installation

Install the Capital Efficiency Across Cross Margined Strategies AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/HimanshuJ16/Algo-Trading-Skills/tree/main/skills/capital-efficiency-across-cross-margined-strategies
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

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/capital-efficiency-across-cross-margined-strategies .claude/skills/capital-efficiency-across-cross-margined-strategies
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Capital Efficiency Across Cross Margined Strategies in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Capital Efficiency Across Cross Margined Strategies on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Capital Efficiency Across Cross Margined Strategies is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

When to Use

Invoke this skill when several strategies share one margined account and capital, not signal quality, is the binding constraint. Margining every sleeve standalone charges for risks the account does not actually carry: a long in one sleeve and a short in a related instrument in another partly cancel, and a portfolio-margin engine prices the residual rather than the sum.

Use it to answer two questions with a number rather than a hope: how much collateral does the offset plausibly release, and how much of that release survives a conservative assumption about the credit the broker will grant. The module reports the isolated total, the estimated cross-margined total, the Capital Efficiency Ratio between them, and a per-spread audit trail showing which credit produced which dollar.

When NOT to Use

  • As a substitute for the broker's margin number. This is an estimator with a published-parameter input, not a margin engine. OCC TIMS and CME SPAN revalue the book across a scenario grid; Bybit's Unified Trading Account uses stress-test results. Size positions against the broker's own calculator or margin API, and use this to plan.
  • To justify deploying the freed capital. The output is a capacity figure, not a recommendation. Freed collateral redeployed into correlated risk is the mechanism by which cross-margined books cascade when the correlation breaks.
  • Across venues. Positions at two exchanges do not offset — separate accounts at separate clearing organisations. Inter-clearing-house netting exists only inside formal cross-margin programmes; see cross-margining-across-asset-classes.
  • For a single-name equity book under US portfolio margin. OCC's Customer Portfolio Margin grants non-index single-stock class groups no offset at all, however correlated the names are. A correlation-derived estimate will be pure fiction there; pass an explicit credit rate of 0.0.
  • For per-contract accuracy on options. Real requirements are floored per contract ($0.375 x multiplier under TIMS, the short option minimum under SPAN). This model has no contract concept; use min_cross_margin_fraction to approximate the floor.

Prerequisites

  • Positions as (symbol, signed delta, standalone margin), one row per instrument. Rows from different strategy sleeves must be netted first — see step 1.
  • Ideally, the broker's or exchange's published offset percentages for the pairs you hold (SPAN inter-commodity credit tables, OCC product-group offsets, or the broker's margin documentation). A correlation matrix is the fallback when those are unavailable.
  • An account actually enabled for portfolio margining, and eligible for it: FINRA Rule 4210(g) sets minimum equity of $100,000 to $500,000 depending on the member's intraday monitoring capability, and IBKR requires $110,000 to open a portfolio-margin account and $100,000 to keep one.
  • If using correlations: a dated, documented estimation window. Correlation is an input you chose, not a fact about the future.

Workflow

  1. Net each instrument across sleeves before margining anything. Two sleeves holding BTC — one long, one short — are one net position to the broker, and the account is margined on the net. net_positions_by_symbol collapses them, scaling margin by the net delta at the group's highest margin rate and capping the result at the summed standalone margin so netting can never raise the requirement. calculate_margin raises on duplicate symbols rather than silently margining them as two spreadable legs.
  2. Prefer a published credit rate over a correlation. Pass credit_rate_overrides={'CORN': {'SOYB': 0.65}} where the exchange publishes the number; it is used as given and the haircut is not applied on top, because a published rate is already the post-haircut figure. Correlation is consulted only for pairs with no override.
  3. Treat the haircut as your conservatism, not a standard. correlation_haircut defaults to 0.80. No regulator or clearing house prescribes that figure — it exists because a raw historical correlation is the most optimistic number in the calculation.
  4. Read the spread audit trail, not just the total. Each OffsetCredit names the two legs, the rate, the amount spread and whether the rate was published or correlation. A total driven by correlation-sourced credits on pairs the broker groups separately is a total that will not survive contact with the margin engine.
  5. Floor the estimate before you plan against it. Set min_cross_margin_fraction to the smallest fraction of standalone margin you believe the broker could ever charge. floor_applied on the report tells you the floor, not the model, produced the answer.
  6. Compare CER against reality, then re-anchor. Reconcile the estimate against the broker's actual requirement on a live book. Persistent optimism means the credit rates are wrong; correct the rates rather than raising the haircut to compensate.

Full procedure: see references/workflows.md. Sourced methodology parameters: see references/standards.md. Printable pre-flight checklist: see assets/checklist.md.

Common Pitfalls

  • Passing the same symbol twice. Two sleeves' BTC rows margined as two legs get a spread credit against each other instead of netting to flat — a genuinely flat book reporting $12,000 of requirement. This raises MarginInputError and points at net_positions_by_symbol.
  • Believing a correlation is a credit rate. Exchanges publish offset percentages as fixed parameters — SPAN's inter-commodity credit table, OCC's product-group offsets — set from their own analysis and revised on their schedule, not from your EWMA window.
  • Assuming correlation holds in the tail. A 0.95 correlation is a statement about the sample you measured. Margin engines apply their own conservatism precisely because the hedge that is supposed to fund the position is the one that fails in a dislocation.
  • Redeploying the freed collateral into more of the same risk. The offset assumed the legs cancel; doubling the book on the strength of it removes the cancellation that justified the credit, and liquidation cascades from there.
  • Expecting a 5x or 10x capital saving. Structurally impossible in this model: each spread consumes its credited amount from both legs, so the credit never exceeds half the isolated requirement and the ratio is bounded above by 2.0.
  • Netting across exchanges. A Binance long does not offset a Bybit short. Two accounts, two clearing organisations, two margin calls.
  • Crediting a negative correlation. A long and a short in negatively correlated instruments are risk-additive. No credit is granted; the inverse case — two same-side legs that genuinely hedge — is also uncredited, so the estimate is low on such books.
  • Letting bad data through. A correlation of 1.4 from a broken feed produced a requirement below the model's own floor and a CER of 3.33x. Out-of-range correlations, credit rates, haircuts, negative margins, NaN and infinity now raise MarginInputError.

Verification

  • Run the unit suite and confirm every test passes: python -m unittest discover -s skills/capital-efficiency-across-cross-margined-strategies/scripts
  • Long $100k of A against short $100k of B, each carrying $10,000 standalone margin, at a 0.90 correlation and a 0.80 haircut: the credit rate is 0.72, the credit is min(10000, 10000) * 0.72 = $7,200, cross margin is $12,800 and CER is 1.5625. A materially lower requirement than that is a bug, not a saving.
  • Shuffle the position list and confirm the requirement is unchanged. Spreads form highest-credit-first, so the number must not depend on arrival order.
  • Give one long two competing shorts and confirm the higher-credit spread forms first and consumes the long.
  • Net a long and an equal short of the same symbol and confirm the netted position carries zero delta and zero margin — then confirm passing both rows unnetted raises.
  • Pass a correlation of 1.4, a haircut of 1.5, a negative margin and a NaN delta, and confirm each raises MarginInputError. A number coming back is a fail-open bug.
  • Set a 100% credit rate on a matched pair and confirm CER is exactly 2.0, never infinity.
  • Reconcile against the broker's own margin figure on a live book before allocating against the freed capital.

Related Skills

  • cross-margining-across-asset-classes
  • options-margin-span-calculation-global
  • multi-leg-strategy-margin-optimization
  • margin-utilization-circuit-breaker
  • broker-account-margin-call-handling
  • broker-margin-interest-accrual-tracking
  • correlation-aware-exposure-limits

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Capital Efficiency Across Cross Margined Strategies AI skill do?

Use when several strategies share one portfolio-margined account and you need to estimate how much collateral cross-margining frees versus margining each sleeve standalone, using SPAN-style spread credits.

Why use Capital Efficiency Across Cross Margined Strategies on TypingMind?

Because you install it once and use it with any model. Capital Efficiency Across Cross Margined Strategies is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Capital Efficiency Across Cross Margined Strategies in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/HimanshuJ16/Algo-Trading-Skills/tree/main/skills/capital-efficiency-across-cross-margined-strategies. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Capital Efficiency Across Cross Margined Strategies?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Capital Efficiency Across Cross Margined Strategies?

As many as you like. As long as a model supports skills, you can use Capital Efficiency Across Cross Margined Strategies with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Capital Efficiency Across Cross Margined Strategies AI skill free?

Yes. It is published on GitHub by HimanshuJ16 under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇