Live trading¶
Live trading is on. There is no paper-first step and no small-size live cap. Set APATHIA_ENABLE_LIVE=false to turn live mode off: a live order is then refused and left unsent, and paper still runs.
Switch a trade to Live with the Paper / Live control on its row in the Trading Center. Which markets and directions run live is in Directions by market. Each new live entry asks the license service first.
Margin and leverage¶
Before the first Live entry on a Perpetual or Futures pair, Apathia sets the run's Margin mode and the trade's Leverage on the exchange, and again only if the pair, mode or leverage changes. Isolated is the default where the venue offers it; Cross is a labelled option next to it on Standard, Ladder and Funding Carry perpetual runs, and a run with no mode set uses the venue's default. On OKX and Hyperliquid the set-mode call carries the leverage and the set-leverage call carries the mode, so Hyperliquid does not fall back to cross. On a cross-only venue, for example Paradex, the set-mode call is skipped and isolated is unavailable. If a venue cannot set the margin mode, live Cross is refused when the run starts.
If the exchange refuses that change, for example because a position or order is open in another mode, the entry is not sent, the trade shows Error, and one notification is sent. All live cross paths are labelled Untested, including live Funding Carry on cross. Carry's perp leg joins the same account-wide cross pool as Standard and Ladder, and can use the account's free balance; isolated Carry still never uses free cash. A Funding Carry run on cross is emergency close only: no top-ups and no self-rebalance. Leverage caps, the modes a venue supports, and each mode's live status come from that venue's capabilities; see Margin mode by venue. Portfolio is a spot holding strategy and does not offer Perpetual markets, leverage, or margin modes.
0.13.1 (unreleased)
A live perpetual Grid (labelled Untested) sets its margin mode and leverage once, just before its first opening order; if the exchange refuses, no order is sent and the run stops with Margin settings refused (margin_refused). Its closes are reduce-only, so it is refused on an exchange that can't place reduce-only orders: "This exchange can't place reduce-only orders, so a live futures grid could open the opposite side. Backtest and paper still work." Backtest and paper are unaffected there. An explicit zero position on the exchange while the grid holds inventory stops the run as incomplete. See Grid perpetuals and recenter. Details are in the 0.13.1 release notes.
A live Kraken :BTNL margin order carries its leverage on the order instead, and needs leverage greater than 1. See Live Kraken margin orders.
Funding Carry self-rebalance¶
A live Funding Carry run can add and remove isolated margin on the short so the legs stay matched, without a cash reserve. The same settings and defaults as paper and backtest apply; see Self-rebalance.
After every margin change, Apathia reads the isolated margin back. If it moved the wrong way, only part of the way, or not at all, rebalancing stops for that run, an alert is sent, and the run is labelled Self-rebalance stopped for this run after a margin check failed — emergency close only. That stopped label is shown even if the account's margin mode was not detected. The emergency close is checked before liquidation and still runs on every check, even while a margin change's outcome is not yet known: it fires once the mark reaches the liquidation price times (1 − the Emergency close cushion (% of price)), while the short is still solvent, at the existing 1.5× maintenance-ratio close, or if the buffer falls to 25% of its target and cannot be restored. On live Cross, the exchange's liquidation price is used only while it still describes the current short and is no older than 120 seconds; otherwise the estimate is used alone. The tighter (earlier) trigger wins. Isolated margin always uses the estimate. The close fills at the market at that time. A rejected close retries at the later price. A close or liquidation on a bar does not reopen the pair on that same bar or observation. No new margin call is sent while one is unknown. If the emergency close closes the pair during that wait, the open call is kept and read back later, recorded as resolved by the emergency close, with one close reason and no rebalancing-stopped alert. Until that leftover call is resolved, no new pair opens; the emergency close, exits and recovery keep running. The run report lists each leftover call next to the in-flight rebalance details, as a warning: Entries blocked until margin call … resolves (times out at …). The emergency close, exits and recovery keep running. On a live run on an exchange with no expiry, the time shown is local, and the timeout is the time the call was sent plus the unknown timeout. When the warning has no timeout: if the call is still waiting on the exchange's own expiry (30 s on Hyperliquid), it says waiting for the exchange's 30 s expiry; if that expiry has already passed, it says decided at the next check. When the list is empty, nothing is shown, including on older runs, which report an empty list. The list clears once the call is resolved. On Hyperliquid, the leftover call is decided on the next check after its 30-second expiry, and entries then resume — they are not paused. Until then, the open call blocks new entries. On a live run on other exchanges there is no expiry. If the exchange's last answer was that the call might still land, new entries pause at the close and stay paused until the run is resumed. Otherwise new entries stay blocked by the open call until the unknown timeout; at the timeout the call is recorded as resolved by the emergency close, and if the exchange still says it might land, entries pause until the run is resumed. A pause is recorded as an event, not as a second close reason. Every live margin change is recorded in data collection.
Which exchanges can add and remove isolated margin, and the exact label each one shows, is in Self-rebalance by exchange. Self-rebalance is available on every exchange that has an isolated add/remove margin API; untested means real runs confirm it through data collection. Hyperliquid is labelled Self-rebalance on (mocked contract, not yet run on an account). Unified mode needs no spot-to-perp transfer.
On exchanges where an internal spot-to-perp transfer is not available in Apathia and the wallets are not shared, self-rebalance is labelled No spot-to-perp transfer on this exchange: emergency close only. It is grayed out in the editor and refused by the backend; only the emergency close stays on. Delta, Delta Exchange India and WooFi Pro use a shared wallet, so no transfer is needed and self-rebalance stays available, labelled untested. If a spot-to-perp transfer fails after the trim, the short has been trimmed and spot sold, self-rebalance stops for the run, and the emergency close stays on. If an up-move cannot restore the target from the trim, the step is rejected whole, the emergency close stays on, an alert is raised in the run report, and a notification is sent (both repeated hourly while the condition lasts).
If the account's margin mode cannot be read, the run still rebalances, behind the same read-back check, and is labelled Margin mode not detected: rebalancing untested (read-back guard and emergency floor stay on). If a later margin check fails, or a spot-to-perp transfer was rejected, the run is labelled Self-rebalance stopped for this run after a margin check failed — emergency close only or Self-rebalance stopped for this run after a spot-to-perp transfer was rejected — emergency close only instead.
A portfolio margin account is labelled Portfolio margin account: self-rebalance unsupported — emergency close only. There is no rebalancing; only the emergency close stays active.
Stop and keep positions blocks rebalance orders; the emergency close can still close the pair.
Exits and stops¶
The strategy's stop-loss and take-profit run on the live trade. Where the exchange can rest a reduce-only stop and a reduce-only limit, those exits rest on the exchange. Where it cannot, the trade shows Simulated stop or Simulated take-profit, and Apathia closes the position when the level is reached.
An exchange-side safety stop is not offered. Live trading does not force-close at a liquidation price; the exchange liquidates. See Safety stops.
Order sizing and contracts¶
Inside Apathia, live order amounts are always in the base asset (for example BTC on BTC/USDT:USDT). On contract perpetuals and futures, the exchange receives contracts: the base amount divided by that market's contract size. Fills come back in base, and a fee the exchange takes in the base asset is subtracted, so the booked amount is what arrived.
Each market is checked when the order is placed. A refusal applies to that market only, and the refused order is not sent.
- Inverse (coin-settled) contracts are refused. Live supports linear, quote-settled perpetuals and futures only.
- Missing contract size. A contract market that publishes no contract size is refused; the size is never guessed. bitFlyer and Bitstamp, whose amounts are already in base, are treated as size 1.
- Amount not on the order step (contract markets). An amount that is not a whole number of order steps is refused whole, not rounded down. The refusal names the contract size and the amount precision. Signal trades keep their round-down to whole order steps.
- Below the exchange minimum. An order below the minimum amount or minimum cost is refused whole. It is never raised to the minimum or shrunk.
On a spot market, the amount and the limit price are rounded to the exchange precision before sending. A live Grid is refused at start, with no order sent, when its quantity step or price tick is not a whole multiple of the exchange's steps, or when its minimum quantity or minimum order value is below the exchange's.
Quarantine¶
If a fill cannot be booked, that order is quarantined, and the quarantine survives restarts. Later orders on the same account keep moving. Stopping a run is never blocked by a quarantined order. Cancelling a quarantined order cancels it at the exchange but keeps the quarantine, so fills that came in before the cancel can still be booked once.
To release one, open Stats on the trade in the Trading Center. A quarantined order stays in Open orders, including after it was cancelled, marked quarantined; hovering the mark shows the reason. Press Release. Apathia clears the quarantine, books any remaining exchange fills once, refreshes and shows Quarantine released. If the fills still cannot be booked, the order is quarantined again and the page says why.
Orders placed by a workspace run (Grid, Funding Carry, Portfolio) are not trades, so they are not on a trade's Stats. The Trading Center lists them in a separate Quarantined workspace orders card, one row per order with its owner (for example Grid run and the run id), and the same Release button. While a live Grid order is quarantined, a cancelled or empty lookup is not treated as a close, so the cell is not re-armed and the fill is not lost. Releasing the quarantine books the venue fill to its cell once; a second release is refused. After a restart the quarantine is kept and the fill still books once.
Order not found yet¶
After a restart or a lost reply, Apathia looks an order up on the exchange by its client order id, and in the exchange's trade history when the order is no longer listed. A fill found there is booked once.
When the exchange does not list the order and its trade history has no trades for it, the order stays unknown for up to 90 seconds from when it was sent, because an exchange can take a moment to list a new order. Nothing is re-sent meanwhile, and its reason reads Order not found yet and no trades; waiting out 90s grace or a position match. A fill that shows up in that time is booked once. After 90 seconds with no order and no trades, the order is booked as rejected: Not found on the exchange after grace; no fills in fetchMyTrades. A market order can be settled as rejected sooner, when the exchange position for that market matches Apathia's records. A limit order always waits the full 90 seconds, because it may still be resting.
Order budget and exposure cap¶
Every live order, from a trade or a manual order, stays inside that account's order budget: 85% of the exchange's rate limit. On Kraken Starter that is 51 trading points and 17 private REST points. Over that budget, or while the account is paused after a rate-limit error, the order is not sent and one notification is sent.
There is no exposure cap unless you set APATHIA_LIVE_MAX_OPEN_EXPOSURE (in the quote currency). Leave it unset for no cap. With a number, a live order that opens or adds exposure is refused when open live notional plus the new order would pass it; nothing is sent and one notification is sent. 0 blocks every live entry that opens exposure. A sell that closes or reduces a position, a reduce-only exit and a safety-stop exit are never blocked by the cap.
An exchange reject leaves the order unsent, and one notification is sent.
Live order log¶
Every live order attempt is saved on this computer: accepted, refused by the order budget, paused after a rate limit, refused by the exposure cap, rejected by the exchange, or blocked because isolated margin or leverage could not be set. The newest 5000 are kept. Paper orders are not saved.
There is no card for this list. Read it with GET /trading/live-outcomes (add format=csv to download). The same rows go into the anonymized batches described in Data collection.