Scroll to navigation

Finance::Quote::TreasuryDirect(3) User Contributed Perl Documentation Finance::Quote::TreasuryDirect(3)

NAME

Finance::Quote::TreasuryDirect - Obtain bond quotes from Treasury Direct

SYNOPSIS

    use Finance::Quote;
    $q = Finance::Quote->new;
    %info = $q->fetch('treasurydirect', '912810QT8');

DESCRIPTION

This module obtains individual bond quotes by CUSIP number from treasurydirect.gov

Prices come from the XML form of the FedInvest daily price file. Only securities in that file are available, which is to say marketable Treasury bills, notes and bonds. Agency, municipal and corporate CUSIPs are not in that file and return an errormsg of 'no match'.

Prices are quoted per 100 of face value.

LABELS RETURNED

Information available from Treasury Direct may include the following labels:

method source symbol rate maturity bid ask eod price date isodate currency

"bid" is the file's SELL column, what an investor receives, and "ask" is its BUY column, what an investor pays.

Only the prices the file actually quoted are returned. Some securities, mostly bills, are quoted on one side only, and the unquoted label is then absent rather than zero. "eod" is published after the close, so it is absent from a file fetched during the trading day.

"price" is the mean of the bid and the ask where both are quoted, and otherwise whichever of the end of day price, the bid or the ask is available, in that order. For a one-sided security that makes the price depend on which day the fetch lands on - the quoted side from a day in progress, the close from a completed one - a difference of about a cent.

"rate" is the coupon as a percentage. Bills are discount instruments and carry no coupon, so theirs is 0.000%.

SEE ALSO

treasurydirect.gov

Finance::Quote

2026-10-26 perl v5.44.0