> For the complete documentation index, see [llms.txt](https://ostium-labs.gitbook.io/ostium-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ostium-labs.gitbook.io/ostium-docs/ostium-trading-engine/step-by-step-tutorial/closing-a-trade.md).

# Closing a Trade

{% hint style="warning" %}
These docs are deprecated and may be outdated. Please use the new docs: [docs.ostium.com](https://docs.ostium.com/)
{% endhint %}

{% stepper %}
{% step %}

### Identify Closing Trade

Identify the trade you'd like to close and click on "Close" button

<figure><img src="/files/NvAx5PbIPojHwRoUGOnh" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### (Optional) Partial Close

On Ostium, you can partly close your trade. Define **Size to Close** or **Percentage** > "Close" Button

{% hint style="info" %}
The remaining size must be equal to or above the minimum trade size.
{% endhint %}

<figure><img src="/files/ypMv0NpIR4Bjoe6ISoP9" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Fully Close Position

Set 100% in closing percentage > "Close" button

<figure><img src="/files/zDWeHTyc0jvZq1lPU4sH" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Portfolio Stats

That's it! See a summary of your remaining open positions as well as your historical (closed) positions under the Portfolio page:

<figure><img src="/files/TPTPsCOnj43hBKRxOj4q" alt=""><figcaption><p>Portfolio Overview</p></figcaption></figure>

<figure><img src="/files/YsdXj2PjbeDWgOb0vdm3" alt=""><figcaption><p>Position History</p></figcaption></figure>
{% endstep %}
{% endstepper %}


---

# 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://ostium-labs.gitbook.io/ostium-docs/ostium-trading-engine/step-by-step-tutorial/closing-a-trade.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.
