Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Singapore Markets Dashboard

A full-stack real-time trading dashboard for Singapore financial markets, built with FastAPI (backend) and Streamlit (frontend). Designed for traders looking at SGD rates, FX, and equities.


How to Use This Dashboard for Trading Decisions

Rates Trading

SORA as the anchor SORA (Singapore Overnight Rate Average) is the risk-free benchmark replacing SIBOR. Watch it the same way a US rates trader watches SOFR.

Signal What to watch Trade implication
SORA O/N spikes ON rate jumps intraday Short-term SGD liquidity squeeze — borrow costs up, short SGD FX
SORA term structure steepening 3M/6M rising faster than O/N Market pricing in MAS tightening — sell SGS duration
SORA term structure flattening/inverting 6M < 3M Easing expectations — buy longer SGS, long SGD vs peers
SORA vs USDSGD divergence SORA falling, USDSGD rising USD strength overriding domestic rate support — watch MAS NEER band

SGS yield curve

  • A bear steepener (short end stable, long end rising) = inflation fears, sell 10Y+ SGS
  • A bull flattener (long end falling) = global risk-off, buy 10Y SGS
  • The 2s10s spread is your recession indicator for SGD rates positioning

MAS policy calendar MAS adjusts policy via the SGD NEER slope (not interest rates directly) at semi-annual meetings (April and October). The calendar countdown tells you:

  • Within 30 days of meeting → vol tends to expand in USDSGD and SGS
  • Post-meeting → check if MAS surprised (slope change, re-centring) → fade the initial move or follow through

FX Trading (USDSGD)

Signal What to watch Trade implication
DXY trend Macro page USDSGD highly correlated to DXY (0.85+). DXY breakout = USDSGD follows
USDSGD vs SORA spread FX + Rates pages If USD rates >> SGD rates, carry favours USD. Narrowing spread = potential USDSGD reversal
SGD crosses divergence FX crosses table EURUSD, GBPUSD rallying but USDSGD not falling = SGD underperforming — mean reversion trade
MAS NEER intervention signal Macro page text MAS manages a basket. If USDSGD moves >2% in a week, MAS may be active

USDSGD candlestick technicals

  • Use the 1M/3M chart to identify range. USDSGD tends to mean-revert within the MAS band.
  • Key levels to watch: round numbers (1.28, 1.30, 1.32) and recent swing highs/lows.
  • Volume spikes on reversals = stronger signal.

Cross-pair opportunities

  • SGDMYR: Risk proxy for SE Asia. SGDMYR falling = regional risk-off → also watch STI
  • JPYSGD: Yen strength alongside SORA stability = BoJ policy divergence trade
  • CNYSGD: China risk premium. CNH weakness = SGD tends to weaken sympathetically (trade channel)

Equities Trading (STI / SG Stocks)

Signal What to watch Trade implication
VIX > 25 Macro page Risk-off. Expect STI to underperform. Reduce exposure or hedge with USDSGD long
STI vs UST 10Y Compare Equities + Macro Rising UST yields compress P/E. SG banks (DBS, OCBC, UOB) benefit from rate rises but REITs suffer
SG Banks top movers Equities constituents DBS/OCBC/UOB make up ~45% of STI. Banks leading = STI likely to grind higher
High volume + price reversal STI candlestick Institutional accumulation/distribution. Volume confirms the move direction

Sector rotation within STI

  • Banks (DBS, OCBC, UOB): Benefit from higher SORA/SGS yields. Buy on SORA uptrend.
  • REITs (CapitaLand, Keppel): Hurt by rising rates. Sell when SGS 10Y rising.
  • Transport/Telcos (SIA, SingTel, ComfortDelGro): Defensive. Outperform in risk-off.
  • Commodities (Wilmar): China demand proxy. Watch CNH and China PMI.
  • Gaming (Genting SG): Tourism and leisure. Correlated to ASEAN travel recovery.

Multi-asset Framework (Putting It Together)

Bullish SGD / Bearish USDSGD setup:

  1. SORA stable or rising relative to SOFR
  2. MAS meeting approaching with no dovish signals
  3. DXY in a downtrend
  4. STI outperforming regional peers
  5. VIX < 18

Risk-off / Defensive setup:

  1. VIX > 25 and rising
  2. UST 2s10s inverting deeper
  3. USDSGD breaking above recent range
  4. STI banks underperforming
  5. SGD crosses (SGDMYR, CNYSGD) weakening together

Rates-vs-FX arbitrage signal:

  • If SORA rising but USDSGD also rising → external USD factors dominating domestic rates → watch for MAS reaction at next meeting
  • If SORA falling but USDSGD falling too → SGD supported by non-rate factors (NEER tightening, current account surplus) → potential long SGD carry

Dashboard Pages

Page Key data
Home Top-level KPIs: USD/SGD, STI ETF, 3M SORA, SGS 10Y
FX USD/SGD spot + crosses, OHLC candlestick chart
Rates SORA O/N–6M, SGS yield curve 3M–30Y, MAS calendar
Equities STI ETF chart, 10 SG blue-chips with live prices and movers
Macro & Risk VIX, DXY, UST yields, 2s10s spread, SG CPI, MAS NEER explainer

Project Structure

singapore-dashboard/
├── backend/
│   ├── main.py                  # FastAPI app + CORS + router mounting
│   ├── routers/
│   │   ├── fx.py                # GET /api/fx/{spot,crosses,history}
│   │   ├── rates.py             # GET /api/rates/{sora,sgs}
│   │   ├── equities.py          # GET /api/equities/{sti,constituents}
│   │   └── macro.py             # GET /api/macro/{risk,cpi,calendar}
│   └── services/
│       ├── fx_service.py        # Frankfurter API + yfinance OHLC
│       ├── rates_service.py     # data.gov.sg SORA/SGS + fallback
│       ├── equities_service.py  # yfinance for SG stocks
│       └── macro_service.py     # yfinance global risk + hardcoded SG data
├── frontend/
│   ├── app.py                   # Main landing page
│   ├── pages/
│   │   ├── 1_FX.py
│   │   ├── 2_Rates.py
│   │   ├── 3_Equities.py
│   │   └── 4_Macro.py
│   └── .streamlit/
│       └── config.toml          # Dark theme + teal accent
├── requirements.txt
├── .env.example
└── .gitignore

Data Sources

Source Used for Cost
Frankfurter API FX spot rates & history Free, no key
yfinance Equities, FX OHLC, VIX, DXY, UST yields Free
data.gov.sg SORA, SGS yields Free (API key recommended)

Note on SORA/SGS data: The data.gov.sg API has a low rate limit without an API key. Sign up free at data.gov.sg and add your key to .env as DATAGOV_API_KEY=... for reliable live data. Without a key, the dashboard falls back to the latest known values.


Setup & Installation

Prerequisites

  • Python 3.11 or 3.12
  • conda or venv

1. Create environment

# Using conda (recommended)
conda create -n sgenv python=3.12
conda activate sgenv

# Or using venv
python -m venv .venv && source .venv/bin/activate

2. Install dependencies

cd "/path/to/singapore-dashboard"
pip install -r requirements.txt

3. (Optional) Set up environment file

cp .env.example .env
# Add DATAGOV_API_KEY for live SORA/SGS data (free signup at data.gov.sg)

Running the Dashboard

You need two terminal windows.

Terminal 1 — FastAPI backend

uvicorn backend.main:app --reload --host 0.0.0.0 --port 8000

Terminal 2 — Streamlit frontend

streamlit run frontend/app.py

API Reference

Method Endpoint Description
GET /health Backend health check
GET /api/fx/spot USD/SGD spot rate + daily change
GET /api/fx/crosses SGD crosses (EUR, GBP, JPY, CNH, AUD, MYR)
GET /api/fx/history?period=1mo USDSGD OHLC history (1W/1mo/3mo/6mo)
GET /api/rates/sora SORA rates (O/N, 1M, 3M, 6M)
GET /api/rates/sgs SGS benchmark yields (3M–30Y)
GET /api/equities/sti?period=1mo STI ETF OHLCV chart data
GET /api/equities/constituents SG blue-chips price/change/volume
GET /api/macro/risk VIX, DXY, UST yields, 2s10s spread
GET /api/macro/cpi Singapore CPI data
GET /api/macro/calendar MAS policy calendar with countdown

Caching

Data Cache TTL
FX spot / crosses 30 seconds
FX OHLC history 30 seconds
Equities 60 seconds
Global risk (VIX, DXY, UST) 60 seconds
SORA / SGS yields 1 hour
CPI / Calendar Static / hardcoded

Troubleshooting

"Cannot connect to FastAPI backend"

  • Ensure the backend is running: uvicorn backend.main:app --reload --port 8000
  • Check nothing else is on port 8000

SORA shows info banner / latest known values

  • MAS/data.gov.sg API has temporary downtime or rate limit hit
  • Fallback values are used automatically; the app continues working
  • Sign up for a free data.gov.sg API key to increase rate limits

yfinance data delays

  • yfinance (Yahoo Finance) equities data lags ~15 minutes during market hours
  • FX data is near real-time for major pairs

SGX stocks show 0.0 price

  • Singapore market hours: SGT (UTC+8), Mon–Fri 9:00–17:30
  • Outside hours, yfinance returns the last closing price — this is normal

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages