Agentic tradingDevelopersRiskMCP

How to start LLM-powered trading through a single API

Learn how to start LLM-powered trading across stocks, crypto, perps, options, and prediction markets through one API while keeping custody and enforcing hard limits.

By the Felix team8 min read
Key takeaways
  • 01A single API normalizes five market types so an LLM can trade stocks, crypto, perps, options, and prediction markets without learning venue-specific contract math.
  • 02Agents connect through MCP tools or a REST API, but the LLM never holds unscoped keys; safety controls are enforced at the infrastructure layer.
  • 03Your funds remain in a wallet you control; the agent can spend within scoped limits but cannot withdraw to itself or any owner-unapproved address.
  • 04Before live trading, use paper trading, scoped keys, budget caps, position limits, and a verified panic switch to contain downside.
  • 05Live trading requires explicit owner authorization of a scoped key; start with capital you can afford to lose entirely because trading carries real risk of loss.

You can connect a large language model to real markets through one API that normalizes stocks, crypto, perpetual futures, options, and prediction markets into a single interface. The agent receives market data, reasons in natural language, and sends orders denominated in plain US dollars, while the API handles contract sizing, venue formatting, and safety enforcement. You keep custody of your funds, approve withdrawal addresses, and set hard limits that the agent cannot override. This turns an LLM from a chat tool into a market participant that operates within guardrails you define.

What does a single API actually abstract?

Most trading infrastructure forces you to learn a different interface for each asset class. Perpetual futures use notional sizing and funding rates. Options use strike prices, expiries, and contract multipliers. Stocks settle through brokers with their own order formats. Prediction markets use binary or scalar contracts. A single API removes that fragmentation by translating your intent into venue-specific instructions. You send an order in plain US dollars, specify the market type, and the API handles the rest. The same interface accepts a stock order, a crypto spot trade, a perp position, an options leg, or a prediction market bet. You do not need to manage separate authentication flows, margin requirements, or settlement timelines for each venue. The infrastructure unifies them behind one permission model.

This abstraction matters for LLMs because language models reason in natural language, not in contract tick sizes. When you tell the agent to reduce exposure by one hundred dollars, the API converts that intent into the correct number of shares, contracts, or tokens. The agent does not need to know whether an options contract represents one hundred underlying units or whether a perp venue uses decimal lot sizes. It reasons about direction and dollar value, and the infrastructure executes precisely. This reduces the surface area for hallucination. A model that miscounts decimals on a raw venue API can cause catastrophic sizing errors. A model that sends dollar amounts to a normalized API leaves the precision to the infrastructure layer.

How do you connect an LLM to the API?

There are two main paths. The first is through Model Context Protocol (MCP) tools, which let clients like Claude or Cursor call trading functions as structured tools. The LLM sees a tool definition for placing an order, checking a balance, or reading a position. It generates a tool call, the MCP client validates it against your safety rules, and then the client sends it to the API. The LLM never sees a raw API key, and it cannot bypass the scoped permissions embedded in the tool layer. This means the model's creativity is bounded by the tool schema. It cannot invent a new parameter that circumvents your budget cap because the client simply rejects unknown fields.

The second path is direct REST integration. Developers who want full control over the reasoning loop can call the API from their own code. The exact request schema is in the docs at /docs; the shape looks like this.

curl -X POST https://api.felix.trade/orders \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "market": "perp",
    "symbol": "ETH",
    "side": "buy",
    "size_usd": 150
  }'

In both cases, the API key is scoped. That means the key is created with explicit permissions, such as which markets it can access, the maximum position size it can hold, and the maximum dollar amount it can spend in a given period. If the LLM reasons incorrectly and tries to exceed those bounds, the API rejects the request before it reaches a venue. The safety layer is not an afterthought; it is the foundation of the integration.

What safety controls should you set first?

Before you let an agent touch real capital, you need to treat safety as infrastructure, not as a suggestion. Trading APIs keep AI agents safe by embedding controls at the key level, which means the LLM cannot opt out of them. You should configure these controls before you connect the model.

  • ·Scoped keys: each API key is restricted to specific market types, symbols, and trade directions. A key meant for stock trading cannot accidentally place a perp order.
  • ·Budget caps: a daily, weekly, or total spend limit prevents the agent from deploying more capital than you intended. Once the cap is reached, the API rejects new orders.
  • ·Position limits: a maximum notional exposure per symbol or market type stops the agent from concentrating too heavily in one trade.
  • ·Exit plans: automated stop losses or take profit triggers can flatten a position if the market moves against the agent, reducing the need for constant human monitoring.
  • ·Panic or kill switch: a single command flattens all positions and revokes the API key, cutting off access immediately.

These controls are non-negotiable. An LLM can misinterpret a headline, hallucinate a strategy, or loop into repetitive orders. Hard limits protect you from model errors as much as from market volatility. Set them during onboarding, not after you notice a problem.

How does the non-custodial model work?

Non-custodial means the funds sit in a wallet that you control, not in a pooled account managed by the API operator. When the agent wants to trade, it signs orders that draw from your wallet up to the scoped limit. The agent can spend, but it can never withdraw funds to itself or to any address that you have not explicitly approved. How an AI agent executes orders while you keep full custody explains the mechanics of this flow in detail. The wallet remains yours. You can inspect balances, revoke keys, or move funds manually at any time without waiting for a withdrawal request to process.

This architecture matters because it limits the blast radius of a compromised or malfunctioning agent. If the LLM generates a harmful instruction, the worst case is that it trades within the bounded budget you assigned. It cannot drain the wallet, transfer assets to an external address, or change the withdrawal whitelist. The API routes the order to the appropriate venue, but settlement remains under your control. Even if the agent is fully autonomous, it is a guest in your wallet, not the owner. The difference between custody and non-custody is not philosophical. It is a concrete boundary that prevents an agent error from becoming a total loss of funds.

What should you test before going live?

Paper trading lets you observe the agent's behavior without risking capital. You should run the agent for enough time to see how it handles volatility, news events, and ambiguous prompts. Watch for overtrading, repetitive orders, or misinterpretations of market data. A model might interpret a neutral headline as bullish because of a word choice in the prompt. A practical checklist for running autonomous trading systems covers the full set of tests that matter for production readiness. Paper trading reveals these biases before they cost money.

During paper trading, verify that every safety control behaves as expected. Submit an order that exceeds the position limit and confirm it is rejected. Trigger the panic switch and confirm that all positions flatten and the key is revoked. Review the audit logs for clarity. If the logs are vague, you will struggle to reconstruct what happened during a live incident. Check that the LLM reasons about dollar values correctly and does not confuse leverage with notional size. Test what happens when the model receives conflicting instructions. Only after the agent behaves predictably in simulation should you consider live trading.

How do you authorize live trading?

Live trading requires explicit owner authorization of a scoped key. Paper trading is the default state; you must deliberately upgrade a key to real money. Start with a small budget that you can afford to lose entirely. What most people get wrong about LLM trading with real money is that they fund the agent with too much capital before they understand its failure modes. Trading can lose money, including everything, so the initial live phase should be treated as a controlled experiment. The authorization step is a deliberate speed bump, not a frictionless toggle.

Increase limits gradually. After a week of live trading with a tight budget cap, review the logs, measure slippage, and assess whether the agent's reasoning aligns with actual market conditions. If the agent performs within expectations, you can raise the cap. If it drifts from your strategy, pause, refine the prompt, and return to paper trading. The goal is not to automate everything on day one. The goal is to build a system where the LLM augments your decisions within a safety framework that you control. Speed is less important than accuracy when the downside is real capital loss.

LLM-powered trading through a single API is not a black box that replaces your judgment. It is a tool that lets you express strategies in natural language while the infrastructure enforces hard limits, normalizes markets, and preserves custody. Start with paper trading, lock down safety controls, and fund live keys conservatively. The API gives you access to five market types, but the risk management is yours to configure. An agent is only as safe as the boundaries you set before it starts.

Frequently asked questions

Can the LLM withdraw my funds to its own wallet?

No. Withdrawal addresses are owner-approved only. The agent can trade within the scoped limits of its API key, but it cannot move funds to any address that you have not explicitly whitelisted.

Do I need to understand perp funding rates or options contract multipliers?

No. The API normalizes venue-specific math. You send orders in plain US dollars, and the system converts your intent into the correct contract size, strike mapping, or share count for the underlying venue.

What happens if the agent begins to lose money rapidly?

The panic switch flattens all positions and revokes the API key. Additionally, budget caps and drawdown limits block new orders once the threshold is reached, containing the loss to the predefined scope.

Can I test the full agent loop without risking capital?

Yes. Paper trading simulates balances and market responses so you can test the LLM's reasoning, safety controls, and execution logic before you authorize a live key.

Which LLM clients can connect to the trading tools?

Claude, Cursor, and any other MCP-compatible client can use the trading tools. Developers can also integrate directly through the REST API for custom agent architectures.

Is programming experience required to get started?

Not necessarily. MCP users can often begin with configuration and prompt design. Developers who want custom reasoning loops can use the REST API directly. Both paths share the same safety layer.

Give your agent a key.

One key to trade stocks, crypto, perps, options, and prediction markets. Live after owner authorization.

Keep reading

Not a brokerage, exchange, or investment adviser. Not investment advice. Trading involves risk, including total loss.