Position Management - Best Practices

  • Updated

Avoiding the “Not Enough Funds” Error

A specific circumstance can lead to a “Not Enough Funds” error when a user attempts to reduce an existing position. This issue arises from the interaction between system validation rules for available collateral and existing open orders that have not been explicitly marked as REDUCE ONLY. This document clarifies the preconditions for this error, the system's operational response, and the recommended methodology for prevention.

1. Order and Margin State Initialization

1.1 Opening a Position

A position is opened using 100% of available Initial Margin (IM).

Note

This means the position fully utilizes the margin allocated to it.

1.2 Placing a Take-Profit Limit Order

A Take-Profit Limit order is submitted without the REDUCE ONLY flag.

 Note: Because the order size is within the current position, the system treats it as an implicitly reducing order, requiring no additional margin at submission.

2. Position Closure Attempt and Failure

2.1 Market Movement

The market moves significantly against the position, and available margin is nearly fully utilized. An immediate position closure may be attempted at a loss.

2.2 Submitting a Market Order to Reduce the Position

A market order is submitted with the intention to reduce the entire position.

Note: This order may or may not include the REDUCE ONLY flag.

2.3 Encountering the Error

The market order may fail with a “Not Enough Funds” error, not because the order itself requires margin, but due to interactions with pre-existing orders.

3. Post-Execution Simulation and Order Reclassification Logic

3.1 System Evaluation of Remaining Orders

When the market order executes, the primary position size drops to zero. The system evaluates all pending orders, including any pre-existing Limit Orders.

3.2 Reclassification of Limit Orders

Limit Orders submitted without the REDUCE ONLY flag are reclassified from implicitly reducing orders to potential position-increasing orders.

3.3 Margin Validation for Reclassified Orders

The system checks if available margin is sufficient to support reclassified orders. If margin is nearly depleted, the validation fails.

3.4 Failure Condition

If available margin is insufficient, the market order is rejected to prevent unmargined, position-increasing orders from remaining on the order book.

3.5 Important Note

This scenario typically occurs only when the market moves significantly against a position and available margin is almost fully utilized. For example, a minor adverse price movement with substantial available funds would not trigger this issue.

4. Resolution for This Scenario

4.1 Explicit Intent and REDUCE ONLY Usage

To prevent this specific margin validation scenario, order intent must be explicitly defined. All orders intended to fully or partially reduce a position — including Limit and Stop orders — should be submitted with the REDUCE ONLY flag. This ensures that such orders are either executed as intended or automatically canceled if the primary position is already closed.

4.2 Monitoring Margin Levels

Regularly monitoring available margin, particularly during volatile market conditions, helps ensure that orders can be executed without encountering the “Not Enough Funds” error.