explaingit

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

Analysis updated 2026-06-24

120PythonAudience · developerComplexity · 3/5LicenseSetup · easy

TLDR

Claude Code plugin that labels price history into Bull, Bear, Sideways days, builds a transition matrix, and runs a walk-forward backtest with Sharpe and drawdown.

Mindmap

mindmap
  root((markov-hedge-fund))
    Inputs
      Ticker symbol
      CSV price file
      Window size
    Outputs
      Regime labels
      Transition matrix
      Backtest report
    Use Cases
      Quant tutorial
      Regime detection
      Walk-forward test
    Tech Stack
      Python
      Claude Code
      yfinance
      hmmlearn
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Install a quant analysis idea as a Claude Code slash-command plugin and run it on any ticker.

USE CASE 2

Run a walk-forward backtest of a Markov regime signal and inspect Sharpe and max drawdown.

USE CASE 3

Apply the bonus Pine Script v5 indicator to a TradingView chart to view the regime ribbon.

USE CASE 4

Paste the zero-trust Markdown prompt into Claude Code agent mode to rebuild the skill from scratch.

What is it built with?

PythonClaude Codeyfinancehmmlearnuv

How does it compare?

jackson-video-resources/markov-hedge-fund-methodvirtualluoucas/chronicles-ocrupload-post/avatar-mix
Stars120116112
LanguagePythonPythonPython
Setup difficultyeasyhardhard
Complexity3/54/54/5
Audiencedeveloperresearchervibe coder

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Dependencies resolve on first run via uv PEP 723 inline metadata, no API keys needed.

MIT license, very permissive, use freely with attribution.

In plain English

This repository is the companion code for the first video in a quant trading series. It packages a single analysis idea as a Claude Code plugin so that a user can install it with two slash commands and then ask Claude in plain English to run it against any asset. The framework was designed by someone named Roan, and the repo owner is the person installing it on camera. The analysis is a Markov regime detector. For a given price series it labels each day as Bull, Bear, or Sideways based on rolling returns over a configurable window with a default of 20 days and plus or minus 5 percent. From that history it builds a 3 by 3 transition matrix using maximum likelihood, raises the matrix to powers to forecast several steps ahead, and computes the long-run stationary distribution. It then emits a signed signal equal to the probability of bull minus the probability of bear, runs a walk-forward backtest without lookahead and reports Sharpe ratio and maximum drawdown, and can optionally fit a Hidden Markov Model using the hmmlearn library. Input data can come from a ticker symbol fetched through yfinance or from a user-supplied CSV with a date and close column. No API keys or accounts are needed because the dependencies are resolved on first run by uv through PEP 723 inline metadata. The README also offers a zero-trust alternative: a single Markdown prompt file that, when pasted into Claude Code in agent mode, builds the same skill from scratch on the user's own machine, which was the version recorded in the on-camera demo. A bonus folder contains a Pine Script v5 indicator for TradingView that paints the regime ribbon and shows the transition matrix and stationary distribution on a chart. License is MIT.

Copy-paste prompts

Prompt 1
Install markov-hedge-fund-method as a Claude Code plugin and run the regime detector against SPY for the past 5 years with a 20-day window.
Prompt 2
Modify the Markov regime thresholds from plus or minus 5 percent to 3 percent and re-run the backtest on QQQ. Show the new Sharpe and drawdown.
Prompt 3
Write a Python script that loads a CSV of BTC daily closes, feeds it to this plugin, and forecasts the regime probability 10 days ahead.
Prompt 4
Walk me through how the transition matrix is raised to powers to forecast multi-step regime probabilities. Use the code in this repo.
Prompt 5
Compare the Markov 3-state classifier in this repo with the optional hmmlearn HMM fit. When does each give a better signal?

Frequently asked questions

What is markov-hedge-fund-method?

Claude Code plugin that labels price history into Bull, Bear, Sideways days, builds a transition matrix, and runs a walk-forward backtest with Sharpe and drawdown.

What language is markov-hedge-fund-method written in?

Mainly Python. The stack also includes Python, Claude Code, yfinance.

What license does markov-hedge-fund-method use?

MIT license, very permissive, use freely with attribution.

How hard is markov-hedge-fund-method to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is markov-hedge-fund-method for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.