Agent skill

Cross-Market Signal Engine

by HKUDS in HKUDS/Vibe-Trading

Guides writing signal_engine.py for backtests that mix markets such as A-shares, crypto, US equities and forex, with per-market parameters and volatility-adjusted weights.

MITAuto-check passedBusiness, Finance & HR

Install Cross-Market Signal Engine

skills CLI
$ npx skills add HKUDS/Vibe-Trading --skill cross-market-strategy -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install HKUDS/Vibe-Trading cross-market-strategy --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/HKUDS/Vibe-Trading.git skills-src && mkdir -p .claude/skills && cp -r skills-src/agent/src/skills/cross-market-strategy .claude/skills/cross-market-strategy && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
cross-market-strategy
GitHub stars
35k
Token cost
~983 tokens
SKILL.md length
310 words
Files
2
Skills in repo
89
Repo updated
First seen
Licence
MIT

At a glance

Guides writing signal_engine.py for backtests that mix markets such as A-shares, crypto, US equities and forex, with per-market parameters and volatility-adjusted weights.

  • Works in 5 steps: Market Classification in generate() → Per-Market Parameter Tables → Volatility-Adjusted Weights (Critical) → …
  • Backtesting a portfolio that mixes A-shares with crypto or forex
  • SKILL.md covers When to Use, Key Concepts, config.json for Cross-Market and Market Detection Heuristics, plus 1 more section
  • Runs Python scripts from its folder

What it does

When a backtest uses symbols from different markets, for example 000001.SZ with BTC-USDT, the CompositeEngine handles trading calendar alignment, shared capital, per-market rules and commissions, so the strategy only has to emit per-symbol signals. The skill shows how to group symbols by market inside generate() and apply separate indicator settings, with a table giving A-shares, crypto, US equities and forex their own moving average, RSI and volatility lookback values.

It stresses volatility-adjusted weights, because crypto's much higher daily volatility would otherwise take the whole risk budget, and lists cross-market ideas such as momentum spillover, risk-on and risk-off overlays, hedging and switching behavior on the correlation regime. The matching config.json must set source to auto and extra_fields to null, and a borrowing multiplier that defaults to 1.0. An example_signal_engine.py file is included.

When your agent uses it

  • Backtesting a portfolio that mixes A-shares with crypto or forex
  • Setting different indicator parameters for each market
  • Weighting positions by volatility across assets with different risk levels
  • Writing the config.json for a cross-market run

Example prompts

  • “Write signal_engine.py for a backtest of 000001.SZ and BTC-USDT with a shared capital pool.”
  • “Backtest AAPL.US, EUR/USD and 600519.SH together and adjust the weights by volatility.”
  • “Which moving average and RSI settings suit the crypto leg versus the A-share leg?”
  • “Fix the config.json of my cross-market backtest so each symbol routes to its own loader.”

Requirements

  • A backtest runner with the CompositeEngine

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Market Classification in generate()
  2. Per-Market Parameter Tables
  3. Volatility-Adjusted Weights (Critical)
  4. Cross-Market Signal Patterns
  5. What the Engine Handles (Don't Worry About)

What it can do on your machine

Read from SKILL.md and the folder at commit 8e43007. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships script files (Python), which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Cross-Market Signal Engine loads about 983 tokens when it runs. Until then it costs about 32 tokens; SKILL.md has 310 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~32
When it runs · the whole SKILL.md, loaded when a task matches
~983

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from HKUDS/Vibe-Trading at commit 8e43007, republished under its MIT licence (© HKUDS). 310 words, ~983 tokens.

Download SKILL.mdSave it as .claude/skills/cross-market-strategy/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
cross-market-strategy
description
Write signal_engine.py for portfolios spanning multiple markets (A-shares + crypto, equity + forex, etc.)
category
strategy

When to Use

When the user requests a backtest with codes from different markets — e.g. ["000001.SZ", "BTC-USDT"], ["TD.TO", "PNG.V"], or ["AAPL.US", "EUR/USD", "600519.SH"].

The CompositeEngine handles calendar alignment, shared capital, and market rules automatically. The strategy only needs to output per-symbol signals.

Key Concepts

1. Market Classification in generate()

Group symbols by market type and apply market-specific indicator parameters:

python
def generate(self, data_map):
    groups = {}
    for code, df in data_map.items():
        market = self._detect_market(code)
        groups.setdefault(market, {})[code] = df

    signals = {}
    for market, market_data in groups.items():
        params = MARKET_PARAMS[market]
        for code, df in market_data.items():
            signals[code] = self._market_signal(df, params)
    return signals
2. Per-Market Parameter Tables

Different markets have very different dynamics. Using the same parameters everywhere produces poor results.

ParameterA-ShareCryptoUS EquityForex
MA fast571010
MA slow20255030
RSI period14101414
Vol lookback20142020
Typical daily vol1-2%3-8%1-2%0.3-0.8%
3. Volatility-Adjusted Weights (Critical)

BTC daily vol ~ 5%, A-share daily vol ~ 1.5%. Without vol-adjustment, crypto eats the entire risk budget.

python
def _vol_adjust(self, signals, data_map):
    vols = {}
    for code, df in data_map.items():
        ret = df["close"].pct_change(fill_method=None).dropna()
        vols[code] = ret.rolling(20).std().iloc[-1] if len(ret) > 20 else ret.std()

    inv_vols = {c: 1.0 / (v + 1e-10) for c, v in vols.items()}
    total_inv = sum(inv_vols.values())

    adjusted = {}
    for code, sig in signals.items():
        weight = inv_vols[code] / total_inv * len(signals)
        adjusted[code] = (sig * weight).clip(-1.0, 1.0)
    return adjusted
4. Cross-Market Signal Patterns
  1. Momentum spillover: BTC 7-day momentum as overlay for A-share tech sectors
  2. Risk-on/Risk-off: USD/CNH rate + VIX proxy to reduce equity exposure
  3. Hedging: Long A-shares + short crypto delta as tail hedge
  4. Correlation regime: When rolling correlation > 0.6, reduce to single-market exposure; when < 0.2, maximize diversification
5. What the Engine Handles (Don't Worry About)
  • Trading calendar alignment: signals are shifted on each symbol's own calendar, then ffill'd to unified dates
  • Market rules: T+1 for A-shares, funding fees for crypto, swap for forex — all per-symbol
  • Capital allocation: shared pool, strategy just sets target weights via signals
  • Commission/slippage: dispatched to correct sub-engine per symbol

config.json for Cross-Market

json
{
  "source": "auto",
  "codes": ["000001.SZ", "BTC-USDT"],
  "start_date": "2024-01-01",
  "end_date": "2025-03-31",
  "interval": "1D",
  "initial_cash": 1000000,
  "engine": "daily"
}
  • source must be "auto" for cross-market (routes each symbol to its loader)
  • extra_fields should be null (not all markets support fundamentals)
  • leverage defaults to 1.0 (CompositeEngine inherits from config)

Market Detection Heuristics

PatternMarket
000001.SZ, 600519.SHA-share
AAPL.USUS equity
700.HKHK equity
TD.TO, PNG.VCanada equity (TSX / TSXV)
BTC-USDTCrypto
IF2406.CFFEXChina futures
ESZ4Global futures
EUR/USDForex

Supporting Files

© HKUDS, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file in agent/src/skills/cross-market-strategy of HKUDS/Vibe-Trading.

  • SKILL.md
  • example_signal_engine.py

Open the folder on GitHubat commit 8e43007

Compare with similar skills

Cross-Market Signal Engine next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Cross-Market Signal Engine compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Cross-Market Signal Engine this skillHKUDS/Vibe-Trading35k—~983Automated safety check: PassMIT
Strategy Performance Reporttradesdontlie/tradingview-mcp6.8k2 repos~591Automated safety check: PassCustom licence
WorldQuant BRAIN Alpha ResearchQuantML-Research/wq-alpha-research407—~4.9kAutomated safety check: PassNone
Regimejackson-video-resources/markov-hedge-fund-method484—~1.6kAutomated safety check: PassCustom licence
Virtuals Protocol AcpVirtual-Protocol/openclaw-acp1681 repos~6.4kAutomated safety check: PassNone
lo2cin4bt Backtesting Assistantlo2cin4/lo2cin4bt289—~2.6kAutomated safety check: PassCustom licence

Similar skills

  • Strategy Performance Report

    tradesdontlie/tradingview-mcp

    Builds a performance report for a backtested Pine Script strategy from TradingView data, covering metrics, trades, the equity curve and improvement ideas.

    6.8k GitHub starsUsed in 2 repos~591 tokens
    Business, Finance & HRAuto-check passed
  • WorldQuant BRAIN Alpha Research

    QuantML-Research/wq-alpha-research

    Chinese-language playbook for WorldQuant BRAIN alphas: choose fields, write expressions, backtest, diagnose check failures, tune turnover, submit and build portfolios.

    407 GitHub stars~4.9k tokensUpdated 3 mo ago
    Business, Finance & HRAuto-check passed
  • Regime

    jackson-video-resources/markov-hedge-fund-method

    Detect the market regime (Bull / Bear / Sideways) for ANY asset and turn it into a tradeable signal or a risk filter.

    484 GitHub stars~1.6k tokensUpdated 4 mo ago
    Business, Finance & HRAuto-check passed
  • Virtuals Protocol Acp

    Virtual-Protocol/openclaw-acp

    Hire specialised agents to handle any task — data analysis, trading, content generation, research, on-chain operations, 3D printing, physical goods, gift delivery, and more.

    168 GitHub starsUsed in 1 repo~6.4k tokens
    Business, Finance & HRAuto-check passed
  • Guides an agent through installing, configuring and running local backtests in the lo2cin4bt repo, then explaining the results and fixing setup problems.

    289 GitHub stars~2.6k tokensUpdated 2 mo ago
    Business, Finance & HRAuto-check passed
  • Alpha Desk Investment Research

    JingHao-Leon/dsh-alpha-desk

    Runs an AI investment research desk around the aihf hedge-fund CLI, with research cycles, backtests and iFinD data, under a risk gate and a rule against placing real trades.

    181 GitHub stars~1.3k tokensUpdated 18 days ago
    Business, Finance & HRAuto-check: notes

More from HKUDS/Vibe-Trading

All 89 skills in this repo
  • Eastmoney Market Data

    HKUDS/Vibe-Trading

    Index of Eastmoney's free, no-token market data interfaces for China A-shares and Hong Kong stocks: fund flows, dragon-tiger lists, margin trading, reports and news.

    35k GitHub stars~1k tokensUpdated yesterday
    Auto-check passed
  • OKX Market Data

    HKUDS/Vibe-Trading

    Retrieves public OKX cryptocurrency market data such as spot prices, candlesticks, funding rates and open interest through the OKX V5 REST API, with no authentication.

    35k GitHub stars~1.3k tokensUpdated yesterday
    Auto-check passed
  • SEC EDGAR Filings Fetcher

    HKUDS/Vibe-Trading

    Fetches U.S. SEC EDGAR data: resolves tickers to CIK numbers, lists recent 10-K, 10-Q and 8-K filings with document URLs, and pulls XBRL financial series.

    35k GitHub stars~1.4k tokensUpdated yesterday
    Auto-check passed
  • A-Share ST Risk Screener

    HKUDS/Vibe-Trading

    Predicts whether a mainland China A-share company risks an ST or *ST warning after its next annual report, using financial thresholds and Sina penalty records.

    35k GitHub stars~4.9k tokensUpdated yesterday
    Auto-check passed
  • Breaks a structural trend such as AI infrastructure into its physical supply chain and ranks lesser-known listed companies sitting on each bottleneck.

    35k GitHub stars~2.7k tokensUpdated yesterday
    Auto-check passed
  • Plans and drafts an eight-part, roughly 120k-word investigative series on one company, built around a strict fact-check pass rather than fast drafting.

    35k GitHub stars~2.4k tokensUpdated yesterday
    Auto-check passed

Questions about Cross-Market Signal Engine

What does Cross-Market Signal Engine do?

Guides writing signal_engine.py for backtests that mix markets such as A-shares, crypto, US equities and forex, with per-market parameters and volatility-adjusted weights. SZ with BTC-USDT, the CompositeEngine handles trading calendar alignment, shared capital, per-market rules and commissions, so the strategy only has to emit per-symbol signals. The skill shows how to group symbols by market inside generate() and apply separate indicator settings, with a table giving A-shares, crypto, US equities and forex their own moving average, RSI and volatility lookback values.

When should I use Cross-Market Signal Engine?

Cross-Market Signal Engine fits situations like: backtesting a portfolio that mixes A-shares with crypto or forex; setting different indicator parameters for each market; weighting positions by volatility across assets with different risk levels; writing the config.json for a cross-market run.

How do I install Cross-Market Signal Engine in Claude Code?

Run `npx skills add HKUDS/Vibe-Trading --skill cross-market-strategy -a claude-code`. Or copy the skill folder (agent/src/skills/cross-market-strategy in HKUDS/Vibe-Trading) into .claude/skills/cross-market-strategy in your project. Claude Code loads it when a task matches its description.

How do I install Cross-Market Signal Engine in Codex?

Run `npx skills add HKUDS/Vibe-Trading --skill cross-market-strategy -a codex`. Or copy the skill folder (agent/src/skills/cross-market-strategy in HKUDS/Vibe-Trading) into .agents/skills/cross-market-strategy in your project. Codex loads it when a task matches its description.

Can I use Cross-Market Signal Engine in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add HKUDS/Vibe-Trading --skill cross-market-strategy -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/cross-market-strategy, .gemini/skills/cross-market-strategy, .github/skills/cross-market-strategy and .opencode/skills/cross-market-strategy in your project.

What does Cross-Market Signal Engine need to run?

Going by SKILL.md and its folder, Cross-Market Signal Engine needs Python for the scripts in its folder. Our summary lists: A backtest runner with the CompositeEngine.

Does Cross-Market Signal Engine access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Cross-Market Signal Engine safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Cross-Market Signal Engine use?

Cross-Market Signal Engine is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Cross-Market Signal Engine use?

About 983 tokens (SKILL.md is roughly 3.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Cross-Market Signal Engine?

Skills that share tags, products or a category with Cross-Market Signal Engine: Strategy Performance Report (tradesdontlie/tradingview-mcp, 6.8k stars), WorldQuant BRAIN Alpha Research (QuantML-Research/wq-alpha-research, 407 stars), Regime (jackson-video-resources/markov-hedge-fund-method, 484 stars) and Virtuals Protocol Acp (Virtual-Protocol/openclaw-acp, 168 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Cross-Market Signal Engine?

HKUDS (a GitHub organization) maintains it in HKUDS/Vibe-Trading, which has 35,163 GitHub stars. The repository holds 89 skills in this directory. The repository was last updated on October 10, 2026.

Source: HKUDS/Vibe-Trading on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.