Agentic tradingPortfolio managementRiskDevelopers

How to manage a multi-market portfolio with one agentic API

A practical checklist for managing stocks, crypto, perpetual futures, options, and prediction markets through a single non-custodial agentic API.

By the Felix team9 min read
Key takeaways
  • 01A single agentic API can control stocks, crypto, perpetual futures, options, and prediction markets, but the owner must treat each market's risk model as distinct.
  • 02Scoped API keys, budget caps, and position limits should be configured per market type rather than as one global pool.
  • 03Trading can lose money, including everything, so exit plans must define maximum holding times and flattening conditions before the agent opens any position.
  • 04The panic switch revokes the agent's access and flattens positions, yet unsettled trades may still leave residual exposure after activation.
  • 05Paper testing must cover each market in isolation and in combination before the owner explicitly authorizes live capital through a scoped key.

Managing a multi-market portfolio through a single agentic API means one set of credentials controls exposure across stocks, crypto, perpetual futures, options, and prediction markets. The owner retains custody of funds in a private wallet while the agent executes within scoped limits that vary by venue type. This setup simplifies automation but requires explicit checks for sizing, margin rules, and kill switches because each market settles risk differently. A practical checklist prevents the agent from treating a stock position and a leveraged perpetual position as interchangeable.

What changes when one agent touches five market types?

Stocks, crypto, perpetual futures, options, and prediction markets share one API, but they do not share one risk model. A stock position at a stock broker settles into a shareholding that may carry overnight margin requirements and T+1 settlement lag. A perpetual futures position at a perps venue faces funding rates and liquidation risk that scales with leverage. An options contract at an options venue introduces expiry, assignment, and nonlinear Greeks that can convert a small premium into a large directional exposure. A prediction market contract resolves to a binary outcome with a fixed payoff and fee structure that behaves nothing like a delta one instrument. The API normalizes order sizing into plain US dollars, which removes manual contract math, but the owner must still recognize that a dollar of stock risk is not equivalent to a dollar of perpetual futures risk. Why AI agents force developers to rethink trading risk management covers this mismatch in more detail. When an agent manages all five types in one portfolio, drawdowns can correlate across venues during volatile events. A loss in a leveraged perp position can force a liquidation that the agent detects too late if it is simultaneously scanning an options chain. The normalization layer helps with execution consistency, yet it does not merge the underlying margin systems. A stock broker, a perps venue, an options venue, a crypto exchange, and a prediction market each maintain separate ledgers and risk engines. The agent sees one dashboard, but the owner sees five separate settlement flows. The checklist starts with acknowledging that normalization is for execution, not for risk equivalence. The owner must map each normalized dollar back to its native margin requirement before authorizing the agent to trade.

How do you scope keys and budgets per market?

Non-custodial access means the agent can spend within limits but can never withdraw funds to itself or to an unapproved address. Withdrawal addresses are owner-approved only. The first line of defense is a scoped API key that restricts which market types the agent can reach, how much it can spend per day or per trade, and whether it is allowed to open short or leveraged positions. Scoped API Keys for Trading Agents explains how to roll your own versus using an agent-ready API that enforces these boundaries at the infrastructure level. A practical checklist for key scope includes:

  • ·Enable only the market types the strategy requires, not all five by default.
  • ·Set a daily spend cap in US dollars for each enabled market.
  • ·Define a maximum position size per market and per underlying.
  • ·Restrict short selling and leverage unless explicitly approved.
  • ·Pre-approve withdrawal addresses and disable agent-initiated transfers.

Budget caps should be set per market type, not just globally. A $500 daily limit sounds safe until it is consumed by five options trades and then repeated in a perp position. The owner should decide whether the agent shares one pool across all markets or holds isolated budgets. For multi-market strategies, isolated budgets prevent a single bad loop in one venue from draining the capital allocated to another. Position limits work the same way. A hard ceiling of $1,000 per position in stocks and $1,000 per position in perps prevents the agent from doubling exposure without explicit authorization. These limits are owner-controlled and can be tightened during high-volatility periods. The owner should also consider rate limits per market. An agent that can place fifty orders per minute in a prediction market may create fee drag or price impact that is harmless in a deep stock market but costly in a thin prediction market. The key scope should include order frequency, not just notional size.

What position limits and exit plans do you need?

Every open position needs a maximum size, a maximum holding time, and a flattening condition. The agent should not be allowed to hold an options contract into expiry unless the owner has explicitly enabled assignment risk. The agent should not carry a leveraged perpetual futures position through a funding-rate spike without a plan to reduce or close. Exit plans are not profit targets; they are loss boundaries. Trading can lose money, including everything, and an agent will not hesitate if the prompt or tool configuration tells it to execute. The checklist should specify whether the agent is allowed to roll positions, average down, or hedge across markets. For example, if the agent holds a long stock position, is it allowed to open a short perp position to hedge, or will that create unintended leverage? The owner should write these rules into the prompt or tool scope rather than assuming the agent infers intent from a strategy description. Time-based exits are especially important for prediction markets, where contracts expire when an event resolves. If the agent does not flatten before resolution, the payout may be locked until manual settlement. A clear instruction to close or reduce to a specific percentage by a specific date removes ambiguity. The owner should also define a maximum number of open positions. An agent managing five market types might open twenty simultaneous positions that each look small but collectively exceed the owner's risk tolerance. A hard cap on total open positions, combined with a total portfolio heat limit measured in dollars at risk, keeps the agent from fragmenting capital into untrackable slices. The exit plan should state whether the agent must flatten in FIFO order, or whether it can choose the least liquid position first to preserve cash.

How do you handle margin and settlement differences?

Settlement timing varies across venue types. Stock trades may require T+1 settlement before cash is available for a crypto trade. The agent does not automatically know that unsettled funds are not withdrawable, so the owner must either scope the key to avoid reusing cash balances or build a buffer into the budget. Perpetual futures use margin rather than cash settlement. A position can be liquidated while the owner still holds the underlying collateral in the wallet. The agent must be constrained from opening size that approaches maintenance margin, because a price gap can wipe out the position before the agent can react. Options introduce premium decay and assignment. If the agent sells an option and the owner is assigned, the resulting stock position may exceed the scoped position limit or consume cash needed elsewhere. The checklist should disable naked short options unless the owner has reserved isolated capital and approved the specific risk. Prediction markets often lock capital until resolution. An agent that buys a prediction market contract today may not have access to that capital for weeks. The owner should treat locked capital as spent, not as available buying power, and scope the budget accordingly. The API normalizes order sizing into US dollars, but the venue-specific contract math still governs margin, settlement, and liquidation. The exact request schema is in the docs; the shape looks like this:

{
  "key_scope": "YOUR_KEY",
  "markets": ["stocks", "perps", "options"],
  "daily_budget_usd": 1000,
  "max_position_usd": 500,
  "allow_leverage": false
}

Where does the panic switch fit in a multi-market setup?

A multi-market agent can open exposure faster than a human can review it. The panic switch, or kill switch, is a manual control that flattens all positions and revokes the agent's key. It exists because correlated crashes can trigger margin calls across stocks, crypto, and perps at the same time. The owner should test the panic switch in paper trading before authorizing live capital. The test should verify that revocation happens immediately, that open orders are canceled, and that positions are reduced according to the exit plan rather than dumped at market in a way that amplifies slippage. How developers should set spend caps and drawdown limits for trading agents in 2026 discusses how to set the drawdown threshold that triggers an automatic flattening before the owner reaches for the manual switch. Automatic flattening is not a guarantee of preservation. It is a damage-control mechanism. The owner should also define whether the panic switch applies globally or per market. A global flattening may be appropriate if the strategy is correlated, but if the agent runs independent sub-strategies, a market-specific kill switch preserves positions that are not part of the failing system. The checklist should state who holds the switch, how to reach it, and what happens to unsettled trades after activation. In a multi-market portfolio, unsettled stock trades may still complete after the kill switch fires, leaving residual exposure that the owner must monitor manually.

How do you test before authorizing live capital?

Paper trading exists for testing. Live trading requires explicit owner authorization of a key. The checklist should mandate that every new market type is tested in isolation before it is added to a multi-market portfolio. Test the agent's reaction to a funding-rate spike in perps, an options expiry cycle, a stock settlement delay, and a prediction market resolution. Then test them together. Simulate a scenario where the agent is holding positions in three markets and a volatility event hits two of them. Observe whether the agent respects budget caps or attempts to exceed them when opportunities appear urgent. How backtesting changes when you switch from manual trading to an agent explains why historical simulations differ from live agent behavior. Backtesting assumes immediate execution; an agent faces API latency, rate limits, and venue-specific order books. The owner should also test the authorization flow itself. Revoke the key, reauthorize it, and verify that the agent resumes within the new scope without remembering old permissions. If the agent connects through MCP tools, test the tool boundaries in Claude, Cursor, or another MCP client to confirm that the model cannot inject prompts around the spend cap. Only after paper testing and explicit authorization should the owner fund the wallet for live trading. Even then, start with a reduced budget and expand only after observing stable behavior across two or more settlement cycles. The testing phase should also include a dry run of the panic switch during a multi-market paper session to confirm that the agent cannot reauthorize itself after revocation.

Frequently asked questions

Can one agent trade all five market types simultaneously?

Yes, a single scoped key can access stocks, crypto, perpetual futures, options, and prediction markets through one API. The owner controls which markets are enabled and how capital is partitioned between them. Simultaneous trading requires careful attention to settlement timing and margin rules because the markets do not share one ledger.

Does the API handle all margin and settlement calculations?

The API normalizes order sizing into plain US dollars, but each venue still manages its own margin, funding rates, and settlement cycles. The agent cannot see internal ledger delays at a stock broker or funding accruals at a perps venue. The owner must scope budgets to account for these differences.

What happens when the agent reaches a budget cap?

Further orders are rejected until the owner resets or increases the cap. The rejection happens at the API level, not at the venue, which prevents the agent from accidentally overspending. The owner can set separate caps per market type or share one pool across all five.

Is paper trading available for multi-market strategies?

Paper trading exists for testing strategies without live capital. The owner should test each market type in isolation and then test combined scenarios before authorizing a live key. Live trading requires explicit owner authorization after paper testing is complete.

Can the agent withdraw funds to an external wallet?

No. The system is non-custodial by construction. The agent can spend within scoped limits but can never withdraw funds to itself or to an address that the owner has not pre-approved. Withdrawal addresses are owner-approved only.

How fast does the panic switch flatten positions?

The panic switch revokes the key and initiates flattening immediately, but execution speed depends on venue liquidity and open order status. Unsettled trades, such as stock positions in T+1 settlement, may still complete after revocation. The owner should monitor residual settlement exposure even after the switch is thrown.

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.