Clock Drift Monitoring Alerting Thresholdsのロゴ

Clock Drift Monitoring Alerting Thresholds

コミュニティ
HimanshuJ16
clock-drift-monitoring-alerting-thresholds

報告対象イベントにタイムスタンプを付与するホストで、その用途に適用されるMiFID II RTS 25の時刻ずれ上限を超えていないことを確認する場合に使用します。PTPオフセットとデーモンの状態を評価し、上限超過時には停止状態をラッチします。クロックの調整は別のスキルで行います。

Add to TypingMind

概要

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

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

  • どのLLMでも利用可能

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

  • 5個の同梱ファイル

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

  • オープンソース

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

インストール

AIスキル「Clock Drift Monitoring Alerting Thresholds」を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/clock-drift-monitoring-alerting-thresholds
  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/clock-drift-monitoring-alerting-thresholds .claude/skills/clock-drift-monitoring-alerting-thresholds
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

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

関連するリクエストがあるとすぐに、モデルが自動的にClock Drift Monitoring Alerting Thresholdsを読み込みます。

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

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

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

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

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

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

スキルの指示

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

When to Use

Use this skill when a host that stamps reportable events must demonstrate traceability to UTC inside a stated tolerance, and you need that tolerance enforced automatically rather than reviewed after the fact.

Pick the threshold from the activity, not from the headline number. RTS 25 (Commission Delegated Regulation (EU) 2017/574) Annex Table 2 binds members and participants of EU trading venues by type of trading activity:

ActivityMax divergence from UTCGranularity
High frequency algorithmic trading technique100 µs1 µs or better
Any other trading activity1 ms1 ms or better
Voice / RFQ with human intervention / negotiated transactions1 s1 s or better

The 100 µs default this skill ships is the HFT row of one EU table. It is not a universal clock rule: a US CAT reporter is bound by FINRA Rule 6820 to 50 milliseconds against NIST — 500× looser — and non-HFT EU algo flow is bound to 1 ms. Configure critical_threshold_us from the row that applies to you. Enforcing 100 µs on a book that is not running an HFT technique into an EU venue buys no compliance and manufactures outages.

When NOT to Use

  • As a substitute for a time-sync stack. This measures and reacts; it does not discipline anything. Configuring ptp4l/phc2sys, NIC hardware timestamping and grandmaster selection belongs to clock-synchronization-ptp-for-trading-hosts.
  • To repair timestamps already written. A halt stops the bleeding. Correcting event times recorded during the breach window is clock-skew-correction-for-tick-timestamps.
  • For US-only trading, at these defaults. See the table above; run it at CAT_MAX_DIVERGENCE_US, and note that FINRA also requires a daily pre-open sync check, which is a procedure this monitor does not perform.
  • As the sole justification of RTS 25 compliance. Article 4 requires a documented, annually reviewed traceability system — system design, functioning, specifications, and the exact point at which each timestamp is applied. A monitor is evidence within that system, not the system.
  • Under concurrency, unguarded. ClockDriftMonitor is not thread-safe. Drive it from one polling loop or wrap it in your own lock.

Prerequisites

  • A PTP daemon on the host (ptp4l, plus phc2sys if events are stamped from CLOCK_REALTIME rather than the PHC) emitting parseable offset telemetry.
  • A mapping from your daemon's states to PtpState. ptp4l has no HOLDOVER state of its own — it reports IEEE 1588 port states (SLAVE, UNCALIBRATED, FAULTY, …) and servo states (s0 unlocked, s1 clock step, s2 locked). references/workflows.md gives the mapping this skill assumes.
  • A measured holdover drift rate for the host oscillator, in µs/s. Without it, holdover_grace_s must stay at its fail-closed default of 0.0.
  • A kill-switch entry point the monitor can call synchronously, and an out-of-band alert path that does not depend on the trading engine still being up.

Workflow

  1. Convert units at the boundary. ptp4l logs master offset in nanoseconds; this module takes microseconds. Call offset_us_from_ptp4l_ns() rather than passing the raw figure — see Pitfalls for what happens if you don't.

  2. Poll, and validate before you compare. process_telemetry(offset_us, ptp_state) rejects a non-finite offset with ClockTelemetryError instead of classifying it. Catch that exception in the polling loop and treat it as a fault, not as a skipped reading: an offset you could not parse is a clock state you do not know.

  3. Evaluate state before offset. An UNLOCKED servo halts regardless of the number it reported, because an unlocked servo's offset is meaningless. HOLDOVER starts a grace timer on a monotonic clock — never the wall clock, which is the thing under suspicion — and returns WARNING while inside grace so a lost grandmaster is visible to operations immediately rather than at expiry.

  4. Evaluate the offset. |offset| ≥ critical latches the halt and fires the callback once; |offset| ≥ warning alerts without blocking, and re-logs only on transition into the warning state, so a host sitting at 60 µs does not generate an alarm per poll.

  5. Check liveness on every tick, including empty ones. Call check_liveness() even when no telemetry was read. process_telemetry is reactive and cannot observe absence; a crashed ptp4l emits no offsets at all, and with max_telemetry_age_s unset that silence reads as continued health.

  6. Resume deliberately. The halt latches. reset(operator, reason) requires both arguments and logs them at CRITICAL, because resuming order origination after a clock breach is a compliance decision that has to be attributable at the annual Article 4 review.

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

Common Pitfalls

  • Feeding raw ptp4l nanoseconds into a microsecond threshold. A real 120 µs breach arrives as 120 and reads HEALTHY — the monitor runs green forever while the firm is continuously non-compliant. This is the single most likely way to deploy this skill and get nothing from it.
  • Letting a NaN offset mean "fine". abs(nan) >= 100 is False and so is abs(nan) >= 50, so an unvalidated bad parse falls through every threshold and returns HEALTHY. Absence of a breach signal is not evidence of a healthy clock.
  • Treating silence as health. The common failure is not a drifting clock, it is a dead daemon. A monitor with no staleness deadline never fires, because nothing calls it.
  • Ignoring HOLDOVER because the offset still looks small. On entering holdover the reported offset is against a grandmaster that is no longer there. It looks excellent right up until the local oscillator walks past the limit, and how long that takes is a hardware property you must measure, not assume.
  • Setting the halt threshold exactly at the regulatory limit. By the time drift reaches 100 µs, non-compliant timestamps have already been written. The regulatory number is the ceiling, not the alarm point — leave headroom for detection and halt latency.
  • Alert fatigue from a too-tight warning level. A 5 µs warning on a network with ordinary jitter trains operations to ignore the channel, so the real breach lands in a muted room.
  • Monitoring software clocks only. NTP over UDP carries millisecond-scale OS jitter; it cannot evidence a 100 µs bound. Hardware timestamping at the NIC is the prerequisite, not an optimization.
  • Assuming the kill switch worked. If the callback raises, the monitor stays latched and re-raises — but the engine may still be live. Treat a failed callback as a manual escalation, not a logged warning.

Verification

  • Feed a 120 µs offset with PtpState.LOCKED; confirm CRITICAL, one callback invocation, and that a subsequent 10 µs reading still returns CRITICAL until reset.
  • Feed PtpState.HOLDOVER at a 1 µs offset with holdover_grace_s=30; confirm WARNING before expiry and CRITICAL after, using an injected monotonic clock rather than sleeps.
  • Feed float("nan"); confirm ClockTelemetryError and that the monitor did not halt and did not report HEALTHY.
  • Stop feeding telemetry with max_telemetry_age_s set; confirm check_liveness() halts.
  • Run python -m unittest discover -s skills/clock-drift-monitoring-alerting-thresholds/scripts.

Related Skills

  • clock-synchronization-ptp-for-trading-hosts
  • clock-skew-correction-for-tick-timestamps
  • cross-datacenter-clock-sync-validation
  • execution-algorithm-kill-switch-integration
  • mifid-ii-algo-trading-compliance-eu

同梱ファイル

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

よくある質問

AIスキル「Clock Drift Monitoring Alerting Thresholds」では何ができますか?

報告対象イベントにタイムスタンプを付与するホストで、その用途に適用されるMiFID II RTS 25の時刻ずれ上限を超えていないことを確認する場合に使用します。PTPオフセットとデーモンの状態を評価し、上限超過時には停止状態をラッチします。クロックの調整は別のスキルで行います。

TypingMindでClock Drift Monitoring Alerting Thresholdsを使うメリットは何ですか?

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

TypingMindにClock Drift Monitoring Alerting Thresholdsをインストールするにはどうすればよいですか?

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

Clock Drift Monitoring Alerting Thresholdsを使えるAIモデルはどれですか?

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

Clock Drift Monitoring Alerting Thresholdsで使えるAIモデルの数に制限はありますか?

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

AIスキル「Clock Drift Monitoring Alerting Thresholds」は無料ですか?

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

AIスキルとは何ですか?

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

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

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

すべて見る

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

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