Automatically fetches UOB gold prices, spot gold prices from multiple sources, and USD/SGD exchange rates every 10 minutes using GitHub Actions.
This script fetches from 5 reliable sources with automatic averaging:
- UOB Cast 1kg Bar - https://www.uobgroup.com/wsm/gold-silver
- XAUUSD Spot (TradingView) - https://www.tradingview.com/symbols/XAUUSD/
- XAUUSD Spot (CNBC) - https://www.cnbc.com/quotes/XAU=
- USD/SGD (CNBC) - https://www.cnbc.com/quotes/sgd=x
- USD/SGD (Yahoo Finance) - https://finance.yahoo.com/quote/SGD%3DX/
Prices are averaged from multiple sources for accuracy.
-
Create GitHub repository
# Create new repo at https://github.com/new # Name: uob-gold-prices # Make it PUBLIC (so OpenClaw can access without auth)
-
Upload files
- Upload
fetch_gold_prices.pyto root - Create folder
.github/workflows/ - Upload
fetch-gold-prices.ymlto.github/workflows/
- Upload
-
Enable GitHub Actions
- Go to repository Settings > Actions > General
- Under "Workflow permissions", select "Read and write permissions"
- Click Save
-
Trigger first run
- Go to Actions tab
- Click "Fetch Gold Prices" workflow
- Click "Run workflow" button
- Wait 30 seconds
- Check for
gold_prices.jsonin repository
The data is available at:
https://raw.githubusercontent.com/YOUR_USERNAME/uob-gold-prices/main/gold_prices.json
Replace YOUR_USERNAME with your GitHub username.
{
"last_updated": "2026-02-16T12:00:00Z",
"uob_prices_sgd": {
"1kg_cast_buy": 85420.00,
"1kg_cast_sell": 84820.00
},
"gold_spot_usd_per_oz": {
"average": 2850.50,
"sources": {
"tradingview": 2851.20,
"cnbc": 2849.80
},
"source_count": 2,
"source_names": ["TradingView", "CNBC"]
},
"usd_sgd_rate": {
"average": 1.3245,
"sources": {
"cnbc": 1.3243,
"yahoo": 1.3247
},
"source_count": 2,
"source_names": ["CNBC", "Yahoo"]
},
"calculated": {
"spot_price_sgd_per_gram": 121.45,
"spot_price_sgd_per_kg": 121450.00,
"uob_1kg_premium_sgd": 420.00,
"uob_1kg_premium_percent": 0.35,
"uob_spread_sgd": 600.00,
"uob_spread_percent": 0.70
},
"status": {
"uob_success": true,
"gold_spot_success": true,
"forex_success": true,
"all_sources_success": true
}
}- uob_prices_sgd.1kg_cast_buy - UOB 1kg cast bar buy price (SGD)
- uob_prices_sgd.1kg_cast_sell - UOB 1kg cast bar sell price (SGD)
- gold_spot_usd_per_oz.average - Average spot price from TradingView & CNBC (USD/oz)
- usd_sgd_rate.average - Average USD/SGD from CNBC & Yahoo
- calculated.spot_price_sgd_per_kg - Spot price in SGD per kilogram
- calculated.uob_1kg_premium_sgd - Premium over spot for UOB 1kg bar
- calculated.uob_spread_sgd - Buy/sell spread for UOB bar
In your Telegram chat with OpenClaw:
What's the current UOB gold price?
OpenClaw will fetch from:
https://raw.githubusercontent.com/YOUR_USERNAME/uob-gold-prices/main/gold_prices.json
GitHub Actions not running?
- Check Settings > Actions is enabled
- Check workflow file is in
.github/workflows/folder - Check "Read and write permissions" is enabled
Data not updating?
- Check Actions tab for failed workflows
- Click on failed workflow to see error logs
- UOB prices may fail if website structure changes
Need to test immediately?
- Go to Actions tab
- Click "Fetch Gold Prices"
- Click "Run workflow"
- Runs every 10 minutes automatically
- Manual trigger available via GitHub Actions
- Free tier: 2,000 minutes/month (plenty for this use case)
- GitHub Actions runners are NOT blocked by UOB (unlike Hetzner VPS)
- Data is publicly accessible (no authentication needed)
- Free to run on public repositories
- Perfect for OpenClaw integration