Agentic tradingRiskDevelopersAPI

How to control the risks of dollar-based order sizing through a single API

AI agents that size trades in plain dollars face slippage, leverage, and venue math risks. Hard limits and a single normalized API can contain them if set correctly.

By the Felix team11 min read
Key takeaways
  • 01Dollar-based order sizing simplifies the agent interface, but it does not normalize the economic exposure of leverage, margin, or contract math across different market types.
  • 02A single API can translate $500 into very different notional values depending on whether the instrument is a stock, a perp, an option, or a prediction market contract.
  • 03Scoped API keys, budget caps, and position limits act as deterministic guardrails that override the agent's intent if the sizing request exceeds your predefined thresholds.
  • 04Paper trading lets you observe how dollar inputs convert to contracts and positions, yet it cannot fully replicate the slippage and margin dynamics of live markets.
  • 05The most important control is the owner's ability to revoke the agent's key and flatten positions, because no automated limit can anticipate every market condition.

Dollar-based order sizing lets an agent express trading intent in plain US dollars rather than contract units, but it does not remove the underlying risks of leverage, slippage, and venue-specific margin math. A single API that normalizes sizing across stocks, crypto, perps, options, and prediction markets simplifies the interface, yet the same dollar amount can produce radically different economic exposures depending on the instrument. Owners who treat dollar sizing as a safety feature rather than a convenience layer may find the agent taking positions far larger than intended. The controls that matter are not the denomination of the order, but the hard limits placed around notional value, leverage, and maximum loss.

Why does dollar-based sizing feel safer than it is?

Human traders naturally think in dollars. Telling an agent to allocate one thousand dollars to a strategy feels concrete and bounded, whereas instructing it to buy 0.023 perpetual contracts or 3.7 option contracts feels abstract. This psychological comfort is exactly what makes dollar-based sizing dangerous. The owner conflates the order input with the economic outcome, assuming that a five-hundred-dollar order exposes the portfolio to exactly five hundred dollars of risk. In reality, the conversion from dollars to contracts happens at the API layer, and the resulting position may control thousands of dollars in notional value or require only a small margin slice that leaves the rest of the wallet exposed to liquidation.

The abstraction is useful for multi-market agents. A single API can translate a dollar figure into the native units required by a stock broker, a spot crypto venue, a perps venue, an options venue, or a prediction market. However, each venue applies its own leverage rules, contract multipliers, and collateral requirements. The API normalizes the input language, not the underlying economics. An order for one thousand dollars of a stock is roughly one thousand dollars in notional terms, but the same one thousand dollars routed to a perps venue with 20x leverage becomes a twenty-thousand-dollar notional position. The owner who does not inspect the conversion may not realize the scale of the bet until the position is already open.

  • ·Stocks and spot crypto are typically unleveraged or low leverage, so a dollar order size maps closely to notional exposure.
  • ·Perpetual futures use margin requirements that are a fraction of the notional value, meaning a small dollar order can control a large position.
  • ·Options premiums are a fraction of the underlying value, so a dollar-based order can translate into a large number of contracts with outsized notional exposure.
  • ·Prediction markets price contracts between zero and one dollar, so a fixed dollar amount buys a variable number of shares depending on the current price, changing the payoff profile.

Because the agent reasons in dollars, it may also miscalculate the impact of slippage. A low-liquidity options contract or an illiquid prediction market can absorb a five-hundred-dollar order at a much worse average price than expected. The API executes the dollar-sized order, but the fill quality degrades. The agent does not necessarily receive feedback that says the position is larger or riskier than planned; it simply sees that the order filled. Without secondary controls, the agent can compound this error by placing additional dollar-sized orders that stack into an oversized exposure.

Where does the API hide leverage and notional math?

The API acts as a translation layer. When an agent sends a request to buy five hundred dollars of an instrument, the API looks up the current price, contract size, and margin rules, then computes the number of units to submit. This computation is opaque to the agent unless the owner explicitly queries the notional value after the fact. The agent thinks in a flat currency layer, while the venue thinks in contracts, margin, and liquidation thresholds. The gap between those two models is where risk accumulates.

Consider a perpetual futures venue. The API might receive a request for five hundred dollars and submit an order worth five hundred dollars of the underlying asset. If the venue offers 20x leverage, the agent only needs to lock up twenty-five dollars of margin. The remaining four hundred seventy-five dollars of the wallet is still theoretically available to the agent, and the position itself behaves like a ten-thousand-dollar notional bet. A ten percent move in the underlying wipes out the margin entirely. The owner who sees a five-hundred-dollar order in the logs may not immediately recognize that the liquidation risk is an order of magnitude larger than the order size.

Options present a different distortion. A five-hundred-dollar order at a two-dollar premium buys two hundred and fifty contracts. If each contract controls one hundred units of the underlying, the agent now has exposure to twenty-five thousand dollars in notional terms. The API faithfully converted the dollar request into contracts, but the leverage is embedded in the option delta and the contract multiplier. The same dollar figure in a near-expiration out-of-the-money option behaves almost like a lottery ticket, while the same figure in a deep in-the-money option behaves like a leveraged stock position. The API cannot know the intent; it only executes the conversion.

Prediction markets add yet another wrinkle. Contracts trade between zero and one dollar, but the price reflects probability. Five hundred dollars spent at ten cents per share buys five thousand shares. If the event resolves in favor of the position, the payoff is five thousand dollars. If it resolves against, the loss is the full five hundred. The same five hundred dollars spent at ninety cents per share buys only five hundred and fifty-five shares, with a much smaller upside. The API normalizes the dollar input, but the risk-reward ratio is entirely determined by the market price at the moment of execution. The agent that does not adjust for price is simply buying a different bet every time.

How can scoped keys prevent an agent from oversizing?

Scoped API keys are the first line of defense against runaway sizing. Rather than trusting the agent to respect a dollar limit written in a prompt, the owner can bind the key to a hard ceiling at the infrastructure level. A key scoped to a maximum one-thousand-dollar order size will reject a request for two thousand dollars regardless of what the prompt says. This is deterministic and auditable, and it does not depend on the reasoning capabilities of the agent.

Scopes can also be partitioned by market type. An owner can issue one key for stock trading with a five-hundred-dollar per-order limit, and a separate key for perps with a one-hundred-dollar limit. This prevents the agent from concentrating in high-leverage markets while the owner believes the portfolio is diversified. Because the keys are non-custodial, the agent cannot circumvent the scope by moving funds to a different wallet. The wallet itself remains under the owner's control, and the key can only spend within the approved boundary.

The safety model works because the limit is enforced by the API, not by the agent. Prompts can be misinterpreted, jailbroken, or simply buggy. Scoped keys cannot. How a single API keeps AI trading agents safe across every market explains how this architecture prevents an agent from exceeding its mandate even when the underlying strategy drifts. Owners should treat the prompt as a suggestion and the key scope as the law.

What role do budget caps and position limits play?

Budget caps and position limits operate at a higher level than per-order scopes. A budget cap restricts the total capital the agent can deploy over a time window, such as a day or a week. This is useful for preventing the agent from grinding away capital through a series of small losing trades, or from pyramiding into a massive position by placing many individual orders that each pass the per-order limit. A position limit, by contrast, restricts the maximum size of any single holding, usually expressed in notional dollars or as a percentage of the total wallet. Even if the agent finds a signal it considers extremely strong, the position limit stops it from concentrating the entire portfolio in one instrument.

  • ·A daily budget cap prevents death by a thousand cuts, where the agent repeatedly loses small amounts until the drawdown becomes material.
  • ·A per-position limit stops concentration risk, which is especially dangerous in leveraged instruments where one bad move can dominate the portfolio.
  • ·An exit plan, including automated stop-losses and take-profits, caps the damage from a position that was sized correctly at entry but moves against the agent.
  • ·A kill switch lets the owner flatten all positions and revoke the key instantly, which is the final backstop when automated limits are insufficient.

These layers work together. The scoped key enforces the order size. The budget cap enforces the deployment rate. The position limit enforces concentration. The exit plan enforces the loss per trade. The kill switch enforces the owner's right to stop everything. How to limit risk when AI agents trade through MCP tools and a single API covers how these controls interact when the agent is connected through an MCP client. No single layer is enough; the redundancy is intentional.

How should an owner test sizing logic before live trading?

Testing begins in paper trading mode. The same API, the same dollar-based logic, and the same scoped keys run against simulated markets. The owner should observe not just whether the agent makes hypothetical profits, but how the dollar inputs translate into contract counts and notional exposure. A paper trading log that shows the agent consistently converts five hundred dollars into ten thousand dollars of notional value on a perps venue is a warning sign, even if the paper PnL is positive. The owner must decide whether that level of leverage is acceptable before turning on live trading.

  1. 01Run the agent in paper trading for at least several days across all intended market types, including low-liquidity periods.
  2. 02Inspect the logs to verify the contract count, notional value, and margin used for each dollar-based order.
  3. 03Simulate a scenario where the agent tries to double its position size or place multiple orders in quick succession to test the budget cap and position limit.
  4. 04Compare the paper fills to live market depth for the same instruments to estimate slippage on the intended order sizes.
  5. 05Require explicit owner authorization to move from paper to live, and start with a live budget cap that is a small fraction of the paper allocation.

Paper trading cannot replicate every live market condition. Liquidity can evaporate, margin requirements can change, and price gaps can occur. However, it does reveal whether the agent's sizing logic is coherent and whether the API's translation from dollars to contracts behaves as expected. The transition to live trading should be gradual, with the tightest possible limits that still allow the strategy to function. Only after observing stable behavior under live constraints should the owner consider raising the caps.

When should a human flatten everything and revoke access?

Automation is not a substitute for human oversight. There are conditions that should trigger immediate intervention, even if the agent has not yet hit its loss limits. Repeated orders that bounce off the scoped key limit suggest the agent is stuck in a retry loop and may be behaving erratically. Sudden shifts into unfamiliar markets, such as an agent authorized for stocks suddenly attempting to trade options, indicate prompt drift or a misunderstood instruction. Large moves in the underlying that approach liquidation levels require a human judgment call about whether to hold or exit.

The panic switch exists for exactly these moments. Flattening closes all positions and returns the portfolio to cash or the base asset. Revocation destroys the key's access, so the agent cannot open new positions. Because the system is non-custodial, the owner retains the wallet and can withdraw funds to an approved address at any time. The agent has no ability to block this. The owner should pre-approve withdrawal addresses and keep the panic mechanism accessible outside of the agent's normal workflow.

Knowing when to stop is harder than building the agent. Owners often hesitate to kill an automated strategy because they fear missing a recovery or because they have already incurred losses and want to avoid realizing them. This is a mistake. The purpose of the kill switch is to preserve capital when the agent's behavior is no longer predictable. How to build your first automated exit plan and take-profit strategy offers a framework for defining these triggers before emotions become involved. Set the rules while the portfolio is calm, and follow them when it is not.

Frequently asked questions

Does dollar-based sizing mean the agent cannot use leverage?

No. The API normalizes the order input, but the underlying venue can still apply leverage to the position. The agent may only need to post a fraction of the notional value as margin. You must set leverage limits at the venue or API level, and you should not assume that the dollar amount equals the total economic exposure.

Can a budget cap stop an agent from losing everything?

A budget cap limits how much capital the agent can deploy, but it does not limit losses from existing positions. If the market moves against a leveraged position, the loss can exceed the deployed budget. Combine budget caps with position limits, scoped keys, and automated exit plans.

Why is paper trading not enough to test sizing risk?

Paper trading tests the logic and API integration, but it cannot replicate slippage, liquidity gaps, or margin call behavior in live markets. It is a necessary first step, not a proof that live sizing will behave identically. Always start live trading with smaller limits than those used in paper mode.

Should I give one agent the same key for stocks and perps?

You can use one key, but you should configure separate scoped limits for each market type. A single global limit may let the agent max out on high-leverage perps while leaving no room for stocks. Scoped keys let you partition risk by instrument class.

Who controls the wallet if the agent makes a mistake?

You do. The non-custodial design means funds remain in your wallet. The agent can only spend what the key authorizes, and it cannot withdraw to an unapproved address. If the agent oversizes, you can revoke the key and flatten positions yourself.

What is the first limit I should set for a new agent?

Set a daily budget cap that you can afford to lose entirely. Add a per-order maximum in US dollars that is a small fraction of that daily budget. Only increase these limits after observing stable behavior in paper trading and then live trading for several days.

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.