Skip to content

USTreasuryAuction

QuantConnect.DataSource.USTreasuryAuction

USTreasuryAuction()

Bases: BaseData

The result of one U.S. Treasury marketable securities auction: how much was offered and sold, the yield or rate it cleared at, the demand it drew and who bought it. Several auctions of one benchmark can share an end time (cash management bills, and six days in 1984 to 1986 and 2008): subscribe to USTreasuryAuctions to receive all of them, since a subscription to this class delivers one per end time.

Constructor for initialising the dase data class

EXPECTED_COLUMNS

EXPECTED_COLUMNS: int = 35

Number of columns a line of the file carries.

security_term

security_term: str

The term of the security as auctioned, for example "10-Year" for a new issue or "9-Year 10-Month" for a reopening of an earlier 10-year note

issue_date

issue_date: Optional[datetime]

Date the security is issued

maturity_date

maturity_date: Optional[datetime]

Date the security matures

is_reopening

is_reopening: bool

True when the auction sold more of a security that was already outstanding

interest_rate

interest_rate: Optional[float]

Annual coupon rate of the security in percent, empty for bills and floating rate notes

spread

spread: Optional[float]

Fixed spread over the index rate of a floating rate note in percent

offering_amount

offering_amount: Optional[float]

Amount offered to the public, in dollars of face value

total_tendered

total_tendered: Optional[float]

Total amount of bids received, in dollars of face value

total_accepted

total_accepted: Optional[float]

Total amount sold, in dollars of face value

competitive_tendered

competitive_tendered: Optional[float]

Amount of competitive bids received, in dollars of face value

competitive_accepted

competitive_accepted: Optional[float]

Amount of competitive bids accepted, in dollars of face value

noncompetitive_accepted

noncompetitive_accepted: Optional[float]

Amount of noncompetitive bids accepted, in dollars of face value

bid_to_cover_ratio

bid_to_cover_ratio: Optional[float]

Ratio of the amount bid to the amount accepted, as published by the Treasury

high_yield

high_yield: Optional[float]

Highest accepted yield in percent, the rate the auction cleared at for notes, bonds and TIPS

low_yield

low_yield: Optional[float]

Lowest accepted yield in percent

median_yield

median_yield: Optional[float]

Median yield of the accepted competitive bids in percent

high_discount_rate

high_discount_rate: Optional[float]

Highest accepted discount rate of a bill in percent, the rate bills are bid in

low_discount_rate

low_discount_rate: Optional[float]

Lowest accepted discount rate in percent

median_discount_rate

median_discount_rate: Optional[float]

Median discount rate of the accepted competitive bids in percent

high_investment_rate

high_investment_rate: Optional[float]

Bond equivalent yield of the high discount rate of a bill in percent

high_discount_margin

high_discount_margin: Optional[float]

Highest accepted discount margin in percent, the rate the auction cleared at for floating rate notes

low_discount_margin

low_discount_margin: Optional[float]

Lowest accepted discount margin in percent

median_discount_margin

median_discount_margin: Optional[float]

Median discount margin of the accepted competitive bids in percent

high_price

high_price: Optional[float]

Price per 100 of face value at the highest accepted yield or rate

allocation_percentage

allocation_percentage: Optional[float]

Percent of the bids at the highest accepted yield or rate that were filled

direct_bidder_tendered

direct_bidder_tendered: Optional[float]

Amount bid by direct bidders, in dollars of face value

direct_bidder_accepted

direct_bidder_accepted: Optional[float]

Amount accepted from direct bidders, in dollars of face value

indirect_bidder_tendered

indirect_bidder_tendered: Optional[float]

Amount bid by indirect bidders, which include foreign central banks, in dollars of face value

indirect_bidder_accepted

indirect_bidder_accepted: Optional[float]

Amount accepted from indirect bidders, in dollars of face value

primary_dealer_tendered

primary_dealer_tendered: Optional[float]

Amount bid by primary dealers, in dollars of face value

primary_dealer_accepted

primary_dealer_accepted: Optional[float]

Amount accepted from primary dealers, in dollars of face value

soma_accepted

soma_accepted: Optional[float]

Amount accepted from the Federal Reserve's System Open Market Account, in dollars of face value

fima_noncompetitive_accepted

fima_noncompetitive_accepted: Optional[float]

Amount of noncompetitive bids accepted from foreign and international monetary authorities, in dollars of face value

clearing_rate

clearing_rate: Optional[float]

The rate the auction cleared at, in percent: the high yield for notes, bonds and TIPS, the high investment rate for bills (the bond equivalent of the high discount rate, comparable with note yields) and the high discount margin for floating rate notes. It is also BaseData.value, which is 0 for an auction without any of them (none in the history).

end_time

end_time: datetime

Time the result is available to algorithms: 14:10 New York on the auction day, 16:10 for an auction that closed at 13:25 or later or has no published closing time, and 14:10 of the next business day for one that closed at 15:25 or later

symbol

symbol: Symbol

Symbol representation for underlying Security

data_type

data_type: MarketDataType

Market Data Type of this data - does it come in individual price packets or is it grouped into OHLC.

time

time: datetime

Current time marker of this data packet.

value

value: float

Value representation of this data packet. All data requires a representative value for this moment in time. For streams of data this is the price now, for OHLC packets this is the closing price.

price

price: float

As this is a backtesting platform we'll provide an alias of value as price.

ALL_RESOLUTIONS

ALL_RESOLUTIONS: List[Resolution] = ...

A list of all Resolution

This Field is protected.

DAILY_RESOLUTION

DAILY_RESOLUTION: List[Resolution] = ...

A list of Resolution.DAILY

This Field is protected.

MINUTE_RESOLUTION

MINUTE_RESOLUTION: List[Resolution] = ...

A list of Resolution.MINUTE

This Field is protected.

HIGH_RESOLUTION

HIGH_RESOLUTION: List[Resolution] = ...

A list of high Resolution, including minute, second, and tick.

This Field is protected.

OPTION_RESOLUTIONS

OPTION_RESOLUTIONS: List[Resolution] = ...

A list of resolutions support by Options

This Field is protected.

is_fill_forward

is_fill_forward: bool

True if this is a fill forward piece of data

clone

clone() -> BaseData

Creates a copy of the instance

data_time_zone

data_time_zone() -> Any

Data time zone, New York, where the Treasury holds the auctions

default_resolution

default_resolution() -> Resolution

Default resolution

get_source

get_source(
    config: SubscriptionDataConfig,
    date: datetime,
    is_live_mode: bool,
) -> SubscriptionDataSource

Location of the source file: one file per benchmark holding every auction of it. Read line by line; USTreasuryAuctions folds the auctions that share an end time into one point.

is_sparse_data

is_sparse_data() -> bool

Sparse data: a benchmark is auctioned weekly at most, and some only a few times a year

parse

parse(csv: List[str]) -> USTreasuryAuction

Reads one split line into an auction result that has no symbol yet

reader

reader(
    config: SubscriptionDataConfig,
    line: str,
    date: datetime,
    is_live_mode: bool,
) -> BaseData

Parses one line of the file into one auction result

requires_mapping

requires_mapping() -> bool

Not linked to a traded security, so no mapping applies

supported_resolutions

supported_resolutions() -> List[Resolution]

Supported resolutions, Daily only

to_string

to_string() -> str

String representation for debugging

deserialize_message

deserialize_message(serialized: str) -> Sequence[BaseData]

Deserialize the message from the data server

Parameters:

Name Type Description Default
serialized str

The data server's message

required

Returns:

Type Description
Sequence[BaseData]

An enumerable of base data, if unsuccessful, returns an empty enumerable.

should_cache_to_security

should_cache_to_security() -> bool

Indicates whether this contains data that should be stored in the security cache

Returns:

Type Description
bool

Whether this contains data that should be stored in the security cache.

update

update(
    last_trade: float,
    bid_price: float,
    ask_price: float,
    volume: float,
    bid_size: float,
    ask_size: float,
) -> None

Update routine to build a bar/tick from a data update.

Parameters:

Name Type Description Default
last_trade float

The last trade price

required
bid_price float

Current bid price

required
ask_price float

Current asking price

required
volume float

Volume of this trade

required
bid_size float

The size of the current bid, if available

required
ask_size float

The size of the current ask, if available

required

update_ask

update_ask(ask_price: float, ask_size: float) -> None

Updates this base data with the new quote ask information

Parameters:

Name Type Description Default
ask_price float

The current ask price

required
ask_size float

The current ask size

required

update_bid

update_bid(bid_price: float, bid_size: float) -> None

Updates this base data with the new quote bid information

Parameters:

Name Type Description Default
bid_price float

The current bid price

required
bid_size float

The current bid size

required

update_quote

update_quote(
    bid_price: float,
    bid_size: float,
    ask_price: float,
    ask_size: float,
) -> None

Updates this base data with new quote information

Parameters:

Name Type Description Default
bid_price float

The current bid price

required
bid_size float

The current bid size

required
ask_price float

The current ask price

required
ask_size float

The current ask size

required

update_trade

update_trade(last_trade: float, trade_size: float) -> None

Updates this base data with a new trade

Parameters:

Name Type Description Default
last_trade float

The price of the last trade

required
trade_size float

The quantity traded

required