Ml4t Live Trading logo

Ml4t Live Trading

Organization
ml4t
ml4t-live-trading

Transition from backtest to live trading with zero code changes. Use when deploying a validated strategy to paper or live trading via broker APIs.

Overview

Publisherml4t
Repositoryskills
Skill nameml4t-live-trading
Stars
45
Forks
13
Bundled files
Instructions only
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.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by ml4t on GitHub. Read the source before you install it.

Installation

Install the Ml4t Live Trading 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/ml4t/skills/tree/main/production/live-trading
  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/ml4t/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/production/live-trading .claude/skills/ml4t-live-trading
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Ml4t Live Trading 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 Ml4t Live Trading 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 Ml4t Live Trading 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.

Backtest-to-Live Deployment

Rewriting strategy logic for live trading introduces bugs and invalidates your backtest. The correct pattern is to reuse the exact Strategy class from backtesting - zero code changes between simulation and production.

The Problem

Teams often validate a strategy in backtest, then rewrite it for live trading. That rewrite changes rounding, timing, or position tracking and silently breaks the link to the validated backtest.

The Pattern

WRONG

python
# Separate live strategy - rewrites logic, diverges from backtest
class LiveMomentumTrader:
    def __init__(self, api_key):
        self.api = BrokerAPI(api_key)

    def run(self):
        while True:
            prices = self.api.get_latest_bars(100)
            signal = prices["close"].pct_change(20).iloc[-1]
            if signal > 0:
                self.api.market_buy("SPY", 100)  # Different sizing logic
            elif signal < 0:
                self.api.market_sell("SPY", 100)  # No cost model
            time.sleep(60)

CORRECT

python
from abc import ABC, abstractmethod

class Strategy(ABC):
    """Single strategy class used for BOTH backtest and live."""

    @abstractmethod
    def on_data(self, timestamp, data, context, broker):
        ...

class Momentum(Strategy):
    def on_data(self, timestamp, data, context, broker):
        for sym, bar in data.items():
            mom = bar.get("momentum_20d", 0)
            pos = broker.get_position(sym)
            if mom > 0 and not pos:
                size = int(broker.get_cash() * 0.05 / bar["close"])
                broker.submit_order(sym, size)
            elif mom <= 0 and pos:
                broker.close_position(sym)

# Backtest: Engine(feed, Momentum(), config).run()
# Live:     await LiveEngine(Momentum(), broker, feed).run()
# Same class. Same logic. Different engine.

Deployment Sequence

  1. Backtest - validate with historical data, realistic costs
  2. Paper trade (minimum 4 weeks) - same code, live data, simulated fills
  3. Shadow mode - generate orders but don't execute; compare to paper
  4. Live with limits - small size, tight kill switch, full monitoring
  5. Scale up - increase size only after live metrics match paper

Never skip paper trading. If paper diverges materially from backtest, diagnose before going live.

Data Feed Differences

PropertyBacktestLive
Data arrivalInstant, completeStreaming, may lag
BarsAll presentBuild incrementally
FillsSimulated, next-barReal, partial, rejected
ClockJump bar to barReal-time wall clock

Guardrails

  • Identical Strategy class for backtest and live - if you change one, you broke the link
  • Paper trade period is mandatory, not optional - 4 weeks minimum for daily strategies
  • Kill switch must be active before any live order: max drawdown, max position, daily loss limit
  • Log every order submission, fill, and rejection - you will need the audit trail
  • Data staleness check: if last bar is older than 2x expected frequency, halt trading

Production Implementation

python
import asyncio
from ml4t.backtest import Strategy
from ml4t.live import LiveEngine, AlpacaBroker, AlpacaDataFeed, SafeBroker, LiveRiskConfig

risk = LiveRiskConfig(execution_mode="shadow", max_drawdown_pct=0.10)
broker = SafeBroker(AlpacaBroker(api_key, secret_key), risk)
feed = AlpacaDataFeed(api_key, secret_key, symbols=["SPY"], experimental=True)

async def trade_live():
    engine = LiveEngine(Momentum(), broker, feed)
    await engine.connect()
    await engine.run()

asyncio.run(trade_live())

Checklist

  • Strategy class is identical for backtest and live (no separate live code)
  • Paper traded for minimum 4 weeks with live data
  • Kill switch configured with pre-approved thresholds
  • Partial fill handling verified
  • Data staleness detection active; order audit log captures every submission and fill

Frequently asked questions

What does the Ml4t Live Trading AI skill do?

Transition from backtest to live trading with zero code changes. Use when deploying a validated strategy to paper or live trading via broker APIs.

Why use Ml4t Live Trading on TypingMind?

Because you install it once and use it with any model. Ml4t Live Trading 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 Ml4t Live Trading in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/ml4t/skills/tree/main/production/live-trading. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Ml4t Live Trading?

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 Ml4t Live Trading?

As many as you like. As long as a model supports skills, you can use Ml4t Live Trading with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Ml4t Live Trading AI skill free?

Yes. It is published on GitHub by ml4t 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 👇