Price Calculation Methodology

How We Calculate Gold Prices

Every price on this site is derived from a single input: the live MAD-per-gram price of 24K gold, fetched directly from our data provider. All other karats, buy/sell estimates, bars, ounce, and kilogram prices are computed from that base value using the fixed formulas documented below.

  1. Source: We call the metals.dev API to fetch the MAD/gram price of gold directly, alongside the MAD/USD exchange rate (used only for the displayed USD/gram column, not for the base calculation).
  2. Update cadence: A scheduled Cloudflare Worker calls our pipeline every 8 hours (3 times per day), totaling ~90 requests per month — within the provider's free tier.
  3. Storage: Each fetch is written to a Cloudflare D1 database. All public pages read only from D1 — pages never call the provider directly.
  4. Karat prices: derived from the 24K gram price multiplied by purity ratios:
    • 24K = 100% (24/24)
    • 22K = 91.67% (22/24)
    • 21K = 87.5% (21/24)
    • 18K = 75% (18/24)
    • 14K = 58.33% (14/24)
  5. Buy price (shop sells to you): raw gram price × 1.18 — i.e. an 18% uplift covering Morocco VAT (20%) plus an estimated 3% making/operations margin.
  6. Sell price (shop buys from you): raw gram price × 0.99 — i.e. a 1% deduction below spot as an indicative dealer margin on used gold, before any assay fees.
  7. Ounce price: gram price × 31.1035 (troy ounce).
  8. Tola price: gram price × 11.6638.
  9. Kilogram price: gram price × 1000.
  10. Bar prices: (24K gram price × weight) + a fixed MAD premium per weight (e.g. 58 MAD for a 1g bar, 480 MAD for a 50g bar, 4500 MAD for a 1kg bar).
  11. Daily change & trend: the difference between today and yesterday's close is computed once on the server. The trend is labeled "up" when the difference exceeds +0.5 MAD/g, "down" when it is below −0.5 MAD/g, and "stable" between those thresholds.

Note: Buy/sell prices shown are indicative estimates of the Morocco market average and do not represent a binding quote from any specific shop. Actual prices may vary by region, jewelry type, making charge, and individual shop policy.