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

# Hedging

> Turn a trader's WhatsApp confirmation, or a hedge request from your own systems, into a broker order you approve in the Inbox, then record the broker's fill.

A **hedge** is a futures position taken to offset the price risk of a physical contract: when you buy sugar at a fixed price, you sell sugar futures so a price fall doesn't wipe out your margin. The broker who places the order replies with a **fill**: how many lots were done and at what price.

The Hedging workflow follows that loop. A trader confirms a physical contract, Mercora prepares the hedge and the broker order, an operator approves it in the Inbox, and the broker's fill is recorded against it.

Mercora never sends an order to a broker without an operator's click.

> [!NOTE]
>
> Available when the **Hedging** module is turned on for your workspace. Ask your workspace admin. The WhatsApp connection itself is managed separately, see [WhatsApp](https://docs.mercora.io/integrations/whatsapp.md).

## How a hedge flows

**1. A trader confirms the physical**

A trader posts the confirmation in a WhatsApp group set up for hedge requests. Or your own system sends a hedge request through the API.

**2. Mercora prepares a hedge plan**

Mercora reads the message, finds the matching hedge rule, and works out the lots, the futures contract and the broker order. The plan lands in the **Inbox**.

**3. An operator approves and sends the order**

You check the plan and the order text, then send it to the broker's WhatsApp group.

**4. The broker replies with the fill**

The broker's reply in their group is matched to the hedge, automatically or by you.

**5. The hedge closes**

The fill completes the hedge sheet row and, if connected, is booked in your CTRM.

## Set up hedging

A workspace admin sets this up once, under **Settings → Integrations → WhatsApp**. Before you start, Mercora's WhatsApp number must be connected and added to the trader and broker groups (see [WhatsApp](https://docs.mercora.io/integrations/whatsapp.md)), and, to log hedges in a sheet, Google Sheets connected (see [Google Sheets](https://docs.mercora.io/integrations/google-sheets.md)).

### Route the WhatsApp groups

Under **WhatsApp Group Routings**, map each WhatsApp group that Mercora's number is in to a role:

| Role | Group |
| - | - |
| `hedge-source` | Where traders post their confirmations. |
| `broker-confirm` | Where the broker replies with fills. Enter the broker's name. |

Mercora reads only the groups you route. It posts in them only what you approve: the broker order and the thumbs-up.

### Add hedge rules

Under **Commodity Hedge Rules**, add one rule per origin keyword and book. A **book** here is a commodity on an exchange, such as white sugar in London. WhatsApp confirmations and API hedge requests are both planned from these rules.

| Field | What it sets |
| - | - |
| **Origin keyword** | The word in a trader's message that selects this rule. |
| **Commodity**, **Exchange** | The book. |
| **Currency (3-letter ISO)** | The currency of the futures. |
| **Tonnes per lot** | How a physical quantity converts to lots. |
| **Futures symbol template** | How the futures contract is written, for example `QC{month}{y}`, or `{ref}` to use the origin's reference as is. |
| **Default broker name** | The broker the order goes to. |
| **Supplier label (sheet comments)** | The label written in the hedge sheet. |
| **Hedge sheet** | The Google Sheets spreadsheet and tab where each hedge is logged. See [Google Sheets](https://docs.mercora.io/integrations/google-sheets.md). |
| **Agiblocks position (optional)** | Where a filled future is allocated in Agiblocks. |

Each active rule also has **Attach broker fills automatically**, off by default:

* **Off**: fills wait on the hedge for you to record.
* **On**: a fill that answers this rule's order and passes every check is attached without review, and the sheet row and booking follow. If more than one hedge could take it, it waits for you. Turn it on only if nobody else orders that contract in the broker group.

## Review a hedge plan

Open the hedge in the **Inbox**. The card shows the trader's message, what the hedge is built from, and the broker order.

The broker message **is** the order. Edit its text in the box if needed; the line under it explains how the lots were worked out.

Under **Also on approve**, choose what happens alongside the order:

* **Row appended to** the hedge sheet tab, with lots and price blank until the fill.
* **Thumbs-up on the trader's message**, so the trader sees it was handled.

Then decide:

| Button | What it does |
| - | - |
| **Send order to** the broker | Asks you to confirm: "Send a real order to …?" The message goes to the broker's WhatsApp group and can't be recalled once sent. |
| **Accumulate** | Parks the hedge so it can be combined with a later one on the same futures contract month. Parked hedges are offered, all included, when you approve the next one; drop any you don't want. **Unpark** makes a parked hedge decidable again. |
| **Already filled** (in the ▾ next to Send) | For an order placed and filled outside Mercora. Enter the fill; nothing goes to the broker, and the hedge closes with the sheet row completed. |
| **Dismiss** | Drops the hedge. Nothing is sent. |

> [!WARNING]
>
> If WhatsApp sending isn't turned on for your workspace, **Send order** approves the hedge without sending anything. The trader sends the order to the broker by hand, and the hedge waits for the fill as usual. See [WhatsApp](https://docs.mercora.io/integrations/whatsapp.md).

Some messages can't become a hedge: no hedge rule matches, no broker group is set up, or the contract is already on another hedge. The card says which, and links the covering hedge.

## Record the fill

After the order goes out, the hedge waits for the broker. When a reply arrives in the broker group:

* With **Attach broker fills automatically** on and every check passed, the fill is attached on its own.
* Otherwise the hedge shows **Fill captured · waiting on you**. Click **Attach** to record it, or **Dismiss — not this hedge's fill**.
* A fill Mercora couldn't pair, for example because it arrived late, can be recorded with **Enter this fill**.

If the broker filled the order but no reply was captured, use **Record the fill by hand**. If the broker didn't fill it, use **Close without a recorded fill**; the sheet row keeps its blank lots and price.

A hedge whose order already went to the broker can't be dismissed: it closes with a recorded fill or with **Close without a recorded fill**. A hedge still waiting long after its order went out is flagged **No fill · overdue** in **Needs you**.

Once the fill is recorded:

* The hedge sheet row is completed with lots and price.
* If the **Derivatives** module is on, the fill is added to the futures ledger. See [Derivatives](https://docs.mercora.io/records/derivatives.md).
* If your workspace pushes hedges to Agiblocks, the future is booked there and allocated to the rule's position.

## Hedges in Agiblocks

> [!NOTE]
>
> Booking fills in Agiblocks needs **External systems sync** and its **Hedging sync** switch turned on for your workspace, and the **External sync** permission under Hedging on your role.

Each booking step runs once. If one fails, the closed hedge shows **Agiblocks failed** in **Needs you**, with:

* **Retry booking** or **Retry allocation**. Mercora first checks Agiblocks for its own reference and won't book or allocate twice. It only retries when you ask.
* **Mark as handled**, once you've dealt with it in Agiblocks yourself. Add an optional note. The failed attempt stays on record.

A booking reads **Sent to Agiblocks · not yet confirmed** until Mercora finds the future there. See [External systems](https://docs.mercora.io/integrations/external-systems.md).

## Request a hedge from your own systems

Your own systems can ask for a hedge through the Mercora API:

* `GET /hedge-books` lists what your workspace can hedge: its active hedge rules.
* `POST /hedge-requests` asks for a hedge on a physical contract. It becomes a hedge in the Inbox for an operator to send. Nothing is sent to a broker from the API.
* `GET /hedge-requests/{id}` says where a request stands.

A hedge requested this way shows "Requested by" on its card, and has no trader message to thumbs-up. These calls need an API key with the hedge requests scope. See the [API reference](https://docs.mercora.io/api-reference/introduction.md) and [API keys](https://docs.mercora.io/admin/api-keys.md).

## Who can do what

| Permission | What it allows |
| - | - |
| **Hedging** (edit) | Review hedge plans, approve broker orders and record fills in the Inbox. |
| **External sync** under Hedging (edit) | Push hedge fills and allocations to Agiblocks, retry a failed booking and mark it handled. |

If the **Hedging** module is turned off, the workflow stops and active hedges are hidden from the Inbox. See [Roles and permissions](https://docs.mercora.io/concepts/roles-and-permissions.md).

## Next steps

> **[Derivatives](https://docs.mercora.io/records/derivatives.md)**
>
> See recorded fills in the futures ledger.

> **[Google Sheets](https://docs.mercora.io/integrations/google-sheets.md)**
>
> Connect the hedge sheet each rule logs to.

> **[External systems](https://docs.mercora.io/integrations/external-systems.md)**
>
> Book fills as futures in Agiblocks.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.