Backtest Infrastructure Cost Budgetingのロゴ

Backtest Infrastructure Cost Budgeting

コミュニティ
HimanshuJ16
backtest-infrastructure-cost-budgeting

大規模なグリッドサーチやティック単位のスイープを開始する前に使用し、クラウドのコンピューティング費用とストレージ費用を予測します。スポット中断のオーバーヘッド、タスクごとの最低課金額、非線形なスケーリングも考慮するため、請求書を見て初めて費用に気づく事態を防げます。

Add to TypingMind

概要

公開者HimanshuJ16
リポジトリAlgo-Trading-Skills
スキル名backtest-infrastructure-cost-budgeting
スター
50
フォーク
7
同梱ファイル
5
ライセンスApache-2.0
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 5個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    HimanshuJ16がGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Backtest Infrastructure Cost Budgeting」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/HimanshuJ16/Algo-Trading-Skills/tree/main/skills/backtest-infrastructure-cost-budgeting
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

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/backtest-infrastructure-cost-budgeting .claude/skills/backtest-infrastructure-cost-budgeting
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでBacktest Infrastructure Cost Budgetingを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にBacktest Infrastructure Cost Budgetingを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Backtest Infrastructure Cost Budgetingは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

When to Use

Use this skill before kicking off massive grid searches or tick-level backtests over thousands of instruments. Large-scale backtesting can quietly consume thousands of dollars of cloud spend if it is not budgeted in advance, and the bill arrives long after the decision to run was made.

When NOT to Use

  • As a billing reconciliation tool. This estimates ahead of a run. For tracking actual spend against forecast, see cost-monitoring-for-cloud-trading-infrastructure.
  • As a live cost cut-off. It produces a number; it does not stop a running job. Wire is_over_budget into your launcher yourself.
  • For a single small backtest. Below a few dollars the estimation effort exceeds the spend.
  • Without a measured baseline. Every input is a per-unit measurement. Guessed inputs produce a confidently wrong total — profile a real sample first.

Which Billing Model This Fits

Costs are modelled as separately metered vCPU-hours and GB-hours. That is how serverless container platforms bill: AWS Fargate charges "based on the vCPU, memory, Operating Systems, CPU Architecture, and storage resources used", with CPU and memory as separate line items.

EC2 does not bill this way. AWS states "pricing is per instance-hour consumed for each instance, from the time an instance is launched until it is terminated or stopped" — one rate covering the instance's fixed vCPU and memory together, whether or not you use it. To budget an instance fleet with this tool:

python
pricing = CloudPricing(
    cpu_hourly_rate=0.192,   # full instance hourly rate
    ram_hourly_rate=0.0,     # memory is already inside the instance price
    storage_monthly_rate_per_gb=0.10,
)

and express cpu_hours_per_unit as instance-hours per unit. Leaving ram_hourly_rate at a non-zero value under bundled billing double-counts memory you have already paid for.

No prices are hard-coded in this skill. Published rates change and vary by region, CPU architecture, OS, and commitment level — pull current numbers from the provider's pricing page for your region.

Prerequisites

  • A measured baseline from a small representative run: CPU time, peak memory, storage produced, and egress per unit.
  • Total sweep dimensions (instruments × parameter combinations).
  • Current rates for your region and billing model.

Workflow

  1. Run a representative sample — one instrument, one parameter set — and measure CPU time, peak RAM, storage produced, and any egress.
  2. Choose the billing model and populate CloudPricing accordingly (separable vCPU/GB, or bundled instance rate with ram_hourly_rate=0.0).
  3. Set the billing quantum. Fargate bills "per second with a 1-minute minimum". A sweep of thousands of few-second units pays that minimum thousands of times: 5,000 units of 3.6 s each bill as 83 vCPU-hours, not 5 — a 16.7× difference. Set minimum_billable_seconds=60.0 on Fargate, or 0.0 where billing is genuinely continuous.
  4. Budget the overheads you know you have. parallel_overhead_factor above 1.0 covers scheduler waste, contention, and coordination. Perfect linear scaling is the assumption to justify, not the default to assume.
  5. If using spot, budget the interruptions too. AWS states "it is always possible that your Spot Instance might be interrupted", and interrupted work has to be redone. spot_interruption_overhead=0.15 budgets 15% rework on top of the discounted rate. Leaving it at 0.0 assumes perfect checkpointing.
  6. Review is_over_budget before scaling up, and act on it: cut the parameter space, shorten retention, or optimise cpu_hours_per_unit.

Full procedure: see references/workflows.md. Rate sources and modelling assumptions: see references/standards.md. Printable pre-flight checklist: see assets/checklist.md.

Common Pitfalls

  • Treating the spot discount as free money. A flat multiplier with no interruption allowance biases the budget down — the dangerous direction for a guard. Spot instances are reclaimed when the provider needs capacity back, and partially complete units must be rerun.
  • Ignoring the per-task billing minimum. The single largest error source for wide sweeps of short units, and it always understates.
  • Assuming linear scaling. Parallel overhead, database locks, and scheduler queuing mean 10,000 units rarely cost exactly 100× what 100 units cost. parallel_overhead_factor exists to make that assumption explicit.
  • Ignoring storage and egress. Huge tick databases and verbose output logs can dominate CPU cost, and pulling datasets across cloud boundaries is billed per GB.
  • Double-counting RAM under bundled instance billing. See the billing-model section above.
  • Feeding in guessed per-unit numbers. The estimate inherits the accuracy of its inputs and reports the result with the same confidence either way.
  • Trusting a NaN. float('nan') > budget is False, so before v2.0 a single NaN input silently reported the sweep as within budget. Non-finite and negative inputs are now rejected outright.
  • Budgeting only the successful path. Failed and retried units are billed too.

Verification

  • Run python -m unittest discover -s skills/backtest-infrastructure-cost-budgeting/scripts — 30 tests, 100% pass rate.
  • Cross-check the estimate against the actual bill after running a 10% scale job, then correct the per-unit inputs rather than the total.
  • Confirm is_over_budget is True for a deliberately oversized sweep, and that a NaN or negative input raises CostBudgetError rather than passing the guard.
  • Confirm the exact-budget boundary behaves as intended: a total equal to the budget is treated as within budget.

Related Skills

  • backtest-parameter-sensitivity-analysis — shrinking the sweep space is the cheapest cost lever
  • cost-monitoring-for-cloud-trading-infrastructure — tracking actual spend against this forecast
  • capacity-planning-for-symbol-universe-growth — how the sweep dimensions grow over time
  • walk-forward-hyperparameter-search-budget — bounding the search before it is priced
  • load-testing-before-scaling-to-new-instrument-universe — validating the per-unit baseline at scale

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Backtest Infrastructure Cost Budgeting」では何ができますか?

大規模なグリッドサーチやティック単位のスイープを開始する前に使用し、クラウドのコンピューティング費用とストレージ費用を予測します。スポット中断のオーバーヘッド、タスクごとの最低課金額、非線形なスケーリングも考慮するため、請求書を見て初めて費用に気づく事態を防げます。

TypingMindでBacktest Infrastructure Cost Budgetingを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Backtest Infrastructure Cost Budgetingはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにBacktest Infrastructure Cost Budgetingをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/HimanshuJ16/Algo-Trading-Skills/tree/main/skills/backtest-infrastructure-cost-budgetingを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Backtest Infrastructure Cost Budgetingを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Backtest Infrastructure Cost Budgetingで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもBacktest Infrastructure Cost Budgetingを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Backtest Infrastructure Cost Budgeting」は無料ですか?

はい。HimanshuJ16がApache-2.0ライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇