Skip to main content

Silver Arbitrage

Research > Silver Arbitrage (DEVELOPER and above, route /silver-arbitrage). The structure: hold physical silver and a silver ETF (Silver BeES), keep a small cash reserve, and short MCX silver futures against part of the position. Everything is typed in kg of silver. Under research - not advice.

The page​

  1. Your position - physical kg, long ETF kg-equivalent, cash reserve kg-equivalent, short kg, minimum sleeve %.
  2. Contract recommendation - the short kg is split into whole lots of Silver (30 kg), Silver M (5 kg) and Silver Mic (1 kg). Options are ranked by: exact kg, margin covered by cash plus pledge credit, fewest orders per roll, lowest roll cost.
  3. Seed trades - a table of what to do on day one: physical (hold), ETF buy (whole units), cash reserve, futures sell per contract type, with the cost of each trade and the seed money (ETF plus cash).
  4. Sleeve check - sleeve (ETF + cash) against a minimum % of the sold contract value, margin against cash plus pledge credit, and a silver stress move.
  5. Backtest this structure (same page, below the planner) - runs the position through backend/silverhedge on every trading day of a period you choose (From / To dates or Last 1 / 3 / 5 / 10 / 15 years; empty = the whole history, 2006-01-02 to the latest data; earliest start 2005-09-01, at least 30 days; the same period is used for the Excel and for plan comparison) and shows the pass rule, metrics, the equity curve and drawdown against buy-and-hold, month wise P&L (bar chart and a Monthly Breakup table, strategy and buy-and-hold), and an Excel download with the daily cash.
  6. Settings (per user, saved in teudb table usr_silverarb_setting): brokerage per order for each contract type and the ETF, flat per order or per lot, statutory charges full or none, slippage, pledge haircut, roll days, default minimum sleeve, stress %.

Prices are the latest end-of-day data (no live feed) and any price can be overwritten on the page. On the VPS the three contract types are read from scr_mcx_master; on a local machine only Silver 30 kg (SILVER-I) is read and the rest are typed.

Options are not part of this strategy​

An out-of-the-money strangle sold alongside the short futures was tried inside this backtest and then taken out on purpose: it is to be a separate strategy. The pricing model, the mock option store and the real-price reader stay as the reusable package backend/silveropt (see Silver Options); the engine integration (premium cash flows, option liability, scan margin, the page section) is in git history, commit 09bc291.

My saved plans, comparison and export​

  • Save: the position in the form can be saved under a name in the user's own space (teudb table usr_silverarb_plan, at most 50 per user, names unique per user). Load puts it back into the form; Delete removes it.
  • Compare: tick up to 6 saved plans and press Compare. Every plan runs through the full backtest on the same data and dates, and all curves are put on one scale (each starts with the same amount, default Rs 1,00,000) so plans of different size can be compared. One chart (value, linear or log) and one drawdown chart show every plan plus silver buy and hold, and a table gives final value, CAGR, max drawdown, hedged-sleeve CAGR, carry captured (kg and % of starting capital a year), margin calls, physical sold and the pass rule.
  • Export / import: Export downloads one plan as a JSON file (position, prices used, contract recommendation, seed trades, sleeve check). Import reads such a file back and saves it as a new plan (a name clash gets a "(2)").

Income view of the backtest​

  • Cost of carry captured (silverhedge/income.py): at every roll the short is closed at the old contract and re-opened at the next one; the price difference x the short kg is the calendar spread captured (positive = contango harvested). Shown as a total in rupees and in silver-equivalent kg (rupees of each roll divided by that day's spot), per year and per roll, next to the futures P&L of the short as a whole (which also moves with the silver price).
  • ETF seed trades: every ETF purchase (day-one seed, each top-up from surplus cash) is a lot and every ETF sale (margin call or trigger) is matched to lots, giving closed round trips with buy / sell price, kg, days and profit. Two matching methods are shown: oldest first (usual accounting) and lowest-cost first. Booked + still-held profit is identical under both; only the labelling of which units were sold changes, so it cannot turn losing lots into profits. Full lists are in the Excel download.

Excel report​

Excel (daily cash) writes Inputs (every parameter of the run: position as entered, period, first-day prices and data, the Settings values, engine parameters, trend rules), Charts, Daily and the supporting sheets (Events, Summary, Carry, ETF trades, Seed Trades). The Daily sheet has 22 columns: date (dd-mmm-yyyy), silver spot, futures price, ETF price, physical kg, ETF units, short kg, margin for 1 kg, required margin, cash held, cash in hand after margin, margin available (cash + ETF pledge), margin surplus / (shortfall), daily and cumulative futures MTM, portfolio equity, drawdown, ETF units bought (+) / sold (-), ETF amount sold (+) / bought (-) the cumulative ETF P&L (ETF value + net ETF cash flows, before costs) and the trade cost of the day (brokerage + charges of every trade done that day, "-" when none) and a Description of what happened (seed trades, rollover, hedge change, ETF bought / sold, physical sold, margin call). Strategy tester runs (hedge % from a strategy) add a 23rd column, the hedge %.

Move ETF gains to physical silver​

Optional rule (tick box under "Your position", step in kg, default 5; off unless ticked; config etf_to_physical_step_kg). The ETF starts at a size (say 35 kg). Short gains above the cash reserve are reinvested in ETF in 1 kg steps, so the ETF can grow. When it is step kg or more above its starting size (35 to 40 kg), that much ETF is sold (selling charges apply) and physical silver is bought with the proceeds: whole kg, at the spot price, no buying charges or premium. The sale is skipped on a day when the lower pledge credit would leave the margin short. Each conversion shows in the Daily sheet (ETF sold, physical bought) and the result shows the kg of physical silver bought. Silver bought out of the sleeve is treated as money taken out, not a loss, in the hedged-sleeve return. Trade-off seen on the 2006-2026 history (50 / 35 / 15 kg, 40 kg short): the return is about the same (12.7% against 12.9% a year) with the same drawdown, but the ETF + cash sleeve stays thin behind the short, so the hedged-sleeve return check turns negative (-37.7% against +4.1%) and the pass rule fails.

Backtest period​

The Backtest section has a From and To date. Nothing selected means the whole history. The return basis follows the fund convention: a period under one year shows the absolute return (labels read "Strategy return", "Hedged sleeve return"), one year or longer the annualised return (CAGR). The result states the exact period and number of trading days. Every period starts from the same position at that day's prices, so a short window is one sample of that market, not an average.

Find best parameters for the period​

The Find best parameters for this period button (right side of the Backtest period box) searches the cash reserve, ETF and short size for the chosen From / To dates. The structure is searched as percentages of the whole position (physical + ETF + cash = 100) and scaled to the user's total kg, so it fits any position size. A coarse grid (reserve 4-15%, ETF 20-50%, short 20-60%) is run first, then a finer grid around the best three: about 140 backtests, 10 seconds to a minute. It runs as a background job (silverarb/jobs.py: one running job per user, 30 minutes retention, cancel button); the page polls GET /optimize/{job_id}.

The rule is the fixed pass rule (hedged sleeve return not negative, drawdown shallower than buy and hold, no unresolved margin shortfall); passing settings are ranked by return per unit of drawdown (Calmar). If none passes, the closest (best hedged sleeve return) are shown with a warning. The result lists the best, the top 10, the best for each short size, the user's current position on the same period and an Apply button that fills the position form. Minimum period 180 days. It is an in-sample fit: the best structure of one period is not a forecast for the next. Code: silverhedge/period_search.py (search, scale), silverarb/service.optimize_period, silverarb/jobs.py, page silverArbOptimize.jsx.

Full hedge mode​

The Full hedge tick box in "Your position" replaces the cash reserve and short kg with one input: the short as a % of physical + ETF (default 100%). The short is floor(% x (physical + ETF)) kg and there is no cash reserve. The seed trades are as before (ETF bought, short sold; the cash row is 0). Engine rule (silverhedge/engine.py, enforce_fh): when cash falls below zero or the margin is not met, the least ETF is sold that clears the shortage after the short has been cut to keep the same % of what is still held; if the ETF is exhausted, physical silver is sold in whole kg the same way. The short is only ever cut (bought back at the held contract's price, with costs), never raised again; short gains stay as cash and are not reinvested, and the equity trigger is switched off. The period optimiser is hidden in this mode (it searches cash / ETF / short structures).

Strategy tester (second tab)​

The second tab is the Strategy tester. It replaced the Trend trade tab: pick an arbitrage strategy from the list, enter the trading capital in whole kg of silver (it is split 60% physical / 30% ETF / 10% cash, whole kg, from the strategy's JSON allocation) and the period, press Run backtest. A Signal and set-up panel above the report holds the as-of date (default the last traded day) and the capital and shows, as of that close, the swing high and swing low in force (Fib strategy), how many kg the strategy asks to be short, the Silver BeES units to hold and the minimum cash for the margin of the largest short (POST /strategy/signal with as_of). The backtest then runs up to the as-of date. Every strategy shows the same KPIs (CAGR or return, max drawdown, Calmar, short win rate, net short P&L, hedge changes, margin calls, costs, each against buy and hold), the equity and drawdown charts, the monthly profit and Monthly Breakup tables, the hedge % over time, the hedge changes, the short round trips an Excel file of the daily cash and a Save report (HTML) button: one stand-alone file with the strategy details, the parameters (table and JSON), the inputs, the KPIs, the charts and the tables (POST /strategy/backtest/html, silverarb/report_html.py).

The strategies carry two capital rules in their JSON (liquidity): a margin shortage sells physical silver first (whole kg, least needed; ETF only if none is left), and the ETF is capped at its starting size - 1 kg or more above it is converted to physical silver (engine parameters liquidate_first = physical and etf_to_physical_step_kg = 1, also under a hedge path). See the Fib strategy page, section 2.3.

The list and the parameters come from the strategy master: st_master rows with scorecard = arbitrage and no parent, whose param_values JSON carries engine (fib or ma), family (the tag), instruments (SilverM; GoldM is shown greyed out until a strategy lists it and the engine runs it) and the rule parameters. The page has a Table / JSON view of them. Changing a strategy's parameters is a new revision (strategies.catalogue.new_revision). Code: backend/silverarb/strategy_defs.py (python -m silverarb.strategy_defs seed registers the strategies below and brings an older row to the current JSON as a new revision), API GET /api/silver-arbitrage/strategies, POST /strategy/backtest, POST /strategy/backtest/excel, page SilverStrategyTester.jsx.

Strategy codeNameEngine
fib_swing_hedgeFib Arbitrage - Swing hedge ladderfib: Fib swing hedge
ma_arbitrage_ladderMA Arbitrage - Baseline ladderma, variant ladder (below)
ma_arbitrage_rule2MA Arbitrage - Rule 2ma, variant rule2 (below)

To add a strategy: register a row (catalogue.register(...) with an engine in its JSON) and, if it needs a new rule set, add the engine to strategy_defs.trend_body.

The MA rules (formerly the Trend trade tab)​

The MA strategies keep the same holdings (physical silver + Silver BeES ETF + an optional cash reserve) but lets the hedge % follow the trend of MCX spot silver. Signals use the spot cash close of day t; the futures are traded at day t+1's settle (no look-ahead). Numbers are in backend/silverhedge/config/trend.yaml, rules in silverhedge/trend.py, the engine takes the daily target as run_backtest(..., hedge_path=...).

  • Baseline ladder (Plan B Strategy A): close below the 50-DMA hedge 25%; below the 100-DMA and 50-DMA < 100-DMA 50%; below the 200-DMA and 50-DMA < 100-DMA 75%. Steps up at once; steps down one level (25 points) after 3 consecutive closes above the 50-DMA (the counter restarts after each step; the level never goes below what the raw rule asks for).
  • Plan A Rule 2: close below the 20-DMA for 3 days: short 50%; then a close below the 50-DMA: short the other 50% (100% hedge; the second leg only follows an active first leg); close above the 20-DMA for 2 days: cover everything.
  • Volatility overlay (optional, UNTESTED design): 20-day realised vol ranked against its last 252 sessions caps the hedge: top 20% cap 100%, middle 60% cap 75%, bottom 20% cap 50%. It never raises a hedge. No history yet (before about Feb 2006) = the middle cap.
  • Short and cash: short = hedge % x (physical + ETF) in whole kg, never typed. A cash shortage (cash below zero or margin not met) sells ETF first, then physical silver in whole kg, and cuts the short to keep the current %; only a signal raises the short again. No equity trigger, no surplus reinvestment.
  • Report: as for every strategy, plus the hedge % step chart, every hedge change with its cost and a walk-forward table (2006-2015 and 2016-now against buy and hold). The parameter-sensitivity check of the old tab is no longer on the page (its endpoints remain).
  • Seeing the spot in AmiBroker: the signals use MCX spot closes; python -m mcxeod.mcx_spot_ami history writes them (all 30 spot symbols, e.g. SILVER-SPOT, from 2005) to one AmiBroker file, and the daily MCX AMI files now carry the -SPOT rows too (mcxeod/mcx_spot_ami.py).
  • AmiBroker: backend/silverhedge/amibroker/SilverTrend.afl is the same rule set as an AFL (chart with the four MAs, scale-in / scale-out signals, backtest with 1 share per scale, Exploration, Optimize). Not run by the Python tests: check its hedge levels against the Hedge % chart of this tab.
  • API: the old POST /api/silver-arbitrage/trend/backtest and /trend/sensitivity endpoints remain (DEVELOPER); the page uses the strategy endpoints above. Tests tests/test_silverhedge_trend.py, tests/test_strategy_defs.py.
  • First look (45 physical + 40 ETF + 15 cash, 2006 to 2026-09, estimated margin): the ladder and Rule 2 give about the buy-and-hold return with a similar worst drawdown (silver crashes faster than the averages react), and change the hedge 15-25 times a year. Treat it as research, not a result to trade on.

Default structure (searched with the 75% pledge credit)​

strategy.yaml defaults to 45 kg physical, 40 kg ETF, 15 kg cash reserve and a 40% short (40 kg of futures). It is the best passing setting of a 336-setting search (short 25-60%, ETF 20-50 kg, cash 4-15 kg; the pass rule and the objective, return per unit of drawdown, were fixed before the search): 13.36% a year, max drawdown -25.6% (buy and hold 14.51%, -55.2%), hedged sleeve +10.2%, 4 kg of physical silver sold, no unresolved margin shortfalls. Ten neighbouring settings (cash 10-15 kg, ETF 35-50 kg) tie with it, and both halves of the history agree (0.51 and 0.62 return per unit of drawdown). Best passing setting per short size: 25% -> 13.63% / -30.2%, 30% -> 13.66% / -28.5%, 35% -> 13.49% / -26.3%, 40% -> 13.36% / -25.6%, 45% -> 13.22% / -25.7%, 50% -> 13.01% / -25.7%, 55% barely passes, 60% fails. More short buys a shallower drawdown only up to about 40%; after that it only costs return. The price of a bigger short is the sleeve behind it: 15% of the capital sits in idle cash that pays the daily futures losses.

Pledge haircut (margin credit of the ETF)​

The ETF is pledged with the broker; its margin credit is (1 - haircut) x ETF value. The broker's collateral table (2026-10-25) shows Silver BeES at a haircut of 19.18% (collateral 80.82%). The default is a 25% haircut (75% credit), a worst case below today's value, set in Settings (pledge_haircut, 0.25) and in strategy.yaml; the sensitivity table runs 0.1918, 0.25 and 0.5. Earlier versions read the original "75% haircut" as a 25% credit, which was far too harsh. The backtest result barely changes (the earlier 6 / 30 / 30 plan: CAGR 13.63% to 13.64%, drawdown -27.7% to -28.6%, hedged sleeve 2.4% to 3.2%) because cash may never go negative, and the daily futures losses have to be paid in cash, which the pledge credit does not help; the credit only covers the margin requirement.

Rules the engine follows (set by the user on 2026-10-24)​

  • Trading cash never ends a day negative: ETF is sold first, then physical silver in whole kg.
  • Cash above the fixed reserve is put into ETF in whole 1 kg steps while cash stays at or above the reserve and margin is met.
  • Short and reserve are chosen by grid search (silverhedge/optimize.py). Objective fixed before running: maximise full-portfolio CAGR divided by max drawdown among settings that pass the pass rule. In-sample on one history, so the optimum is approximate.
  • Pass rule (fixed before any run): hedged-sleeve CAGR at least 0, full-portfolio max drawdown shallower than buy-and-hold, and zero unresolved margin shortfalls. Sleeve CAGR is time-weighted, so proceeds of physical sales are not counted as returns.

Data and assumptions to remember​

  • Margin in the backtest is a volatility estimate (margin/mcx_estimate.py formulas on the spot series), not exchange data.
  • Silver BeES market close stands in for NAV; k (units per kg of spot) is taken at the latest overlap date.
  • Silver 30 kg contract settles per kg stand in for Silver M and Silver Mic, 5 kg lots throughout.
  • Statutory rates in silverhedge/config/costs.yaml are hand-entered reference values: verify before relying on absolute costs.
  • Instrument ids are resolved by name on the VPS and from silverhedge/config/data.yaml locally (silverhedge/masids.py).

Code map​

PieceFile
Engine, costs, metrics, optimiser, Excelbackend/silverhedge/ (engine.py, costs.py, metrics.py, optimize.py, excel_export.py)
Planner, prices, settings, backtest gluebackend/silverarb/ (planner.py, prices.py, settings.py, service.py)
APIbackend/app/api/silver_arbitrage.py (/api/silver-arbitrage/defaults, settings, plan, backtest, backtest/excel)
Migrationsbackend/alembic_user/versions/e1f3a5b7c9d2_silverarb_settings.py, f2a4c6e8b0d3_silverarb_plans.py (run alembic -c alembic_user.ini upgrade head)
UIfrontend/src/pages/SilverArbitrage.jsx, silverArbUi.jsx; api.silverArbitrage in services/api.js
Shared report stylefrontend/src/components/charts/reportCharts.jsx (also used by the TBS results): equity + drawdown, Monthly Breakup, monthly profit bars. New trading systems reuse it
Testsbackend/tests/test_silverhedge.py, test_silverhedge_masids.py, test_silverarb_planner.py

CLI (from backend/): python -m silverhedge.run, python -m silverhedge.optimize, python -m silverhedge.excel_export.