How it works
A physical contract prices the cargo at the average price over one month, the quotation period (QP). You choose that month (M+1, M+2 or M+3) before a deadline. Goldmine tells you which month to pick and which futures to trade so the profit is locked in.
- Step 1ContractQP options, deadline, payment terms
- Step 2Market dataLive curve via Nimble, rates, history
- Step 3EngineValues each option, sizes the hedge
- Step 4Learned policyDeclare now or wait, hedge ratio
- Step 5You approveDeclaration + futures orders
- Step 6Checker mockDemo execution and settlement
1. Valuing each month
The expected average price of month comes straight from today's futures curve:
The deal value per unit, with every payment moved to one common date:
= contract differential, = payment date, = your funding rate. Why: a later month usually costs more on the curve but is paid later, which saves funding. Only putting both on the same date shows which effect wins.
2. The hedge
For each futures contract , hold
= +1 for your sale, −1 for your purchase · = quantity · = share of pricing days still to fix that trade in contract · = hedge ratio, estimated from 10-day price changes.
Each pricing day fixes of the price, so you close of the hedge that day at settlement.
Why: futures gains offset physical losses day by day, so is locked at today's curve.
3. The baseline rule
Why: it is what a careful desk would do with a spreadsheet. Deterministic and auditable. The learned policy must beat it to earn its place.
4. Declaring
M is the delivery month of the cargo, not today. For a cargo arriving in December, M+1, M+2 and M+3 are the January, February and March average prices. To declare is to tell the seller in writing which month you choose. It is final, and it must happen before the deadline (here, a few business days before the first possible month). If you never declare, the contract's default month applies.
Until you declare you hold an option: you can hedge your current favourite and switch if another month pulls ahead. Waiting is worth it only if the months can still swap places before the deadline:
= lead of the best month over the next · = estimated standard deviation of the month gap through the deadline · = hedge switching cost per unit · = forward-curve slope. The model declares when the remaining value of waiting is no greater than threshold , or when the deadline is reached.
5. The learned model, exactly
It is not a neural network. It is a compact rule with seven learned parameters, tuned with policy search in a simulator. Every day until the cargo is priced, the policy sees today's values of each month and acts:
- State: value of each month, the gap and its volatility, days to the deadline, recent curve movement, index-vs-futures basis and hedge switching cost.
- Actions: which month to hedge for now, whether to declare today, how much of the full hedge to hold.
- Reward: the daily change in the deal's value (section 9).
| Number | What it controls | Gold | Crude |
|---|---|---|---|
| Waiting-value multiplier | Log10 multiple of hedge-switching cost used in the declare threshold | -1.89 | -1.84 |
| Switching buffer | $/unit a new month must beat the current one by | 0.11 | 0.06 |
| Hedge ratio before declaring | Share of the full hedge held while waiting | 0.98 | 0.72 |
| Hedge ratio after declaring | Share of the full hedge held once declared | 1.01 | 1.06 |
| Curve-momentum tilt | Weight on recent change in curve slope | -0.48 | -0.77 |
| Basis hedge adjustment | Hedge-ratio change per standard deviation of index-vs-futures basis | -0.00 | -0.00 |
| Curve-slope sensitivity | How the declare threshold changes with the forward-curve slope | -0.28 | -0.54 |
Training (cross-entropy method):
- Draw 160 simulated markets, each paired with a random but realistic contract: size, which months you may declare, which month the sale uses, deadline, payment terms, provisional payment, seller premium, your funding cost.
- Try 24 settings of the seven parameters on all 160 cargoes.
- Keep the best 6 by the score in section 9 and sample new settings around them. Repeat 8 times.
Which policy the desk uses. The learned policy is deployed for a market only if it beat the rule in the training-period backtest. Today that is crude; gold uses the rule (rule). On real cargoes with randomized contracts, the learned policy vs the rule was 0.36 $/bbl for crude [0.22, 0.52] and 0.1 bps for gold [-1.1, 1.3].
6. Training contracts
Each simulated cargo gets its own contract, drawn at random from ranges that match common physical deals, so the policy learns rules that hold across contracts instead of fitting one.
| Term | Gold (doré / concentrate) | Crude (WTI cargo) |
|---|---|---|
| Quantity | 5,000–50,000 oz | 300,000–1,000,000 bbl |
| Months you may declare | one of M+1…M+3, M…M+2, M+1…M+2, M+1…M+4 | one of M−1…M+1, M…M+1, M−1…M+2, M…M+2 |
| Sale priced on | one of the declarable months, at random (back-to-back resale) | |
| Sale differential | +$0.50 to +$3.00/oz | +$0.10 to +$0.60/bbl |
| Seller premium for later months | 30% of deals: $0–0.30/oz per month later | 30% of deals: $0–0.05/bbl per month later |
| Declaration deadline | 3–10 business days before the first declarable month | |
| Final payment | 3–10 business days after the pricing month | 3–10 business days after the pricing month or after delivery (50/50) |
| Provisional payment at arrival | 0% (half of deals), 50% or 90% | none |
| Your funding cost | T-bill + 0.5% to 3.0% | |
The track record uses the standard contracts (gold: 20,000 oz, M+1/M+2/M+3, sale on M+1 + $1.50; crude: 600,000 bbl, M−1/M/M+1, sale on M+1 + $0.25). A second test replays real history with a random contract per cargo.
7. Costs, slippage and financing
- Execution: every futures trade is done at that day's settlement price (trade-at-settlement orders, which NYMEX and COMEX offer), so there is no timing slippage against the price used for valuation.
- Fees and bid/ask: a flat cost per trade of $0.12/oz for gold ($12 per 100 oz contract) and $0.015/bbl for crude ($15 per 1,000 bbl contract), covering commission, exchange fees and half the bid/ask. Every unit traded pays it: opening, each daily unwind, and every roll. You can change it in Deal & settings.
- Rounding: hedges are whole contracts (100 oz or 1,000 bbl), so small residual exposure remains.
- Financing: every cash flow is moved to one common date with simple interest at your funding rate, , where = 3-month T-bill (FRED, on the day of signing) + your funding spread (default 1.5%). This covers physical payments, provisional payments and daily futures margin flows.
- Futures vs physical gap: the hedge trades COMEX or NYMEX futures while the contract prices on the physical index. The leftover risk is measured on real history for each month gap and used in the risk number and the bad case.
- Not yet modelled: initial margin funding, market impact on very large orders, and broker credit limits.
8. Risk appetite
The slider sets . For each month and each hedge size (0%, 25%, 50%, 75%, 100%) the desk computes
and picks the highest. means: give up $0.50 of expected profit to make the average of the worst 5 in 100 outcomes $1 better.
combines two measured risks: unhedged price risk (from gold or oil volatility and the gap between the purchase and sale months) and the hedge's leftover risk, measured on real history as the spread between futures and the physical price for each month gap. That is why a later month can lose at higher risk aversion: its extra value comes with real basis risk.
9. Reward and score
Each day the reward is the change in the deal's marked-to-market value. Over a cargo it adds up to the realized profit:
Policies are scored across cargoes, with in basis points of the cargo's value:
CVaR5% = the average loss in the worst 5% of cargoes. Results are reported as on the same cargo.
- Realized money, not forecasts: the score can only be earned, never predicted.
- Basis points: a cargo at $270/oz (2001) and at $4,200/oz (2026) count the same.
- CVaR penalty: punishes the bad tail, which is what a risk manager signs off on.
- Minus the rule: removes the market's common noise, leaving only the value the policy adds.
- Not log returns: a hedged deal invests no capital, so there is nothing to compound.
- Not Sharpe: a ratio over many cargoes, not a per-trade reward, and it rewards shrinking the business.
10. How it is tested
- Walk-forward: trained on 2001–2009 (gold) and tested only on later cargoes.
- No future data: a decision on day sees prices up to , and trades at day 's settlement. A test scrambles all later prices and checks no earlier action changes.
- Real prices: profit comes from published settlements (COMEX gold, NYMEX crude), not from the simulator.
- Honest error bars: 95% confidence intervals by block bootstrap, since neighbouring cargoes overlap in time.
11. Data and limits
- Gold spot: EODHD (stands in for the LBMA price). COMEX gold: real front contract since 2000, other months from carry. Crude: EIA, 1986–2024.
- Live curves (CME) and interest rates (FRED) fetched with Nimble, archived daily to build a full curve history.
- Not yet modelled: the price a seller charges for the QP choice, quantity tolerance options, many cargoes at once.