# Limit Order Tranches

`LimitOrderTranches` are used to store liquidity in the form of limit orders. In addition to the `PairID`, `TokenIn` and `TickIndex` fields, Pools Reserves also have `TracheKey`, `ReservesTokenIn`, `ReservesTokenOut`, `TotalTokenIn`, `TotalTokenOut` and an optional `ExpirationTime` field.

```proto
type LimitOrderTranche struct {
    PairID           *PairID
    TokenIn          string
    TickIndex        int64
    TrancheKey       string
    ReservesTokenIn sdk.Int
    ReservesTokenOut sdk.Int
    TotalTokenIn     sdk.Int
    TotalTokenOut    sdk.Int
    ExpirationTime *time.Time
}
```

TrancheKey is a unique identifier for each `LimitOrderTranche`. TrancheKeys also represent a lexicographically sortable order in which tranches with a common PairID, TokenIn and TickIndex will be traded through. Ie. A tranche with TrancheKey “A1” will be traded through before a tranche with TrancheKey “A2”. ReservesTokenIn is the available token that has been added to a limit order by the “maker” and represents the amount of `TokenIn` that can be traded against. `ReservesTokenOut` represents the filled amount of the limit order and can be withdrawn by the “maker”s. `TotalTokenIn` and `TotalTokenOut` are used to store the respective high watermarks for `ReservesTokenIn` and `ReservesTokenOut` and are used for the internal accounting of a limit order.

Lastly, ExpirationTime is an optional field used for Expiring limit orders (`JUST_IN_TIME` and `GOOD_TIL_TIME`). At the end of each block any LimitOrders with `ExpirationTime` <= `ctx.BlockTime()` is converted to an `InactiveLimitOrderTranche` where it can no longer be traded against.


---

# 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://duality.gitbook.io/duality-documentation/concepts/tickliquidity/limit-order-tranches.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.
