Risk & Safety

What this page covers
Exposure limits cap how far long and short can drift apart and how large total positions can grow. The position reserve prevents accidental full closes. PnD protection pauses OPEN orders during sharp moves. Instrument caps limit how many symbols you can run simultaneously.

Exposure Limits

The bot uses two cross-mode exposure limits that work together. Net exposure is primary. Gross exposure is secondary.
In hedge mode cross margin, effective leverage is driven by net exposure:
effectiveLeverage = abs(longUsd - shortUsd) / walletUsd
Examples with a $1,000 wallet:
Your longYour shortNet exposureEffective leverage
$500$500$00x
$2,000$1,500$5000.5x
$2,000$4,000$2,0002x

maxNetExposureUsd

Maximum net exposure in USD. Net exposure is abs(longUsd - shortUsd). Default is $1,000.
When net exposure reaches or exceeds this limit, the larger side is blocked for new OPEN orders while the smaller side continues normal operations. This allows imbalance to shrink instead of widening.
If the larger side crosses the limit while the bot is already running, GridBT may enter Exposure Freeze for that side. In this state the affected side places only safe reduce-only CLOSE orders from the first trigger price. OPEN orders are suppressed until exposure recovers. The smaller side can keep running because it helps reduce net exposure.
Example: maxNetExposureUsd: 750
Your longYour shortNetLong OPENShort OPEN
$1,000$750$250AllowedAllowed
$1,000$200$800BlockedAllowed
$200$1,000$800AllowedBlocked
Example: maxNetExposureUsd: 1000
Your longYour shortNetLong OPENShort OPEN
$2,000$990$1,010BlockedAllowed

Exposure Freeze controls

When a freeze is active, the pair table shows an exposure warning triangle on the breached side. Open it to review the frozen trigger price and choose one of these actions:
ActionWhen to use it
Reset to current markMove the close-only anchor to the current mark after you verify the new anchor is acceptable. Available while the bot is stopped.
Set custom trigger priceUse a specific close-only anchor price. The bot validates the price before saving it.
Clear freezeAvailable after exposure has recovered, or while the bot is stopped.
If GridBT cannot confirm that old bot-owned grid orders were canceled, it fails closed: no replacement close-only orders are placed and the side stays suspended until a later startup or reconstruction can re-list exchange orders and confirm cleanup. Manual user orders are not canceled by Exposure Freeze.

maxGrossPositionUsd

Maximum gross position in USD. Gross position is longUsd + shortUsd. Default is $2,000.
This is a secondary safety net. When gross position reaches or exceeds this limit, both sides are blocked for new OPEN orders. This prevents total exposure from growing even when long and short remain balanced.
Note: These limits are cross-mode and cannot be overridden per mode. They apply at the pair level.

warningThresholdPct

Fraction of either limit at which the bot starts logging warnings. Default is 0.8 (80%).
This does not block any orders. It is an early alert that exposure is approaching the limit. With maxNetExposureUsd = $1,000 and warningThresholdPct = 0.8, warnings start at $800 net exposure.

Min position reserve

minPositionQty

Controls how much quantity the bot reserves when closing a position. Default is -1.
  • -1: reserve one exchange qtyStep. This is the safest default: it prevents the bot from fully flattening a position by accident. With ETHUSDT (qtyStep = 0.01 ETH), one step is reserved, keeping the position alive.
  • 0: full close is allowed. The bot can close the entire position.
  • Positive value: reserve exactly that quantity. For example, 0.05 reserves 0.05 units regardless of exchange step size.
The default of -1 is recommended unless you have a specific reason to allow full closes or to set a manual reserve amount.

Instrument cap

Regular users have a maximum number of enabled instruments. The default limit is 10 symbols.
  • Running both long and short for the same symbol counts as one instrument (not two).
  • If you already have 10 symbols enabled and try to enable an 11th, the save is blocked with a validation error.
  • The limit is enforced server-side, so it cannot be bypassed from the UI.
  • Admins can adjust the limit per user.