Adaptive Sampling Under Extreme Tick Rates logo

Adaptive Sampling Under Extreme Tick Rates

Community
HimanshuJ16
adaptive-sampling-under-extreme-tick-rates

Use when a trade-tick stream exceeds a consumer's measured processing ceiling and you must emit 1:N samples that still preserve traded volume and notional. Not for order-book, quote or compliance feeds that need every message.

Overview

PublisherHimanshuJ16
RepositoryAlgo-Trading-Skills
Skill nameadaptive-sampling-under-extreme-tick-rates
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 Adaptive Sampling Under Extreme Tick Rates 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/adaptive-sampling-under-extreme-tick-rates
  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/adaptive-sampling-under-extreme-tick-rates .claude/skills/adaptive-sampling-under-extreme-tick-rates
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Adaptive Sampling Under Extreme Tick Rates 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 Adaptive Sampling Under Extreme Tick Rates 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 Adaptive Sampling Under Extreme Tick Rates 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 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

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 Adaptive Sampling Under Extreme Tick Rates AI skill do?

Use when a trade-tick stream exceeds a consumer's measured processing ceiling and you must emit 1:N samples that still preserve traded volume and notional. Not for order-book, quote or compliance feeds that need every message.

Why use Adaptive Sampling Under Extreme Tick Rates on TypingMind?

Because you install it once and use it with any model. Adaptive Sampling Under Extreme Tick Rates 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 Adaptive Sampling Under Extreme Tick Rates in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/HimanshuJ16/Algo-Trading-Skills/tree/main/skills/adaptive-sampling-under-extreme-tick-rates. 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 Adaptive Sampling Under Extreme Tick Rates?

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 Adaptive Sampling Under Extreme Tick Rates?

As many as you like. As long as a model supports skills, you can use Adaptive Sampling Under Extreme Tick Rates with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Adaptive Sampling Under Extreme Tick Rates 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 👇