> For the complete documentation index, see [llms.txt](https://layer-akira.gitbook.io/layerakira-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://layer-akira.gitbook.io/layerakira-documentation/integration/trading/order/order-structure.md).

# Order structure

<pre class="language-python"><code class="lang-python"><strong>
</strong>order_scheme = {
    "maker": str,
    "price": {"type": int, 'min': 0},
    "qty": {
        "base_qty":{"type": int, 'min': 0},
        "quote_qty":{"type": int, 'min': 0}
    },
    "ticker": {"type": list, "min": 2, "max": 2, 'item_schema': {'type': str}},
    "fee": {"type": dict, 'fields': order_fee_scheme},
    "constraints": {
        "number_of_swaps_allowed": {'type': int, 'min': 0},
        "duration_valid": {'type': int, 'min': 0},
        "created_at": {"type": int, "min": 0},
        "stp":{type=int, "min":0, "max":3},
        "nonce": {'type': int, 'min': 0},
        "min_receive_amount": {"type": int, "min": 0},
        "router_signer": str,
    },
    "salt": {"type": int, "min": 0},
    "flags": {"type": dict, 'fields': {
        'full_fill_only': bool,
        'best_level_only': bool,
        'post_only': bool,
        'is_sell_side': bool,
        'is_market_order': bool,
        'to_ecosystem_book': bool,
        'external_funds':bool
        }
    },
    "source":str,
    "sign": {"type": list, "min_size": 2, 'item_schema': {'type': int, 'min': 0}},
    "router_sign": {"type": list, "min_size": 2, 'item_schema': {'type': int, 'min': 0}},
}
<strong>
</strong>Order fee structure
{
  "trade_fee": {"type": "FixedFee"},
  "router_fee": {"type": "FixedFee"},
  "gas_fee":{"type": "GasFee"}
}
</code></pre>

* **price:** price of the quote asset (for example 2801.23)
  * if the order is passive, the order will be placed into the book at this price
  * if the order removes liquidity from the book (ie. is non-passive), the order will be matched against orders in the book till the protection price (**slippage**).&#x20;
* **quantity:** matchable amount of order
  * can be expressed as the quantity of the base token (**base\_qty**) or quote token (**quote\_qty**)
* **maker:** address of the trader
* **constraints:**
  * **number\_of\_swaps\_allowed:** specify the maximum amount of trades the taker order can allow after it becomes unmatchable
  * **duration\_valid:** amount of seconds after created\_time order is valid
  * **created\_time:** epoch time in seconds for when the order was created

{% hint style="info" %}
*As each trade will cost gas, this* **number\_of\_swaps\_allowed** *limitation allows the taker to limit gas consumption by specifying the maximum amount of swaps allowed on their order. Currently the max number clients can set equals to 255*
{% endhint %}

{% hint style="info" %}
*Exchange doesn't accept stale orders or orders that have created\_time in the future. If you encounter issues please check if your machine clock aligned with the world clock*
{% endhint %}

* **stp:**
  * **NONE =** 0
  * **EXPIRE\_TAKER** = 1
  * **EXPIRE\_MAKER** = 2
  * **EXPIRE\_BOTH** = 3
* **nonce:**
  * orders that have nonces lower than the one defined by the user in the contract are considered invalid and cannot be matched (contract will fail to match it on rollup phase)
* **min\_receive\_amount:** slippage semantic, applicable only for taker Router orders
* **router\_signer:** address that signs this order on behalf of the Router, set to 0x0 in case of no router
* **flags:**
  * **full\_fill\_only:** specify if the order must be fully filled or it will be cancelled
  * **best\_level\_only:** specify if the order can be filled only on the current best level
  * **post\_only:** can order be passive
  * **is\_sell\_side:** order side
  * **is\_market\_order:** is the order a limit order or a market order
  * **to\_ecosystem\_book:**
    * True ->  order matchable only in the Ecosystem Book
    * False -> order matchable only in the Router Book
  * **external\_funds:** source of funds to perform the trade:
    * True -> funds are from the balance of erc20 token
    * False -> funds are from the balance on the Exhcange
* **ticker:** ticker
  * the first symbol corresponds to the base token
  * the second symbol corresponds to the quote token
* **fee:** order fees
  * specify how much taker/maker **fixed fees** goes to the Exchange
  * specify how much taker **fixed fees** goes to the Router
  * specify how much [**gas fees** ](/layerakira-documentation/integration/trading/fees.md)goes to the Exchange for taker orders

{% hint style="info" %}
Note: passive orders do not incur any gas fees
{% endhint %}

* **salt:** random salt provided by the user
* **sign:** sign of order hash of  its typed message  by order\_signer private key
* **router\_sign:** sign of order hash of its typed message by router\_signer private key
* **source:** order origin, from where order originates (for example "layerakira" or any other frontend)


---

# 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://layer-akira.gitbook.io/layerakira-documentation/integration/trading/order/order-structure.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.
