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

# Open a Hedge

> Price a Hedge, open it, and poll until it fills.

Opening a Hedge is a three-step flow: get a quote to see the cost (optional), submit the open, then poll until it fills. This page walks through all three. For the exact schemas, see [`POST /hedges`](/api-reference/introduction) in the reference.

## 1. Get a quote

A quote returns an indicative price and full cost breakdown for a Hedge, without opening anything. Quotes are not binding and not persisted; opening re-prices against the live rate.

```bash theme={null}
curl -X POST "$BASE_URL/quotes" \
  -H "Authorization: Bearer $MARKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"market":"USDTNGN","side":"sell","notional_usd":100000,"tenor_days":7}'
```

The quote breaks down into three parts:

* **pricing** - `execution_price` is what the Hedge would open at (mid rate plus impact).
* **carry** - net carry, signed, both daily and over the full tenor.
* **upfront** - `total_upfront_usdc` is margin plus the open-and-close platform fee, all reserved at open.

## 2. Open the Hedge

Submit the open with the market, side, size, and tenor. It returns immediately with `status: "submitted"`, an `order_tx_hash`, and a `hedge_id`; the position is not live yet.

| Field              | Type    | Required | Description                                 |
| ------------------ | ------- | -------- | ------------------------------------------- |
| `market`           | string  | Yes      | e.g. `USDTNGN`.                             |
| `side`             | string  | Yes      | `buy` or `sell`.                            |
| `notional_usd`     | number  | Yes      | Hedge size in USD, greater than 0.          |
| `tenor_days`       | integer | Yes      | Settlement tenor. One of `1`, `3`, `7`.     |
| `client_reference` | string  | No       | Your own deal id, echoed back on the Hedge. |

<Info>
  Pass a unique `Idempotency-Key` header so the open is safe to retry. Retrying with the same key and body returns the original result instead of opening twice. See [API Conventions](/guides/api-conventions#idempotency).
</Info>

```bash theme={null}
curl -X POST "$BASE_URL/hedges" \
  -H "Authorization: Bearer $MARKS_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"market":"USDTNGN","side":"sell","notional_usd":100000,"tenor_days":7,"client_reference":"deal-4821"}'
```

The response returns the `hedge_id` to poll, the `collateral_usdc` locked at open (margin plus platform fee), the `maturity_at` date, and a `quote` echoing the agreed terms.

## 3. Poll until filled

Poll the Hedge by id until `status` becomes `filled`. A filled Hedge gains a `fill_tx_hash` and its own `struck_rate` (the rate captured at fill). This usually takes a few seconds.

```bash theme={null}
curl "$BASE_URL/hedges/HEDGE_ID" \
  -H "Authorization: Bearer $MARKS_API_KEY"
```

<Warning>
  If a Hedge ends up `failed`, nothing was opened and any reserved collateral is released. Re-submit with a new `Idempotency-Key`.
</Warning>

## Next

Once filled, the Hedge is a live position. See [Monitor Positions](/guides/monitor-positions) to read its P\&L and carry, or [Add to a Hedge](/guides/add-to-a-hedge) to grow it.
