> ## 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.

# closeTrade

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

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

For a partial close:

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

## Response schema

```ts theme={null}
interface Response {
  txHash: `0x${string}`;
  smartAccountAddress?: `0x${string}`;
}
```
