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

# Close a Trade

> Fully or partially close an Ostium position with the Builder SDK.

Use `closeTrade()` with the `pairId` and `idx` from `getOpenPositions()`.

```ts theme={null}
await client.closeTrade({
  pairId,
  idx,
  price: '66000',
  closePercent: 100,
});
```

Partial close:

```ts theme={null}
await client.closeTrade({
  pairId,
  idx,
  price: '66000',
  closePercent: 50,
});
```
