Skip to main content

United States Federal Treasury API

Table of Contents

Overview

Version: 0.1.0

The U.S. Department of the Treasury is building a suite of open-source tools to deliver standardized information about federal finances to the public. We are working to centralize publicly available financial data, and this website will include datasets from the Fiscal Service on topics including debt, revenue, spending, interest rates, and savings bonds.

Our API is based on Representational State Transfer, otherwise known as a RESTful API. Our API accepts GET requests, returns JSON responses, and uses standard HTTP response codes. Each endpoint on this site is accessible through unique URLs that respond with data values and metadata from a single database table.

Setup

Setup - Requirements Install:

For this particular project, you only need to install the dependencies, to use the project. The dependencies are listed in the requirements.txt file and can be installed by running the following command:

pip install -r requirements.txt

After running that command, the dependencies should be installed.

Setup - Local Install:

If you are planning to make modifications to this project or you would like to access it before it has been indexed on PyPi. I would recommend you either install this project in editable mode or do a local install. For those of you, who want to make modifications to this project. I would recommend you install the library in editable mode.

If you want to install the library in editable mode, make sure to run the setup.py file, so you can install any dependencies you may need. To run the setup.py file, run the following command in your terminal.

pip install -e .

If you don't plan to make any modifications to the project but still want to use it across your different projects, then do a local install.

pip install .

This will install all the dependencies listed in the setup.py file. Once done you can use the library wherever you want.

Setup - PyPi Install:

To install the library, run the following command from the terminal.

pip install us-federal-treasury-python-api

Setup - PyPi Upgrade:

To upgrade the library, run the following command from the terminal.

pip install --upgrade us-federal-treasury-python-api

Usage

Here is a simple example of using the treasury library.

from pprint import pprint
from treasury.client import FederalTreasuryClient

# Initialize the client.
treasury_client = FederalTreasuryClient()

# Initialize the `DailyTreasuryStatements` service.
daily_treasury_service = treasury_client.daily_treasury_statements()

# Grab Public Debt Transactions.
pprint(
    daily_treasury_service.public_debt_transactions()
)

# Grab Adjusted Public Debt Transactions.
pprint(
    daily_treasury_service.adjusted_public_debt_transactions()
)

Support These Projects

Patreon: Help support this project and future projects by donating to my Patreon Page. I'm always looking to add more content for individuals like yourself, unfortuantely some of the APIs I would require me to pay monthly fees.

YouTube: If you'd like to watch more of my content, feel free to visit my YouTube channel Sigma Coding.

Metadata

Release files for us-federal-treasury-python-api 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for us-federal-treasury-python-api 0.1.0
File Size Uploaded Provenance
us-federal-treasury-python-api-0.1.0.tar.gz 23.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for us-federal-treasury-python-api 0.1.0
File Interpreter ABI Platform
us_federal_treasury_python_api-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 54.5 kB

Release files / us-federal-treasury-python-api-0.1.0.tar.gz

Download URL us-federal-treasury-python-api-0.1.0.tar.gz
Size 23.2 kB
Tags Source
SHA-256 checksum
How to use checksums
12e7231d85e036ac26cf87c0911312c277ab7122a3d8c31a02c65c5f779ac4ef
BLAKE2b-256 checksum
How to use checksums
982d1bffc98011fd553d2b85bd902ff683b25b9bcdf23ff34cdb0be14cf882af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.11

Release files / us_federal_treasury_python_api-0.1.0-py3-none-any.whl

Download URL us_federal_treasury_python_api-0.1.0-py3-none-any.whl
Size 31.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1bcbc0745aecac819748eb5a47ee098d8f6f4c4f89e99e35e11fda92a8bb3d54
BLAKE2b-256 checksum
How to use checksums
a9de659c10724dcd18dcbdfb37bd2d1a1ab4b0e788b37182b2807448b65c10c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.11

Security for us-federal-treasury-python-api 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page