cost-density-net-rr-calculator

cost-density-net-rr-calculator is a skill for Claude Code, Codex from fatfingererr/macro-skills. It costs 78 tokens per session (1,401 once invoked), scanned A, original, MIT.

A trading-cost calculator that measures how commissions and bid–ask spreads reduce a strategy’s net risk-to-reward ratio. It also calculates the minimum win rate and tests different stop-loss sizes.

In plain words
What is it for?
Comparing trading setups, scanning stop-loss ranges, finding efficiency thresholds, and interpreting how costs affect expected returns.
Why use it?
It shows when trading costs make a strategy inefficient, especially when stop-losses are small. This helps separate apparent profits from results that may not survive real costs.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Comparing trading setups, scanning stop-loss ranges, finding efficiency thresholds, and interpreting how costs affect expected returns.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/fatfingererr/macro-skills/cost-density-net-rr-calculator
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add fatfingererr/macro-skills --skill cost-density-net-rr-calculator
Clone the repo
git clone --depth 1 https://github.com/fatfingererr/macro-skills

Made for: Claude Code, Codex.

Its marketplace also offers this one on its own, as the plugin cost-density-net-rr-calculator/plugin install cost-density-net-rr-calculator after adding the marketplace above.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cost-density-net-rr-calculator

README.md
[![agentmods](https://agentmods.dev/badge/skills/fatfingererr/macro-skills/cost-density-net-rr-calculator/github.svg)](https://agentmods.dev/skills/fatfingererr/macro-skills/cost-density-net-rr-calculator)
Your own site
<a href="https://agentmods.dev/skills/fatfingererr/macro-skills/cost-density-net-rr-calculator"><img src="https://agentmods.dev/badge/skills/fatfingererr/macro-skills/cost-density-net-rr-calculator/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for cost-density-net-rr-calculator

Your own site · 80×15
<a href="https://agentmods.dev/skills/fatfingererr/macro-skills/cost-density-net-rr-calculator"><img src="https://agentmods.dev/badge/skills/fatfingererr/macro-skills/cost-density-net-rr-calculator.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 78 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,401 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00078 $0.01401
Opus 5 $0.00039 $0.00700
Sonnet 5 $0.00016 $0.00280
Haiku 4.5 $0.00008 $0.00140

Measured 11d ago against content hash f0e868159c72, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

cost-density-net-rr-calculator scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/cost_density.py, scripts/cost_density.ts), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/cost-density-net-rr-calculator/SKILL.md · 140 lines

What it actually says

<essential_principles> 成本密度模型核心原則

1. 核心公式

所有計算基於以下關係:

Cost Density = (c/V + s)           # 成本密度(pips 等效)
x = Cost Density / P               # 負載係數
RR_net = (RR_g - x) / (1 + x)      # 淨風險報酬比
WR_min = (1 + x) / (1 + RR_g)      # 最低勝率
P_critical = CostDensity × (RR_g + 2) / RR_g  # 效率減半點

2. 參數定義

參數 定義 單位
RR_g 毛風險報酬比(目標/停損) 無單位
P 停損大小 pips/points
c 來回佣金(每手) 帳戶貨幣
s 來回點差 pips/points
V 每 pip 價值(每手) 帳戶貨幣/pip
R 固定風險(可選,會抵消) 帳戶貨幣

3. 關鍵洞察

  • 雙曲線衰減: P → 0 時,x → ∞,RR_net → -1
  • R 無關性: RR_net 不依賴固定風險 R
  • 剪刀效應: 短時間框架同時增加成本負擔與降低訊號品質

4. 單位一致性規則

  • P 和 s 必須使用相同基準(都是 pips 或都是 points)
  • c 必須是 round-turn(來回)佣金
  • V 必須是每 pip 每手的價值 </essential_principles>
  1. Compute - 計算單一參數組合的成本密度與效率指標
  2. Sweep - 掃描停損範圍,生成 RR_net/WR_min 曲線表
  3. Analyze - 解讀結果,提供策略建議

等待回應後再繼續。

讀取工作流程後,請完全遵循其步驟。

<reference_index> 參考文件 (references/)

文件 內容
formulas.md 完整公式推導與數學證明
theory.md 市場微結構理論背景與文獻
</reference_index>

<workflows_index>

Workflow Purpose
compute.md 單次計算成本密度與效率指標
sweep.md 網格掃描與閾值搜尋
analyze.md 結果解讀與策略建議
</workflows_index>

<templates_index>

Template Purpose
output-schema.yaml 輸出 JSON schema
input-schema.yaml 輸入參數 schema
</templates_index>

<scripts_index>

Script Purpose
cost_density.py Python 計算實作
cost_density.ts TypeScript 計算實作
</scripts_index>

<quick_start> 快速計算(XAU/USD 範例):

輸入:

{
  "RR_g": 3.0,
  "c": 7.0,
  "s": 1.5,
  "V": 10.0,
  "P": 20
}

計算:

cost_density = 7.0/10.0 + 1.5  # = 2.2 pips
x = 2.2 / 20                    # = 0.11
RR_net = (3.0 - 0.11) / (1 + 0.11)  # = 2.60
WR_min = (1 + 0.11) / (1 + 3.0)     # = 27.7%
P_critical = 2.2 * (3.0 + 2) / 3.0  # = 3.67 pips

輸出:

{
  "cost_density": 2.2,
  "x": 0.11,
  "RR_net": 2.60,
  "WR_min": 0.277,
  "P_critical": 3.67,
  "Loss_RR": 0.133
}

</quick_start>

<success_criteria> Skill 成功執行時:

  • 輸入參數通過驗證(單位一致性)
  • 正確計算 cost_density、x、RR_net、WR_min
  • 識別是否處於高摩擦區(P < P_critical)
  • 輸出符合 outputs_schema
  • 提供 zh-TW 解釋說明 </success_criteria>
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 140 lines · 78 tokens per session scan A f0e868159c72

Subscribe to this mod's changes

cost-density-net-rr-calculator is a skill published in the GitHub repository fatfingererr/macro-skills (3 stars, last pushed 7mo ago), licensed MIT. It adds 78 tokens to every session and 1,401 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

sector-rotation

An analysis framework for comparing industries in the Chinese A-share stock market, using business conditions, price momentum, valuation, and money flows. It produces rankings and higher- or lower-allocation suggestions.

HKUDS/Vibe-Trading · 39 tokens

strategy-pivot-designer

Detect backtest iteration stagnation and generate structurally different strategy pivot proposals when parameter tuning reaches a local optimum.

tradermonty/claude-trading-skills · 28 tokens

twitter-reader

Read Twitter/X for financial research using opencli (read-only). Use this skill whenever the user wants to read their Twitter feed, search for financial tweets, view bookmarks, look up user profiles, or gather market sentiment from Twitter/X. Triggers include: "check my feed", "search Twitter for", "show my…

himself65/finance-skills · 161 tokens

chenhao-limit-up

A framework for judging Chinese A-share stocks that have reached the daily price-rise limit, using market mood, sector leadership, and trading momentum.

questflowai/investorskills · 44 tokens

furusato

A Japanese hometown-tax donation manager for furusato nozei, a system where donations to municipalities can qualify for an income-tax or local-tax deduction. It reads donation receipts, stores donation records, and calculates deduction limits.

kazukinagata/shinkoku · 102 tokens

reading-receipt

An image-reading workflow for extracting structured information from receipts, invoices, and hometown-tax donation certificates. It can first extract text from PDFs and otherwise read their images.

kazukinagata/shinkoku · 64 tokens