How to use AI for quant trading strategies

Updated Nov 13, 2026 · 13 min read

Use AI to turn a trading idea into explicit rules, test it against real costs and run it as code. A step-by-step workflow on Senpi for Hyperliquid perps.

Use AI for the research and the engineering, and let tested code do the trading. AI is good at turning a trading idea into explicit rules, writing the code and attacking the results. It is a poor judge of its own backtests, and a language model shouldn’t be deciding trades live. With Senpi you can work two ways. You can research and write strategies in the AI you already use (Claude, ChatGPT, Grok, Muse or Hermes, connected to Senpi), or you can do it all directly on Senpi. Either way, you describe the strategy in plain English and approve its rules, and Senpi’s runtime trades those rules as code on Hyperliquid, 24/7, exiting through a ratcheting stop and within the loss limits you set.

Key takeaways

  • Use your own AI or Senpi’s. Connect Claude, ChatGPT, Grok, Muse or Hermes to Senpi, then research and write strategies there. Or do everything in the Senpi app. The strategy runs on Senpi either way.
  • Split the jobs. AI builds and reviews the strategy; code trades it. On Senpi, no AI model makes live trading decisions by default.
  • Start narrow. “Find me a profitable strategy” can’t be tested. “Test whether this observable behaviour predicts the next 24 hours” can.
  • Price every cost. On Hyperliquid, a taker round trip costs 0.09% of notional at the base fee tier, and funding is paid every hour. In Senpi’s study of 475 Hyperliquid trader books, 84% carried a fixable taker-fee leak.
  • Treat every backtest as a claim to attack. Vary the period, the costs and the parameters, and log every variant you try.
  • Go live small. Senpi has no paper-trading mode yet. A strategy is tested with a validation run and a small live budget, with a daily loss limit and a drawdown halt set.
  • Past results describe one window. They are not a forecast.

Use your own AI, or do it all on Senpi

You don’t have to switch assistants. Connect the AI you already use to Senpi and research and write strategies there, or do everything in the Senpi app. Either way, the strategy runs on Senpi’s runtime under the same rules and approvals.

Your own AI, connected to SenpiDirectly on Senpi
Where you workClaude, ChatGPT, Grok, Muse or HermesThe Senpi web and mobile apps
ResearchYour assistant reads Senpi’s market data: market pulse, smart-money positioning, market signals and trader researchSenpi’s agent reads the same data
Writing the strategyYour assistant asks Senpi’s agent to build it, one decision at a timeSenpi’s agent interviews you, one decision at a time
ApprovalsBefore a trade is placed or changed, you choose Allow once or Deny, unless you’ve set a standing approval in the Senpi appSame
Running itSenpi’s runtime, 24/7Senpi’s runtime, 24/7
Senpi Connectors and the Senpi app, Nov 10, 2026.

Connecting takes one address, https://agents.senpi.ai/mcp, and your Senpi sign-in, with no API keys to paste. The setup steps for each app are in Can ChatGPT or Claude trade crypto?. Developers can add the same address as a custom connector in Claude Code or Codex. The open-source Senpi — AI Quant plugin brings Senpi’s research tools to Cursor and other coding agents; it is read-only and can’t place trades.

Two ways to use AI in a strategy

AI can build the strategy, or it can be part of the strategy. Start with the first: it gives you a research process you can trust before you add model complexity.

ApproachWhat AI doesHow it works on Senpi
AI builds the strategyResearches the idea, writes the rules and the code, checks the data, attacks the resultsThe agent interviews you one decision at a time, then writes the strategy: what to trade, how to score it, how to exit and how much to risk. After it runs, the agent reviews your closed trades.
AI is part of the strategyA model produces the signals while the strategy runsBy default, Senpi keeps language models out of the live path: a strategy’s scanner scores markets in code, from data such as price, funding, open interest and smart-money positioning. A strategy can add an optional model check that can block a trade; none of the current templates uses one.

Senpi draws the line there on purpose:

  • Code is reproducible. The same inputs give the same trade, so a live result can be compared with what the rules said.
  • Code is auditable. The strategy is a readable package, and Senpi’s strategy templates are open source on GitHub.
  • It’s cheaper to run. Senpi’s runtime supervises a strategy around the clock without spending AI credits. Credits pay for conversations, not for a strategy that is already running.

A practical workflow on Senpi

  1. 01

    Choose a narrow problem

    Pick the market, the timeframe and what you’re measuring against, such as holding BTC. Hyperliquid’s perps cover about 180 crypto markets and about 120 XYZ markets for stocks, indices, commodities and FX, all trading 24/7. Decide your budget, your largest acceptable drawdown, your leverage and whether shorting is allowed. On Senpi these become the strategy’s guard rails: a daily loss limit, a drawdown halt, a cap on entries per day and a leverage limit.

  2. 02

    Turn the idea into a testable hypothesis

    Describe it in plain English, in the Senpi app or in your own assistant, for example a mean-reversion rule. Senpi’s agent asks one decision at a time: what to trade, how to score it, how to exit, how much to risk. It reads the whole spec back to you before it writes any code. If a template is close to your idea, start from it instead: it deploys under your name and you change its levers.

  3. 03

    Audit the data

    Hyperliquid’s public API is the primary source, and it has limits that shape any test. It serves only the latest 5,000 candles per interval: about 3.6 days of 1-minute bars, 208 days of hourly bars and 833 days of 4-hour bars. 56 of the 235 perps listed on the main book are delisted, so a test that uses today’s list alone carries survivorship bias. Timestamps are UTC. At weekends, XYZ stock perps are priced from Hyperliquid’s own order book (how to trade stocks on Hyperliquid).

  4. 04

    Write the rules and price the costs

    Say when a signal forms, how orders execute, how positions are sized and how they exit. On Senpi, the runtime sizes each position as a share of the account and places orders maker-first to save fees. It exits through DSL: a protective floor first, then profit locks that only move up. Count the fees, the hourly funding and the slippage a stop pays when it fires.

  5. 05

    Use AI to attack the results

    Ask the agent to try other periods, higher costs, delayed fills and nearby parameters, and to check whether a few trades carry the whole result (profit factor helps here). Keep a log of every variant: picking the best of many tries is how backtests overfit. If a template cites a replay, read it as one past window, not a result.

  6. 06

    Validate, then go live small

    Build on earlier data, test on later data and keep a final window you never touch. Senpi has no paper-trading mode yet, so a strategy is tested in two steps. First, a validation run proves it runs. Then it goes live at its minimum budget, with the daily loss limit and the drawdown halt on. Every fill is public on Hyperliquid, so you can compare live fills with what the test assumed. After it’s live, ask the agent to review your closed trades for fees, exits and sizing.

Paper trading

Senpi doesn’t run backtests; Simulations, paper trading with simulated money, are coming. Until they ship, the smallest live run is the test.

Hyperliquid checks before you trust a backtest

Most strategies that fail live fail on these points, not on the idea itself.

CheckWhy it mattersHyperliquid, Nov 10, 2026
Taker feesEvery market entry and exit pays the taker rate0.045% taker and 0.015% maker at the base tier. A taker round trip is 0.09% of notional, or 0.45% of margin at 5x.
Stock-perp feesXYZ markets in growth mode cost less, but not all of them are0.009% taker on most XYZ markets; 0.09% on GOLD, MSTR and three others
FundingPaid every hour between longs and shortsInterest component of 0.01% per 8 hours, about 11.6% a year paid to shorts, plus a premium. Capped at 0.5% an hour.
Price historyThe public API keeps only the latest 5,000 candles per intervalAbout 3.6 days of 1-minute bars, 208 days of hourly bars, 833 days of 4-hour bars
Delisted marketsTesting only today’s markets hides the losers56 of 235 main-book perps are delisted
Weekend stock pricesXYZ trades 24/7, but stock exchanges don’tAt weekends, stock perps are priced from Hyperliquid’s own order book within set bounds, so expect gaps when markets reopen
Leverage limitsMaximum leverage differs by market and falls for large positionsBTC 40x, ETH 25x, most single stocks 10x, the largest such as Nvidia and Tesla 20x
StopsA stop that fires crosses the spreadStops fill as taker orders, and market TP/SL orders accept up to 10% slippage
Sources: Hyperliquid docs on fees, funding and TP/SL, and the Hyperliquid API, Nov 10, 2026.

Check the code an AI wrote

An AI writes plausible strategy code fast, and the most common bug in it doesn’t show in the results: the strategy uses information it wouldn’t have had when the order went in. Check these before you trust any number:

  • Lookahead. Every signal must use only data that existed before the order. A rule computed on a bar’s close can trade only from the next bar; code that trades on the current bar’s close, high or low, or on a daily value before the day ends, is peeking.
  • Survivorship. Test on the markets that existed at the time, delisted ones included, not only today’s list.
  • Costs. Charge taker fees on every market order and stop, slippage, and hourly funding, as in the table above. Code that leaves them out overstates every result.
  • Timestamps. Hyperliquid’s candles are stamped with the time the bar opens. Check time zones and gaps, and apply funding at the hour it was paid.
  • Overfitting. Count the variants you tried, and keep a test period the AI never saw.

A worked example of lookahead. On a random walk, where no rule can have an edge, the same 20-bar trend rule “earns” +623% when it trades the bar its signal was computed on, and +8%, which is noise, when it trades the next bar:

python
import random

random.seed(7)
closes = [100.0]
for _ in range(2000):                      # a random walk: there is no real edge to find
    closes.append(closes[-1] * (1 + random.gauss(0, 0.01)))

def backtest(delay):
    pnl = 0.0
    for t in range(20, len(closes) - 1):
        ma = sum(closes[t - 19:t + 1]) / 20                # 20-bar average, includes the close of bar t
        signal = 1 if closes[t] > ma else -1                # long above the average, short below
        i = t + delay                                       # delay=0 earns bar t's own move: lookahead
        pnl += signal * (closes[i] / closes[i - 1] - 1)
    return pnl

print(f"trading the bar the signal was computed on: {backtest(0):+.0%}")
print(f"trading the next bar:                       {backtest(1):+.0%}")

Ask the AI to do the same to its own code: move every signal one bar later and rerun. If most of the edge disappears, it was lookahead. Then ask it for a test that fails whenever a signal reads a value from the bar it trades or later.

Prompts to start with

These work in the Senpi app, and in Claude, ChatGPT, Grok, Muse or Hermes once it’s connected to Senpi.

Turn an idea into a test

text
Act as a skeptical quant research partner. I want to test this idea: [your idea].
Before you build anything, give me the reason it might work, the data and timestamps
it needs, the exact entry, exit and sizing rules, the benchmark, the costs on
Hyperliquid (fees, funding and slippage) and the result that would make us reject it.
Start with the simplest version, list every variation we try, and don't call it
profitable from a backtest alone.

Start from a template

text
Which Senpi template is closest to this idea, and which of its levers would I change?
[your idea]

Set the guard rails before it goes live

text
Before this strategy goes live, set a daily loss limit and a drawdown halt on it,
and tell me what one stop-out costs as a share of the account.

Review what happened

text
Review my closed trades from the last 30 days. Where did fees, exits or sizing
cost me the most?

Read the market first

text
What does smart-money positioning look like on HYPE right now, and is it crowded?

Frequently asked questions

Can AI build a quant trading strategy?

Yes, as a research and engineering partner. It can turn an idea into explicit rules, write the code and help test it. Testing against real costs decides whether the strategy deserves money; the model doesn’t.

Does an AI model make the trades on Senpi?

Not by default. Senpi’s agent helps you design the strategy, and you approve the rules. From then on, the rules run as code on Senpi’s runtime. A strategy can add an optional model check that can block a trade, but none of the current templates uses one.

Does using AI make a strategy profitable?

No. AI makes it faster to build and test ideas, which also makes it faster to produce convincing backtests that don’t hold up. Its most useful job is often finding the reason to reject a strategy.

How do I check trading code an AI wrote?

Shift every signal one bar later and rerun the test: if most of the edge disappears, the code was reading the future. Then check that delisted markets are included, that taker fees, slippage and funding are charged, and how many variants were tried.

Can I backtest a strategy on Senpi?

Senpi doesn’t run backtests; Simulations, paper trading with simulated money, are coming. Some strategy templates cite a replay over a stated window: read it as one past window, not a result. A strategy is checked with a validation run, then a small live run.

Can I paper trade on Senpi?

Not yet: Simulations, paper trading with simulated money, are coming. Until then a strategy is tested with a validation run and then a live run at its minimum budget, with loss limits set.

Do I need to know how to code?

No. You describe the strategy in plain English, and the agent writes it. The result is a readable package, and Senpi’s templates are open source on GitHub, so you can see exactly what a strategy runs.

Which markets can a Senpi strategy trade?

Hyperliquid perpetual futures, around the clock: about 180 crypto markets and about 120 XYZ markets for stocks, indices, commodities, FX and pre-IPO names. Senpi doesn’t trade spot.

Can I use ChatGPT or Claude to build a trading strategy?

Yes. Connect Claude, ChatGPT, Grok, Muse or Hermes to Senpi, then research and write strategies in the assistant you already use. Or do it all directly in the Senpi app. Either way, the strategy runs on Senpi’s runtime, and nothing goes live until you approve its rules.

What does it cost?

Paid plans start at $50 a month and add no Senpi trading fee; Hyperliquid’s own fees still apply. The free trial includes $10 of AI credits and carries a 0.03% Senpi fee, as does trading without a paid plan. A strategy that’s already running uses no AI credits.

Sources and date

Senpi’s open-source strategy skills and README on GitHub; senpi.ai/security; senpi.ai/pricing; AI credits explained; Senpi’s fixable-leaks study (475 band books); Hyperliquid’s docs on fees, funding and TP/SL; the Hyperliquid API, Nov 10, 2026 (candle history measured on BTC; 235 main-book perps listed, 179 live; 122 XYZ markets). Nothing on this page is financial advice.

Build your first strategy with Senpi

Describe it in plain English. Senpi’s agent writes the rules for you to approve, and the runtime trades them 24/7.

Open Senpi
Share

Related articles