AETERNAE AI RESEARCH LLC INDEPENDENT RESEARCH
ÆAETERNAERESEARCH
Sign inRequest access
← Malware catalog

Attributed metadata history

REPORTPUBLIC METADATA

Converting Spot Gold (USD/oz) to Saudi Riyals per Gram by Karat in JavaScript

Gold prices are quoted globally in US dollars per troy ounce, but shoppers in Saudi Arabia think in riyals per gram, split by karat (24K, 22K, 21K, 18K). If you are building a finance widget, a price bot or just a personal dashboard, converting between the two is a small but surprisingly error-prone task. Here is a clean way to do it. The constants you need 1 troy ounce = 31.1034768 grams. Not the 28.35 g avoirdupois ounce — this is the most common bug. USD/SAR = 3.75. The Saudi riyal has been pegged to the dollar at this rate for decades, so you can usually hard-code it (but keep it configurable). Purity by karat is simply karat / 24. So 21K is 0.875 pure, 18K is 0.75 pure. The helper const GRAMS_PER_TROY_OZ = 31.1034768; const USD_TO_SAR = 3.75; function goldPricePerGramSAR(spotUsdPerOz, karat = 24, { usdToSar = USD_TO_SAR } = {}) { if (!Number.isFinite(spotUsdPerOz) || spotUsdPerOz <= 0) { throw new Error("spot price must be a positive number"); } if (karat <= 0 || karat > 24) throw new Error("karat must be between 1 and 24"); const pureGramSar = (spotUsdPerOz / GRAMS_PER_TROY_OZ) * usdToSar; return pureGramSar * (karat / 24); } function karatTable(spotUsdPerOz) { return [24, 22, 21, 18].map((k) => ({ karat: `${k}K`, sarPerGram: Number(goldPricePerGramSAR(spotUsdPerOz, k).toFixed(2)), })); } console.table(karatTable(2400)); // example input, not a live price Things that will trip you up Rounding too early. Keep full precision through the calculation and round only for display. Rounding the per-gram 24K price and then multiplying by purity drifts by a few halalas. Spot is not retail. What you compute is the raw metal value. Jewellery shops add workmanship (making) charges and taxes, so a shop's price per gram for 21K will be higher than this number. Label your output clearly as a spot-based estimate. Stale data. Spot gold moves all day during global trading hours. Cache it, but show a timestamp so users know how fresh the number is. Locale formatting. For an Arabic audience, Intl.NumberFormat("ar-SA", { style: "currency", currency: "SAR" }) gives properly formatted output, including Arabic-Indic digits if you want them. Sanity-checking your output When you build something like this, compare your results against a published reference for the same moment. I use the page tracking today's gold price in Saudi Arabia for 21K, 24K and 18K on Khabar al-Souq as a cross-check: if my 21K number is wildly off from theirs, I have almost certainly mixed up ounce types or applied purity twice. Wrapping up The whole conversion is three multiplications, but getting the constants right — troy ounces, the peg, and karat purity — is what separates a trustworthy widget from a misleading one. Keep the inputs configurable, round late, and always say where your spot price came from.

Reference details

Source category
research-report
First reported
Nov 27, 2026 05:44 UTC
Last reported
Nov 27, 2026 05:44 UTC
Catalog updated
Nov 27, 2026 05:54 UTC
Record ID
a0379ba971a9580ee910bfd9781fe4e66040b542e591f0737b2825621f176764

Published indicators

Network indicators are visibly defanged. This page does not make them clickable or send them to another service.

No validated file hashes or network indicators are stored for this record.

Source observations

intelligence_src_6dc544294b7f21f98a

Source-provided label
Publisher RSS metadata
Evidence class
mentioned in report
Confidence
Not reported
Observed
Nov 27, 2026 05:44 UTC
Retrieved
Nov 27, 2026 05:54 UTC

This record contains metadata and attribution only. It does not host, download, unpack, render, or execute malware samples.

Feed collection status

Sources represented on this page. Publication and observation dates describe the content; successful batch dates describe local collection. A recent batch does not certify complete coverage or current provider availability.

1 sources: 0 stale, 0 needing attention, 0 paused, 0 unverified.

Review source update dates and status
  • intelligence_src_6dc544294b7f21f98aRecent successful batchLast successful batch: Last attempt:

Stale means older than twice the recorded collection interval, with a minimum of one hour; without an interval, the threshold is 24 hours. Cached content remains available while a feed is stale, paused, or unverified.