> ## Documentation Index
> Fetch the complete documentation index at: https://docs.everstrike.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Off-Chain Order Matching and Risk Engine on Everstrike

> Explore Everstrike's off-chain risk and matching engines — order submission, margin validation, FIFO price-time priority, and API deployment regions.

Everstrike runs its matching and risk engines off-chain, connected to clients through the Everstrike API. This design keeps order processing fast and gas-free while the on-chain contracts retain custody of your funds. Every order you submit passes through a structured lifecycle before it can execute as a trade.

## Order Lifecycle

<Steps>
  <Step title="Submit an order through the API">
    Send your order via the REST API or WebSocket API. Include the instrument, side, size, price type, and any order-specific parameters.
  </Step>

  <Step title="Risk engine verifies the order structure">
    The risk engine checks that the order is well-formed — correct field types, valid instrument, supported order type — and rejects malformed orders immediately.
  </Step>

  <Step title="Risk engine checks margin requirements">
    The risk engine verifies that your account holds sufficient free funds to cover the required margin for the order. Orders that would leave your account under-margined are rejected.
  </Step>

  <Step title="Valid orders enter the order book">
    Orders that pass both checks enter the internal order book. They remain in memory until they either match or are cancelled.
  </Step>

  <Step title="Immediately matching orders execute as trades">
    If the order matches an existing order on the opposite side, it executes immediately as a trade. Your balances and positions update, and you receive a new state receipt.
  </Step>
</Steps>

Orders without an immediate match remain in the order book until a matching counterparty appears or you cancel the order.

## Matching Priority

Everstrike uses **first in, first out (FIFO) price-time priority**.

Price is the primary determinant of execution order — a better-priced order always executes before a worse-priced one, regardless of when it was submitted. When two orders share the same price level, the order submitted earlier takes priority. The oldest order at any given price level executes first.

This means the fastest path to execution is submitting competitive prices early. There is no advantage to submitting multiple orders at the same price — only the first one will fill first.

## API Deployment Locations

The Everstrike matching engine and API run in the following Google Cloud Platform regions:

| Environment | Region  |
| ----------- | ------- |
| Mainnet     | Belgium |

<Info>
  If you are a market maker or a latency-sensitive trader, place your infrastructure in the same region as the matching engine. Reducing round-trip time to the API improves your ability to update quotes and capture fills before others.
</Info>

For a complete overview of the system, see [Technical Architecture](/technical-architecture/technical-architecture).
