Post-Trade Risk

Post-trade risk is evaluated after positions are open. When an account breaches a threshold (like a daily loss limit or trailing max drawdown), the system automatically liquidates positions and can lock the account.

Configuring Post-Trade Risk Settings

You can configure post-trade risk in two ways:

  1. At account creation, by providing a postTradeRisk object on the account object.
  2. At any time after creation, by calling userAccountAutoLiq/update.

Both methods let you configure the following settings:

Note: All these fields are optional. Omitting a field will simply ignore calculations for that liquidation type. For example, an account without a dailyLossAutoLiq has no daily loss limit applied.

FieldDescription
marginPercentageAlertMargin percentage that triggers an alert to the permitted user.
dailyLossPercentageAlertDaily loss percentage (of the day’s starting balance) that triggers an alert to the permitted user.
dailyLossAlertDollar-value daily loss that triggers an alert to the permitted user.
marginPercentageLiqOnlyMargin percentage that triggers Liquidate Only mode. The account can close positions but can’t open new ones.
dailyLossPercentageLiqOnlyDaily loss percentage (of the day’s starting balance) that triggers Liquidate Only mode.
dailyLossLiqOnlyDollar-value daily loss that triggers Liquidate Only mode.
marginPercentageAutoLiqMargin percentage that triggers automatic liquidation.
dailyLossPercentageAutoLiqDaily loss percentage (of the day’s starting balance) that triggers automatic liquidation. Unlocks at the next market open.
dailyLossAutoLiqDollar-value daily loss that triggers automatic liquidation. Unlocks at the next market open.
weeklyLossAutoLiqDollar-value weekly loss that triggers automatic liquidation. Unlocks at market open on Sunday.
flattenTimestampFlattens and cancels all open positions at this date-time. This is a one-time event, not a recurring schedule. Once flattened, nothing prevents the user from re-opening positions.
trailingMaxDrawdownMaximum loss the account can sustain before automatic liquidation. The threshold trails upward as the account profits.
trailingMaxDrawdownLimitEquity level at which trailing stops. For example, if set to $50,100 on a $50,000 account, the trailing drawdown level won’t increase beyond $50,100.
trailingMaxDrawdownModeTrailing calculation mode: "EOD" (trailing level updates at end-of-day, 4 PM CT) or "RealTime" (trailing level updates continuously, including on unrealized profit).
dailyProfitAutoLiqDollar-value daily profit that triggers automatic liquidation. Unlocks at the next market open.
weeklyProfitAutoLiqDollar-value weekly profit that triggers automatic liquidation. Unlocks at the next Sunday open (5 PM CT).
doNotUnlockWhen true, the account stays locked after a daily loss limit breach instead of auto-unlocking at the next market open. You must manually unlock the account by calling setAdminAutoLiqAction with Normal.

Only affects daily loss limit breaches; standard trailing max drawdown violations lock the account permanently regardless. In a bounced-market scenario where volatility pushes the balance back above the drawdown threshold, doNotUnlock keeps the account locked and prevents auto-unlock.

There is no bulk endpoint to unlock accounts locked with doNotUnlock set to true, so accounts must be unlocked one at a time. If you’re managing the doNotUnlock workflow, plan for a backend process that resets accounts individually before each session.