mirror of
https://github.com/K-Dense-AI/scientific-agent-skills.git
synced 2026-12-04 01:24:00 +08:00
fix(usfiscaldata): correct nonexistent Treasury auctions_query field names (#201)
accepted_comp_bid_rate_amt and indirect_bid_pct_accepted do not exist in the live Fiscal Data auctions_query schema; use high_yield / int_rate and indirect_bidder_accepted (a USD amount).
This commit is contained in:
1 parent
cfefe8b84f
commit
5628f09d43
2 files changed
+8
-7
No files matched your search
@@ -16,10 +16,11 @@ Historical data on Treasury securities auctions including bills, notes, bonds, T
|
||||
| `security_term` | STRING | e.g., "4-Week", "2-Year", "10-Year" |
|
||||
| `cusip` | STRING | CUSIP identifier |
|
||||
| `offering_amt` | CURRENCY | Amount offered |
|
||||
| `accepted_comp_bid_rate_amt` | PERCENTAGE | High accepted competitive bid rate |
|
||||
| `high_yield` | PERCENTAGE | High accepted yield (notes/bonds/TIPS; bills use `high_discnt_rate`) |
|
||||
| `int_rate` | PERCENTAGE | Coupon/interest rate of the security |
|
||||
| `bid_to_cover_ratio` | NUMBER | Bid-to-cover ratio |
|
||||
| `total_accepted_amt` | CURRENCY | Total accepted amount |
|
||||
| `indirect_bid_pct_accepted` | PERCENTAGE | Indirect bidder percentage |
|
||||
| `indirect_bidder_accepted` | CURRENCY | Indirect bidder amount accepted (USD) |
|
||||
| `issue_date` | DATE | Issue/settlement date |
|
||||
| `maturity_date` | DATE | Maturity date |
|
||||
|
||||
|
||||
@@ -69,22 +69,22 @@ result = fetch("/v1/accounting/od/auctions_query",
|
||||
filter="security_type:eq:Note,security_term:eq:10-Year",
|
||||
sort="-record_date", **{"page[size]": 20})
|
||||
df = pd.DataFrame(result["data"])
|
||||
numeric_cols = ["accepted_comp_bid_rate_amt", "bid_to_cover_ratio",
|
||||
"total_accepted_amt", "indirect_bid_pct_accepted"]
|
||||
numeric_cols = ["high_yield", "bid_to_cover_ratio",
|
||||
"total_accepted_amt", "indirect_bidder_accepted"]
|
||||
for col in numeric_cols:
|
||||
if col in df.columns:
|
||||
df[col] = pd.to_numeric(df[col], errors="coerce")
|
||||
print(df[["record_date", "security_term", "accepted_comp_bid_rate_amt",
|
||||
print(df[["record_date", "security_term", "high_yield",
|
||||
"bid_to_cover_ratio"]].head(10))
|
||||
|
||||
# Auction yield trend: 2-year vs 10-year
|
||||
def get_auction_yields(term, n=24):
|
||||
result = fetch("/v1/accounting/od/auctions_query",
|
||||
fields="record_date,security_term,accepted_comp_bid_rate_amt",
|
||||
fields="record_date,security_term,high_yield",
|
||||
filter=f"security_type:eq:Note,security_term:eq:{term}",
|
||||
sort="-record_date", **{"page[size]": n})
|
||||
df = pd.DataFrame(result["data"])
|
||||
df["yield"] = df["accepted_comp_bid_rate_amt"].astype(float)
|
||||
df["yield"] = df["high_yield"].astype(float)
|
||||
df["date"] = pd.to_datetime(df["record_date"])
|
||||
return df[["date", "yield", "security_term"]].sort_values("date")
|
||||
|
||||
|
||||
Reference in new issue
Block a user