# Position

Depending on the parameters of the order (leverage, expiration date) the appropriate futures contract hash is generated by the DMEX Web Application and sent for matching to the DMEX server.

The matching is performed as is usually done on an exchange, buy orders and sell orders are matched against one another and if the price condition matches, a new trade is created. The trade is then sent to the Smart Contract and a position is opened.

A position contains the following parameters:

| Parameter  | Type   | Description                                                      |
| ---------- | ------ | ---------------------------------------------------------------- |
| size       | uint64 | the size of the position in terms of the underlying asset (x1e8) |
| price      | uint64 | the average entry price                                          |
| side       | uint16 | 0 or 1 (1 - long, 0 - short)                                     |
| entryBlock | uint48 | the average entry block for the position                         |
| collateral | uint64 | the amount of collateral (margin) reserved for the position      |

Each position has its unique hash comprised from the user address, futures contract hash and side.

```javascript
function generatePositionHash (address user, bytes32 futuresContractHash, bool side) public view returns (bytes32)
{
    return keccak256(this, user, futuresContractHash, side);
}
```


---

# 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://docs.dmex.app/definitions/position.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.
