Logo di Regime

Regime

Organizzazione
jackson-video-resources
regime

Detect the market regime (Bull / Bear / Sideways) for ANY asset and turn it into a tradeable signal or a risk filter. Use this whenever the user wants regime detection, a regime-aware confirmation on an existing strategy, a regime risk gate, regime-based position sizing, a Markov transition matrix, n-step regime forecasting, a stationary regime mix, or a no-lookahead walk-forward regime backtest — on a ticker (via yfinance) or on the user's own CSV price series. Composes into any existing trading agent or strategy without rewriting it. Framework by Roan (@RohOnChain).

Panoramica

Pubblicato dajackson-video-resources
Repositorymarkov-hedge-fund-method
Nome della skillregime
Stelle
490
Fork
228
File inclusi
Solo istruzioni
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • Tutto nelle istruzioni

    Tutto ciò che serve al modello è nelle istruzioni: nessun file aggiuntivo da sincronizzare.

  • Open source

    Pubblicata da jackson-video-resources su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Regime in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/jackson-video-resources/markov-hedge-fund-method/tree/main/skills/regime
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Aggiungi skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella della skill nella directory delle skill di quell'agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/jackson-video-resources/markov-hedge-fund-method.git /tmp/markov-hedge-fund-method
mkdir -p .claude/skills
cp -r /tmp/markov-hedge-fund-method/skills/regime .claude/skills/regime
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Regime in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Regime non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Regime non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

Regime — Markov regime detection for any asset

This skill answers one question for any asset: what regime are we in, how sticky is it, and what does that imply for risk and direction? It's built to slot into a trading agent the user already has — as a confirmation layer, a signal, or a risk gate — without them rewriting their strategy.

Framework: Roan (@RohOnChain). Refactored into this plugin by Lewis Jackson. Backtests are historical, not forward-looking.

How to invoke

One command. It takes EITHER a ticker OR the user's own CSV, so it drops into any pipeline regardless of asset:

bash
# any ticker yfinance knows (stocks, ETFs, crypto, FX, futures):
uv run ${CLAUDE_PLUGIN_ROOT}/scripts/markov_regime.py --ticker BTC-USD --json

# the user's own price file (their data, their asset, their pipeline):
uv run ${CLAUDE_PLUGIN_ROOT}/scripts/markov_regime.py --csv ./my_prices.csv --json
  • Drop --json for the on-camera pretty terminal output (matrix, persistence diagonal, stationary mix, walk-forward Sharpe + max DD, HMM line).
  • --csv needs only a date column and a close column. It auto-detects common names (date/time/timestamp, close/adj close/price/last); if there's exactly one numeric column it uses that. No reformatting required.
  • Defaults: --window 20, --threshold 0.05 (±5%), --years 10, --min-train 252. All overridable. --no-hmm skips the HMM.
  • First uv run resolves dependencies once (~10–20s), then it's instant.

The JSON contract (every field)

--json prints exactly one JSON object to stdout and nothing else. On failure it prints {"error": "..."} and exits non-zero. Fields:

FieldTypeMeaning
sourcestrthe ticker or CSV path analysed
rowsintnumber of price rows used
date_start, date_endstrISO dates of the window
paramsobjwindow, threshold, min_train actually used
stateslist["Bear","Sideways","Bull"] — fixed index order 0,1,2
current_regimestrthe regime as of the last bar
next_state_probabilitiesobjbear/sideways/bull — P(next | current)
signalfloatbull_prob − bear_prob in [-1, 1]. >0 long bias, <0 short bias, magnitude = conviction
transition_matrix3×3 listrow = from-state, col = to-state, rows sum to 1
persistence_diagonalobjbear/sideways/bull — P(stay in same regime). High = sticky regime
stationary_distributionobjbear/sideways/bull — long-run fraction of time in each regime, sums to 1
walk_forwardobjsharpe, max_drawdown, n_trades from a re-estimated-every-step, no-lookahead backtest. sharpe/max_drawdown may be NaN if history is too short
hmmobjavailable: true → regimes (label, latent_state, mean_daily_return) + caveat. available: false → reason (graceful degrade — everything else is still valid)
framework, disclaimerstrattribution + "historical, not forward-looking"

signal and current_regime are the two fields most strategies consume. stationary_distribution is the one most risk layers consume.

Composition — slot it into what the user already has

The user already has a trading agent or strategy on some asset. This skill is a layer they add, not a system they adopt. Run it, read one or two fields, gate their existing logic. Three patterns:

(a) Regime confirmation on an existing momentum/strategy

The user has entry logic that already fires. Wrap it: only take longs when the regime agrees, only short when it disagrees.

python
import json, subprocess
r = json.loads(subprocess.check_output(
    ["uv","run",f"{PLUGIN}/scripts/markov_regime.py","--ticker","SPY","--json"]))

if my_strategy_says_long and r["signal"] > 0:
    enter_long()          # momentum + regime agree → take it
elif my_strategy_says_long and r["signal"] <= 0:
    skip()                # momentum says go, regime says don't → stand down

One line of gating. Their strategy is untouched; the regime just vetoes trades that fight the prevailing chain.

(b) Stationary distribution as a tail-risk / position-size filter

The stationary mix is the asset's long-run baseline. A high baseline Bear share means this asset structurally spends a lot of time in drawdown — size down.

python
bear_baseline = r["stationary_distribution"]["bear"]
size = base_size * (1.0 - bear_baseline)      # heavier bear regime → smaller bets
# or hard gate: if bear_baseline > 0.40: size = 0   # too tail-heavy to trade

No new model. The user keeps their sizing logic and scales it by a single number that reflects how regime-dangerous the asset actually is.

(c) Standalone signal

No existing strategy needed. The signal field is already a direction + conviction in [-1, 1]:

python
position = r["signal"]        # +0.6 → 60% long; -0.4 → 40% short; ~0 → flat

Sanity-check it first with the printed walk-forward Sharpe + max drawdown (run without --json to see them on screen) before sizing real capital.

Notes

  • Asset-agnostic by design. --ticker for anything yfinance covers; --csv for the user's own data on any asset/timeframe their pipeline produces. The math is identical either way.
  • No lookahead. The walk-forward refits the matrix using only past data at every step (incremental O(n), bit-identical to a from-scratch rebuild).
  • HMM degrades gracefully. If hmmlearn can't compile (e.g. Windows without MSVC), hmm.available is false with a reason and every other field is still correct. HMM states are labelled by ascending mean return, so a positive "Bear" mean just means the worst latent state was still net-positive over that window.
  • Defaults match the on-camera demo and the Pine Script bonus (window 20, ±5%). Use --threshold 0.02 to reproduce the tighter labelling from the original onboarding prompt.

Domande frequenti

Cosa fa la skill IA Regime?

Detect the market regime (Bull / Bear / Sideways) for ANY asset and turn it into a tradeable signal or a risk filter. Use this whenever the user wants regime detection, a regime-aware confirmation on an existing strategy, a regime risk gate, regime-based position sizing, a Markov transition matrix, n-step regime forecasting, a stationary regime mix, or a no-lookahead walk-forward regime backtest — on a ticker (via yfinance) or on the user's own CSV price series. Composes into any existing trading agent or strategy without rewriting it. Framework by Roan (@RohOnChain).

Perché usare Regime su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Regime è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che la skill smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Regime in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/jackson-video-resources/markov-hedge-fund-method/tree/main/skills/regime. TypingMind legge il file SKILL.md e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Regime?

Qualsiasi modello che colleghi a TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Regime?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Regime: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Regime è gratuita?

È pubblicata su GitHub da jackson-video-resources. Consulta il repository per i termini di licenza. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, template o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Elenco completo

Crea subito il tuo spazio di lavoro AI

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇