<h1>Using the TreasuryDirect REST API</h1>
<p>Example using Windows PowerShell.</p>
<p>Open a PowerShell console.</p>
<p>Run the following, adjusting the dates for your needs. Here I'll select all of May:</p>
<pre><code>$result = Invoke-RestMethod 'http://www.treasurydirect.gov/TA_WS/securities/search?auctionDate=2022-05-01,2022-05-31&amp;format=json'
</code></pre>
<p>Get the sum of the <code>somaAccepted</code> property:</p>
<pre><code>($result | Measure-Object -Property somaAccepted -Sum).Sum
</code></pre>
<p>What this looks like in the console:</p>
<p><a href="https://i.sstatic.net/6vSe2.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/6vSe2.png" alt="enter image description here" /></a></p>
<h1>API documentation</h1>
<p>Documentation for the API:</p>
<p><a href="https://www.treasurydirect.gov/webapis/webapisindex.htm" rel="nofollow noreferrer">https://www.treasurydirect.gov/webapis/webapisindex.htm</a></p>

CC BY-SA 4.0
2022-08-07T01:00:32.747Z
2022-08-07T01:09:35.103Z
2022-08-07T01:09:35.103Z
dharmatech
<h1>Using the Auction Query page</h1>
<p>Go to the 'Auction Query' page:</p>
<p><a href="https://www.treasurydirect.gov/instit/annceresult/annceresult_query.htm" rel="nofollow noreferrer">https://www.treasurydirect.gov/instit/annceresult/annceresult_query.htm</a></p>
<p><a href="https://i.sstatic.net/j7lJX.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/j7lJX.png" alt="enter image description here" /></a></p>
<p>Specify the 'Auction Date' range:</p>
<p><a href="https://i.sstatic.net/NWRfL.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/NWRfL.png" alt="enter image description here" /></a></p>
<p>Click <code>Show / Hide Columns</code>. Select <code>SOMA Accepted</code>:</p>
<p><a href="https://i.sstatic.net/2p0P3.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/2p0P3.png" alt="enter image description here" /></a></p>
<p>Click download as CSV.</p>
<p>Use Excel to sum the <code>SOMA Accepted</code> column:</p>
<p><a href="https://i.sstatic.net/otDii.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/otDii.png" alt="enter image description here" /></a></p>

CC BY-SA 4.0
2022-08-07T00:15:45.323Z
2022-08-07T01:02:24.197Z
2022-08-07T01:02:24.197Z
dharmatech
<p>Let's say I'd like to find out how much the Fed purchased in US treasury securities in May 2022.</p>
<p>Here's one approach that I've been referred to.</p>
<p>Go to this page on TreasuryDirect:</p>
<p><a href="https://www.treasurydirect.gov/instit/annceresult/press/press_auctionresults.htm" rel="nofollow noreferrer">https://www.treasurydirect.gov/instit/annceresult/press/press_auctionresults.htm</a></p>
<p>For each item with an 'Auction Date' in May:</p>
<p><a href="https://i.sstatic.net/Iu35n.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Iu35n.png" alt="enter image description here" /></a></p>
<p>Download the PDF and note the SOMA value:</p>
<p><a href="https://i.sstatic.net/a2XJ0.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/a2XJ0.png" alt="enter image description here" /></a></p>
<p>Then add up all these values.</p>
<p>When I did this for May 2022, I get $194b.</p>
<h1>Questions</h1>
<p>Is there a better approach to getting the total US treasury securities purchased?</p>

<federal-reserve><securities><treasuries>
How do I find out how much in US treasury securities the Fed purchased in a given month?
dharmatech
# How do I find out how much in US treasury securities the Fed purchased in a given month?

(Asked by: username_0 on 2022-08-06)

Let's say I'd like to find out how much the Fed purchased in US treasury securities in May 2022.

Here's one approach that I've been referred to.

Go to this page on TreasuryDirect:

<https://www.treasurydirect.gov/instit/annceresult/press/press_auctionresults.htm>

For each item with an 'Auction Date' in May:

[![enter image description here](https://i.sstatic.net/Iu35n.png)](https://i.sstatic.net/Iu35n.png)

Download the PDF and note the SOMA value:

[![enter image description here](https://i.sstatic.net/a2XJ0.png)](https://i.sstatic.net/a2XJ0.png)

Then add up all these values.

When I did this for May 2022, I get $194b.

# Questions

Is there a better approach to getting the total US treasury securities purchased?

**Tags:** federal-reserve, securities, treasuries

---

## 2 answers

### Answer by username_0 on 2022-08-07. Score: 2

Using the TreasuryDirect REST API
Example using Windows PowerShell.
Open a PowerShell console.
Run the following, adjusting the dates for your needs. Here I'll select all of May:
$result = Invoke-RestMethod 'http://www.treasurydirect.gov/TA_WS/securities/search?auctionDate=2022-05-01,2022-05-31&format=json'

Get the sum of the somaAccepted property:
($result | Measure-Object -Property somaAccepted -Sum).Sum

What this looks like in the console:

API documentation
Documentation for the API:
https://www.treasurydirect.gov/webapis/webapisindex.htm


---

### Answer by username_0 on 2022-08-07. Score: 1

# Using the Auction Query page

Go to the 'Auction Query' page:

<https://www.treasurydirect.gov/instit/annceresult/annceresult_query.htm>

[![enter image description here](https://i.sstatic.net/j7lJX.png)](https://i.sstatic.net/j7lJX.png)

Specify the 'Auction Date' range:

[![enter image description here](https://i.sstatic.net/NWRfL.png)](https://i.sstatic.net/NWRfL.png)

Click `Show / Hide Columns`. Select `SOMA Accepted`:

[![enter image description here](https://i.sstatic.net/2p0P3.png)](https://i.sstatic.net/2p0P3.png)

Click download as CSV.

Use Excel to sum the `SOMA Accepted` column:

[![enter image description here](https://i.sstatic.net/otDii.png)](https://i.sstatic.net/otDii.png)


---

