> For the complete documentation index, see [llms.txt](https://hyperpnl.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hyperpnl.gitbook.io/docs/architecture/core-backend/trade-simulation.md).

# Trade Simulation

Once an order is matched, the trade is fully simulated inside HYPERPNL’s backend.

The simulation updates the trader’s account state deterministically, using the execution result produced by the matching engine.

#### <mark style="color:$warning;">**Position Updates**</mark>

Each executed trade updates:

* Position size
* Average entry price
* Open exposure

If a position is increased, the entry price is recalculated as a size-weighted average.\
If a position is reduced or closed, the original entry price is preserved for PnL calculation.

#### <mark style="color:$warning;">**Cross Margin Model**</mark>

HYPERPNL uses a **cross margin** model.

All positions within the same account share the same margin and equity.\
There is no isolated margin per position and no liquidation engine.

Risk is managed through predefined drawdown rules rather than forced liquidations.

#### <mark style="color:$warning;">**Partial Closes and Reductions**</mark>

When a position is partially closed:

* Realized PnL is applied immediately
* Remaining position continues with the same entry price logic

Reduce-only rules are enforced to prevent unintended exposure increases.

#### <mark style="color:$warning;">**Consistent Simulation**</mark>

The same simulation logic applies to both demo and funded accounts.

There are no relaxed rules or alternate paths based on account type or phase.
