Ratings vs Market Prices

Formal credit ratings are backward-looking by nature: agencies analyse financial statements, interview management, and update ratings periodically. The yield spread — the excess yield a bond pays above the government rate — is a market-based, real-time assessment of credit risk. Because it reflects the continuous judgements of buyers and sellers with money at stake, spread movements often lead formal rating changes by weeks or months.
The CDS (credit default swap) market provides an even purer expression of credit risk. A CDS is essentially insurance against a bond default: one party pays a regular premium, and the other pays out the face value if the issuer defaults. The CDS premium (spread) is quoted in basis points per year and moves in real time. CDS markets exist for both individual corporates and for sovereign governments.