Skip to Content
Welcome to Level2 Help Center

Position Closure & Discrepancy Handling

In automated trading, staying perfectly synced with your broker is crucial. Here is how the system handles position closures, including how it recovers if a trade was manually closed outside of the platform.


Note for Users: If you manually intervene and close a position directly on your broker’s app or website, our system will gracefully detect the absence of the trade and clear your local order book at the current market price without throwing an error.


The Closure Logic

When the system triggers a command to close an open trade, it follows a two-step validation process:

1. Broker Verification

The system first queries the broker to check for any active, open positions for the specific ticker symbol. If the position is found, the system proceeds with the standard automated closure routine via the broker’s API.

2. Local Syncing (Manual Closure Fallback)

If the broker returns no open positions for that symbol, the system assumes the position was manually closed or adjusted by the user directly on the broker’s platform.

To prevent the local database from getting stuck or out of sync, the system will automatically:

  • Bypass the broker execution step (to prevent accidental counter-orders or duplicate position errors).
  • Force-close the position inside the local order book.
  • Record the exit price using the Last Traded Price (LTP).
Last updated on