> For the complete documentation index, see [llms.txt](https://dev.hybrid-chain.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dev.hybrid-chain.com/guides/financial-infrastructure/perpetuals-trading.md).

# Perpetuals Trading

**Overview:** Launch a high-performance, margin-enabled trading platform for perpetual derivatives using Hybrid-Chain’s decentralized core. Trade synthetic assets (crypto, FX, stocks, commodities) 24/7 with leveraged exposure and settlement powered by hybrid margin wallets, fast-layer APIs, and custom price feeds.

**Platform Benefits:** Perpetual contracts are executed on-chain using Hybrid-Chain's deterministic ledger and wallet-based margin control. This prevents liquidation spoofing, ensures accurate PnL resolution, and avoids traditional order book latency. Operator-defined instruments can be added with precision.

**Integration Flow:**

1. **Trading Pair & Market Definition:**
   * Use `CreateMarket()` to define asset pairs (e.g., BTC/USD perpetual)
   * Set leverage limits, funding rate logic, tick size, and margin requirements
2. **User Registration & Wallet Provisioning:**
   * Onboard users and create margin wallets (linked to vaults)
   * Assign margin tiers, risk flags, and liquidation rules
3. **Order Entry & Matching:**
   * Submit orders via `SubmitOrder()` or link to WebSocket API
   * Use `MatchEngine()` internally or via an external matching layer
4. **Funding Rate Settlement & PnL Calculation:**
   * Calculate funding payments and net PnL periodically
   * Use `TransferMargin()` and `UpdatePosition()` APIs to maintain user balances
   * Apply auto-liquidation triggers or manual interventions
5. **Settlement & Withdrawal:**
   * Users may request vault withdrawal or position closure
   * Signed transactions confirm withdrawal from Hybrid-Chain to Layer-1

**Optional Add-ons:**

* Dynamic leverage tiers based on token holdings or NFT staking
* Social trading, mirrored portfolios, or structured vault indexes
* Circuit breakers and pause logic for high-volatility environments

**Note:** Leverage and derivative trading is regulated in most jurisdictions. Ensure user access complies with local financial regulations, licensing, and leverage limits.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://dev.hybrid-chain.com/guides/financial-infrastructure/perpetuals-trading.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
