FlareStart
HomeNewsHow ToSources
FlareStart

Where developers start their day. All the tech news & tutorials that matter, in one place.

Quick Links

  • Home
  • News
  • Tutorials
  • Sources
  • Privacy Policy

Connect

© 2026 FlareStart. All rights reserved.

Back to articles
US Treasury API: Track the National Debt in Real-Time with Python (No API Key)
NewsTools

US Treasury API: Track the National Debt in Real-Time with Python (No API Key)

via Dev.to TutorialAlex Spinov2h ago

The US national debt just crossed $36 trillion. I wanted to see exactly when it happened, so I built a tracker using the Treasury's free API. Turns out, the US government has a surprisingly good API. The API FiscalData.Treasury.gov — free, no API key, no signup. Track National Debt import requests def get_national_debt ( days = 10 ): url = " https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v2/accounting/od/debt_to_penny " params = { " sort " : " -record_date " , " page[size] " : days , " fields " : " record_date,tot_pub_debt_out_amt " } data = requests . get ( url , params = params ). json () for record in data [ " data " ]: debt = float ( record [ " tot_pub_debt_out_amt " ]) print ( f " { record [ " record_date " ] } : $ { debt / 1e12 : . 4 f } trillion " ) get_national_debt () # 2025-03-20: $36.2184 trillion # 2025-03-19: $36.2157 trillion Treasury Auction Results Want to know what interest rate the government is paying on new debt? def get_auctions ( security_type = "

Continue reading on Dev.to Tutorial

Opens in a new tab

Read Full Article
0 views

Related Articles

Amazon Spring Sale live blog 2026: Real-time updates on the best deals
News

Amazon Spring Sale live blog 2026: Real-time updates on the best deals

ZDNet • 11m ago

Honda cancels the two electric vehicles it was developing with Sony
News

Honda cancels the two electric vehicles it was developing with Sony

Ars Technica • 18m ago

News

Introducing ipxlat: a stateless IPv4/IPv6 translation device

Lobsters • 23m ago

Tuning Chaos Vehicle Configurations in Unreal Engine
News

Tuning Chaos Vehicle Configurations in Unreal Engine

Medium Programming • 1h ago

Samsung's budget phones are outpacing its flagships, and it's becoming harder to ignore
News

Samsung's budget phones are outpacing its flagships, and it's becoming harder to ignore

ZDNet • 1h ago

Discover More Articles