# Core Trading Mechanics

At the heart of NexaDex is a Pool-to-Peer (P2P) execution model. This architecture eliminates the traditional order book—removing the risk of front-running, "toxic" MEV, and information leakage. In 2026, where predatory bots have evolved to exploit even the smallest slippage, NexaDex provides a sanctuary of Zero-Slippage Execution.

#### Deterministic Margin & Position Privacy

NexaDex uses a mathematical foundation that ensures your strategy is never telegraphed to the market.

* The Formula: $$ $Position\ Size = Margin \times Leverage$ $$
* Non-Custodial Calculation: Your P\&L and margin requirements are calculated on-chain using Versioned Transactions for maximum efficiency.
* Oracle-Based Privacy: Because we use Pyth Network Pull Oracles, every trade executes at the *global median price*. Since there is no slippage curve, a $1M trade looks identical to a $100 trade on the ledger—completely masking the "Whale" status of institutional participants.

#### Isolation & Collateral Security

NexaDex leverages Solana’s Parallel Execution (Sealevel) to keep your risk contained.

* Isolated Margin by Default: Each position is its own "silo." A black-swan event in one asset cannot drain your entire account.
* Structural Privacy: By isolating margin, we prevent cross-asset correlation. Observers cannot link your $SOL long to your $AAPL short, protecting your complex hedging strategies from being de-anonymized.

### Risk Management Stack

Risk management is programmatic and staged. As Solana’s infrastructure reaches new milestones, NexaDex unlocks higher performance.

#### Phase 0: Foundation (Solana Agave)

* Leverage: Max 10x.
* Focus: Stability during the early 2026 Alpenglow transition.
* Privacy: Basic pseudonymity with oracle-based execution.

#### Phase 1: Performance (Firedancer + Alpenglow)

* Leverage: Max 50x.
* Sub-150ms Finality: Positions are opened and closed nearly instantly, virtually eliminating "stale price" risk.
* The Insurance Fund (IF): A protocol-wide buffer capitalized by fees. The IF handles liquidations that "gap" through the price, ensuring LPs are always whole without ever needing to identify the traders involved.

### Privacy-Preserving Liquidation Mechanics

Liquidations are a major source of MEV on Solana. NexaDex neutralizes this through Encrypted Block Assembly (BAM).

* Keeper Privacy: Liquidations are handled by a decentralized network of Keepers. These bots see *that* a position needs closing, but they cannot see *who* is being liquidated or the historical context of the account.
* No "Bad Debt" Profiling: Deficits are covered by the Insurance Fund at the aggregate level. NexaDex does not maintain a "Blacklist" or "High-Risk Database," ensuring your liquidation history doesn't follow you across the ecosystem.

### Advanced Order Execution (Privacy-Native)

Phase 1 introduces Limit Orders, Stop-Loss (SL), and Take-Profit (TP) without the public exposure of a "Shadow Book."

* Off-Chain Intent, On-Chain Execution: Your SL/TP triggers are stored in an encrypted, off-chain state. They are only "pulled" on-chain by the Pyth Oracle when the trigger condition is met.
* Zero Pre-Execution Leakage: Unlike traditional order books where "stop-hunting" is common, your exit levels are invisible to other traders and predatory bots until the moment they execute.

#### Comparison: The Execution Landscape

| **Metric**       | **Traditional CEX**     | **Standard Solana DEX** | **NexaDex**                    |
| ---------------- | ----------------------- | ----------------------- | ------------------------------ |
| Execution Price  | Market Order (Slippage) | AMM Curve (Slippage)    | Oracle Median (Zero Slippage)  |
| Order Visibility | Full Book Visibility    | Public Order Book       | Encrypted / Hidden Intent      |
| Finality         | Centralized / Instant   | \~400ms - 1s            | \~150ms (Alpenglow)            |
| MEV Protection   | Internal Only           | Vulnerable              | Structural (Jito-Bundle Ready) |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://nexadex.gitbook.io/nexadex-docs/trading-mechanics/core-trading-mechanics.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
