Adaptive Sampling Under Extreme Tick Ratesのロゴ

Adaptive Sampling Under Extreme Tick Rates

コミュニティ
HimanshuJ16
adaptive-sampling-under-extreme-tick-rates

取引ティックのストリームがコンシューマーの実測処理上限を超え、取引量と取引金額を維持したまま1:Nのサンプルを出力する必要がある場合に使います。すべてのメッセージが必要な注文板、気配値、コンプライアンス用フィードには使わないでください。

Add to TypingMind

概要

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

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

  • どのLLMでも利用可能

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

  • 5個の同梱ファイル

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

  • オープンソース

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

インストール

AIスキル「Adaptive Sampling Under Extreme Tick Rates」を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/adaptive-sampling-under-extreme-tick-rates
  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/adaptive-sampling-under-extreme-tick-rates .claude/skills/adaptive-sampling-under-extreme-tick-rates
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

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

関連するリクエストがあるとすぐに、モデルが自動的にAdaptive Sampling Under Extreme Tick Ratesを読み込みます。

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

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

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

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

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

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

スキルの指示

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

When to Use

Invoke this skill for a high-rate trade-tick stream when a downstream strategy or analytics consumer has a measured processing ceiling and cannot safely keep every input tick. The engine monitors per-symbol arrival rate, emits every 1:N ticks during overload, and aggregates skipped trade volume and price-volume notional into the emitted sample.

The default target of 5,000 ticks/second is an example capacity parameter, not a universal market-data standard. Calibrate it from measured CPU, queue, latency, and downstream correctness budgets.

When NOT to Use

  • Do not use sampled output for order-book reconstruction, quote protection, spread/microstructure signals, queue-position models, latency-sensitive execution, or regulatory/compliance records that require the complete feed.
  • Do not use it to repair feed gaps, sequence gaps, duplicate messages, or venue recovery state. Detect and reconcile those upstream before sampling.
  • Do not drop residual aggregates at shutdown, symbol removal, or feed restart; call flush, flush_all, or reset_symbol(flush=True) and persist the result.
  • Do not treat aggregate VWAP as an OHLC bar or assume it preserves the path, timing, or extrema of skipped trades.

Prerequisites

  • A trade-tick feed with documented symbol identity, sequence semantics, event timestamps, price units, and volume units.
  • A measured per-symbol processing target and an explicit policy for overload, feed restart, sequence reset, and symbol lifecycle.
  • Downstream consumers that understand SampledTick.aggregated_tick_count, sampling_factor, and synthetic is_flush records.
  • A durable handoff or audit path for emitted samples, validation errors, and flush/recovery events.
  • Python 3.10+.

Workflow

  1. Set the capacity contract: Construct AdaptiveTickSamplerEngine(target_max_rate_per_sec=...) with a positive integer target. Keep enforce_monotonic_sequence=True unless the feed contract explicitly permits another policy.
  2. Validate feed identity upstream: Verify symbol, sequence, timestamp, price, and volume semantics. The engine rejects empty symbols, non-finite values, non-positive prices/volumes, duplicate or decreasing sequences, and backwards event timestamps.
  3. Ingest one trade tick at a time: Call ingest_tick(...). Under the target rate it emits a passthrough aggregate; above the target it computes k = ceil(rate / target) with a minimum sampled factor of 2.
  4. Consume explicit metadata: Use mode and sampling_factor to identify policy, aggregated_tick_count to identify how many raw trades are represented, and is_flush to distinguish synthetic residual output. Treat aggregated_tick_count > 1 — not mode — as the test for whether price is a VWAP rather than a traded price, because a PASSTHROUGH emission also drains any residual sampled block.
  5. Handle errors fail-closed: Route validation exceptions to the feed-integrity path. Do not retry the same malformed or duplicate tick as if it were new data.
  6. Manage lifecycle: Call flush(symbol) for an individual stream, flush_all() during shutdown/checkpointing, and reset_symbol(flush=True) when a symbol leaves the stream or its sequence domain resets.
  7. Monitor quality: Track input/output rates, sampling factor, aggregate counts, volume/notional reconciliation, validation failures, flush counts, queue latency, and downstream processing latency.

Common Pitfalls

  • Discarding skipped volume: Emitting only the selected tick loses traded volume and corrupts aggregate VWAP.
  • Calling the result a full feed: A VWAP aggregate preserves volume and notional, not every price path, quote, or order-book event.
  • Keying on mode to detect a raw trade: when the rate falls back below target mid-block, the draining emission reports PASSTHROUGH with sampling_factor=1 while still carrying aggregated_tick_count > 1 and a VWAP price no venue printed. Only aggregated_tick_count separates a raw trade from an aggregate.
  • Accepting duplicate or out-of-order data: Repeated trades double-count volume; backwards event time corrupts rolling-rate windows.
  • Using wall-clock flush timestamps: A flush must remain deterministic in replay; the implementation defaults to the last event timestamp unless an explicit later timestamp is supplied.
  • Leaking symbol state: Long-lived feeds must reset inactive symbols after flushing so per-symbol dictionaries do not grow without bound.
  • Sampling before feed recovery: Sequence gaps and venue recovery require upstream reconciliation; sampling cannot infer missing trades.

Verification

Run the focused test suite:

text
python -m unittest discover -s skills/adaptive-sampling-under-extreme-tick-rates/scripts

The tests cover passthrough, the rate == target boundary, overload sampling, volume/notional preservation across a burst, the PASSTHROUGH drain of a partial sampled block, zero timestamps, deterministic flushes, rejection of a flush timestamp preceding the last accepted tick, sorted flush_all, reset_symbol with and without a flush, duplicate/out-of-order rejection, the optional non-monotonic sequence policy, malformed tick values, invalid targets, symbol isolation, state-neutral rejection of an overflowing aggregate, and concurrent multi-threaded ingestion of a shared symbol. Production sign-off additionally requires replaying calibrated bursts and verifying downstream reconciliation against raw input totals.

Related Skills

  • backpressure-drop-degrade-policy
  • tick-buffering-burst-handling
  • adaptive-batch-size-tuning-under-load

同梱ファイル

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

よくある質問

AIスキル「Adaptive Sampling Under Extreme Tick Rates」では何ができますか?

取引ティックのストリームがコンシューマーの実測処理上限を超え、取引量と取引金額を維持したまま1:Nのサンプルを出力する必要がある場合に使います。すべてのメッセージが必要な注文板、気配値、コンプライアンス用フィードには使わないでください。

TypingMindでAdaptive Sampling Under Extreme Tick Ratesを使うメリットは何ですか?

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

TypingMindにAdaptive Sampling Under Extreme Tick Ratesをインストールするにはどうすればよいですか?

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

Adaptive Sampling Under Extreme Tick Ratesを使えるAIモデルはどれですか?

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

Adaptive Sampling Under Extreme Tick Ratesで使えるAIモデルの数に制限はありますか?

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

AIスキル「Adaptive Sampling Under Extreme Tick Rates」は無料ですか?

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

AIスキルとは何ですか?

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

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

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

すべて見る

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

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