Strasmore Research
Deep Dives · Matt ConnorBy Matt Connor ·

AI Trading Bots and Real Brokerage Orders

An AI trading bot faces the same account rulebook as a human: day trade counting, unsettled cash, options tiers, partial fills, and halts. Here is each one.

An AI trading bot that places real orders meets the brokerage rulebook long before it meets a hard modeling problem. A retail account counts day trades against a rolling five day window, blocks the reuse of cash that has not settled, rejects option strategies above its approval tier, and can partially fill an order the agent already logged as complete. What follows is that rulebook, broker neutral, with the market data that shows where each rule bites. An autonomous loop has two surfaces it cannot see from inside the model: the account it is trading in, and the state machine every order passes through at the venue, one layer beneath the coordination problems in multi-agent AI trading systems.

Pattern day trader counting and the fourth round trip

A day trade is a buy and a sell of the same security inside the same session. In a margin account, four or more day trades inside five business days, where those trades are more than 6% of total activity in the window, flags the account as a pattern day trader. From that point the account has to carry $25,000 in equity as of the prior close. Below that line the broker restricts it to closing transactions for 90 days.

An agent re-entering the same ticker on a mean reversion signal can reach the fourth round trip in one afternoon with no single decision looking wrong. The loop needs its own counter over a rolling five business day window, and it needs to know the account type. Cash accounts sit outside it and pay for that with settlement, the next rule. Our pattern day trader rule walkthrough covers the counting edge cases.

Good faith violations when an agent re-spends unsettled cash

US stock trades settle one business day after the trade date, T+1. In a cash account, proceeds from a sale are not spendable until they settle. Buying with unsettled proceeds is allowed. Selling that new position before the original proceeds settle is a good faith violation, and three of them inside a rolling 12 months limits the account to settled cash for 90 days. The mechanics are in good faith violations, and the timeline itself in T+1 settlement.

The trap is the buying power field: most APIs expose one number the agent can spend, and that number is not the settled cash balance. Settlement counts in business days, so a closure moves the date.

QueryUpcoming market closures that move a settlement date
holiday_dateholiday_labelweekdayholidayday_statusdays_away
2026-11-26Nov 26ThuThanksgivingclosed61
2026-11-27Nov 27FriThanksgivingearly-close62
2026-12-24Dec 24ThuChristmasearly-close89
2026-12-25Dec 25FriChristmasclosed90
2027-01-01Jan 1FriNew Years Dayclosed97
2027-01-18Jan 18MonMartin Luther King, Jr. Dayclosed114
2027-02-15Feb 15MonWashington's Birthdayclosed142
2027-03-26Mar 26FriGood Fridayclosed181
2027-05-31May 31MonMemorial Dayclosed247
2027-06-18Jun 18FriJuneteenthclosed265
2027-07-05Jul 5MonIndependence Dayclosed282
2027-09-06Sep 6MonLabor Dayclosed345
The exact SQL behind every number
SELECT
    toString(date)                                                         AS holiday_date,
    concat(formatDateTime(date, '%b'), ' ', toString(toDayOfMonth(date)))   AS holiday_label,
    formatDateTime(date, '%a')                                             AS weekday,
    any(name)                                                              AS holiday,
    any(status)                                                            AS day_status,
    dateDiff('day', today(), date)                                         AS days_away
FROM global_markets.stocks_market_holidays
WHERE date >= today()
GROUP BY date
ORDER BY date
Run this yourself

The next closure ahead is Thanksgiving on Nov 26, 61 days from today, and the forward calendar carries 12 dated closures. Read it as a settlement calendar: a sale on the session before a full closure settles one business day later. An agent that adds 24 hours to a timestamp to predict settlement is wrong on every holiday and every Friday.

Options approval levels the agent cannot see

Brokers gate option strategies behind tiers. The numbering varies by firm, the ladder does not: covered calls and cash secured puts at the bottom, then long calls and puts, then debit and credit spreads, then uncovered short options at the top. Nothing in a market data feed tells the agent which rung the account sits on, so a proposed iron condor comes back as a rejection code. The tiers are laid out in options approval levels. The panel below groups AAPL contracts by time to expiry, holding strikes within 5% of the underlying close.

QueryAAPL near-the-money option volume and implied volatility by time to expiry, August 2026
dte_bucketvolume_thousandsavg_iv_pct
0 to 1 days4166.538.2
2 to 7 days4846.626.4
8 to 30 days1544.924.7
31 to 90 days538.625
over 90 days322.628.1
The exact SQL behind every number
SELECT
    multiIf(days_to_expiry <=  1, '0 to 1 days',
            days_to_expiry <=  7, '2 to 7 days',
            days_to_expiry <= 30, '8 to 30 days',
            days_to_expiry <= 90, '31 to 90 days',
                                  'over 90 days')  AS dte_bucket,
    round(sum(volume) / 1000, 1)                   AS volume_thousands,
    round(100 * avg(implied_volatility), 1)         AS avg_iv_pct
FROM global_markets.options_greeks
WHERE underlying_symbol = 'AAPL'
  AND date >= '2026-08-03'
  AND date <  '2026-08-29'
  AND iv_converged = 1
  AND volume > 0
  AND days_to_expiry >= 0
  AND underlying_close > 0
  AND abs(toFloat64(strike_price) / toFloat64(underlying_close) - 1) < 0.05
GROUP BY dte_bucket
ORDER BY min(days_to_expiry)
Run this yourself

Near the money contracts with 0 to 1 days to expiry traded 4166.5 thousand contracts over that window at an average implied volatility of 38.2%. The over 90 days bucket averaged 28.1%. The short end of that curve is where agent strategies cluster, and where the defined risk structures that need a higher tier live.

Buy is an underspecified instruction

An order needs a type and a duration before a broker can act on it. Market takes whatever price is available. Limit sets a worst acceptable price and may never fill. Stop and stop limit convert at a trigger price. The duration is the time in force: day, good till canceled, immediate or cancel, fill or kill, plus an extended hours flag that decides whether the order is eligible outside the regular session at all. The panel below buckets one liquid name's quotes by clock time across a full trading day, 08:00 to 20:00 ET.

QueryAAPL quoted spread and quote traffic by ET clock time, 14 August 2026
36 rows (showing 20)
et_timespread_bpsquote_count
08:005.2481
08:203.3396
08:402.5224
09:002.9575
09:202.641701
09:401.861032
10:001.348942
10:201.159095
10:40140204
11:00141381
11:20152970
11:400.830145
12:000.834270
12:200.828980
12:400.723918
13:000.721450
13:200.821990
13:400.927665
14:000.830567
14:200.720024
The exact SQL behind every number
SELECT
    formatDateTime(toStartOfInterval(toTimeZone(sip_timestamp, 'America/New_York'), INTERVAL 20 MINUTE), '%H:%i') AS et_time,
    round(avg(toFloat64(ask_price - bid_price) / toFloat64(bid_price) * 10000), 1)                                 AS spread_bps,
    count()                                                                                                       AS quote_count
FROM global_markets.cache_stocks_quotes
WHERE ticker = 'AAPL'
  AND sip_timestamp >= '2026-08-14 12:00:00'
  AND sip_timestamp <  '2026-08-15 00:00:00'
  AND bid_price > 0
  AND ask_price > bid_price
GROUP BY et_time
ORDER BY et_time
Run this yourself

In the 08:00 ET bucket, 481 quote updates arrived and the average quoted spread measured 5.2 basis points. In the 13:00 ET bucket the same name took 21450 updates at an average spread of 0.7 bps. The final bucket, 19:40 ET, carries 110 updates. A basis point is one hundredth of a percent.

Outside the regular session most brokers accept limit orders only, and route them to a single venue rather than across the market. A market order sent before the open is commonly rejected outright. An agent that hardcodes market orders runs clean in backtest and fails on its first overnight signal.

The order the agent reports as done

Submission is not a fill. An order moves through accepted, then possibly partially filled, filled, canceled, rejected, or expired, and only two of those end with shares in the account. An agent that logs its intent as the outcome drifts out of sync with the position inside a day. Reconciliation has to read positions back from the broker, not from its own record of what it sent. Partial fills are ordinary once order size passes what sits at the inside quote.

QueryTrade print sizes across five liquid names, 13:00 to 14:00 ET on 14 August 2026
tickeravg_trade_sizep95_trade_sizeunder_100_share_pct
NVDA5215786.7
SPY3912589.4
KO3410085.8
AAPL3310093.1
MSFT248595.4
The exact SQL behind every number
SELECT
    ticker,
    round(avg(toFloat64(size)), 0)                                                    AS avg_trade_size,
    round(quantileDeterministic(0.95)(toFloat64(size), toUInt64(sequence_number)), 0) AS p95_trade_size,
    round(100 * countIf(size < 100) / count(), 1)                                     AS under_100_share_pct
FROM global_markets.stocks_trades
WHERE ticker IN ('SPY', 'AAPL', 'NVDA', 'MSFT', 'KO')
  AND sip_timestamp >= '2026-08-14 17:00:00'
  AND sip_timestamp <  '2026-08-14 18:00:00'
GROUP BY ticker
ORDER BY avg_trade_size DESC
Run this yourself

In that hour, NVDA printed the largest average trade at 52 shares, with 86.7% of its prints under 100 shares and a 95th percentile print of 157 shares. At the other end, MSFT averaged 24 shares per print. An order for 5,000 shares is none of these prints. It becomes many of them, at several prices, and the average fill price is not the quote the agent saw.

Halts and the band around the price

US stocks carry limit up limit down bands, a percentage range around a rolling five minute average price. Quotes outside the band cannot execute, and when the market sits at a band edge for 15 seconds, trading pauses for five minutes and reopens with an auction. An exchange can also halt a name for news pending, and a halted name accepts no orders at all. For an agent the effect is a queue of orders that neither fill nor cancel while the data feed keeps ticking. The frequency is measurable: count the minutes in which a name traveled at least 1% high to low.

QueryMinutes with a 1% high to low range, January to September 2026
tickerfast_minute_countwidest_minute_range_pctavg_minute_range_pct
NVDA3135.640.086
MSFT2095.30.072
AAPL1115.170.065
SPY303.880.03
KO264.830.057
The exact SQL behind every number
SELECT
    ticker,
    countIf(toFloat64(high) / toFloat64(low) - 1 >= 0.01)         AS fast_minute_count,
    round(100 * max(toFloat64(high) / toFloat64(low) - 1), 2)     AS widest_minute_range_pct,
    round(100 * avg(toFloat64(high) / toFloat64(low) - 1), 3)     AS avg_minute_range_pct
FROM global_markets.delayed_stocks_minute_aggs
WHERE ticker IN ('SPY', 'AAPL', 'NVDA', 'MSFT', 'KO')
  AND window_start >= '2026-01-02 00:00:00'
  AND window_start <  '2026-09-19 00:00:00'
  AND low > 0
GROUP BY ticker
ORDER BY fast_minute_count DESC
Run this yourself

Over that window NVDA logged 313 single minutes with a high to low range of 1% or more, and its widest minute spanned 5.64%. KO logged 26 such minutes, at an average minute range of 0.057%. Fast minutes and band pauses live in the same names, and a loop with a five second retry sends its next order straight into one.

What an order placing key can actually do

Treat the credential as the permission rather than the instruction. A key scoped for trading submits orders and closes positions. On most platforms it cannot move cash off the venue: withdrawals sit behind a dashboard login with a second factor, and as of September 2026 at least one broker's own key security guidance states that asymmetry plainly. A leaked trading key cannot take the money out. It can still liquidate every position at market, or churn the account into a pattern day trader restriction. Paper and live credentials in separate stores stop a config default from promoting a test run into production, and a notional cap per order and per day bounds a runaway loop.

FAQ

Can an AI trading bot become a pattern day trader?

Yes. The rule counts trades in the account and does not care what submitted them. Four or more day trades in five business days in a margin account, above 6% of activity, flags it.

Does a cash account avoid the problem?

It avoids day trade counting and takes on settlement instead. Proceeds are unavailable until T+1 settlement completes, and selling a position bought with unsettled proceeds is a good faith violation.

Why does an order get rejected instead of filled?

Common grounds are an option strategy above the account's approval tier, a market order sent outside regular hours, a halted symbol, insufficient settled funds, and a price outside the limit up limit down band. Each returns a code.

Can an API key withdraw money from a brokerage account?

A trading scoped key generally cannot move cash off the platform, since withdrawals sit behind an authenticated dashboard session with a second factor. The same key can usually submit orders and close positions, which is enough to flatten an account.


Every panel here carries the exact SQL beneath it, so each count can be re-run rather than taken on trust. To re-run one over a different window or ticker, ask in plain English on the Strasmore terminal.

#ai-agents#broker-api#pdt-rule#order-types#settlement