Government contracts by ticker: federal awards of a listed company in Python
Get the federal contracts and awards of any listed company by ticker, rolled up across its subsidiaries and joint ventures, with the matched USAspending recipient shown, and filter them by agency, type and NAICS.
Federal award data names recipients, not tickers, and a large contractor shows up under many legal entities and UEIs. The /v1/companies/federal-awards endpoint takes a ticker or CIK, finds the matching parent recipient in USAspending, and searches the awards of every UEI under that parent. The response shows how the match was made, so you can check it before you use the numbers.
Setup
import os
import requests
H = {"Authorization": "Bearer " + os.environ["SECFEED_KEY"]}
BASE = "https://secfeedapi.com/v1"
A company's largest awards
r = requests.get(BASE + "/companies/federal-awards", headers=H, params={"ticker": "LMT", "size": 3}).json()
print(r["company"])
rec = r["recipient"]
print(r["method"], "|", rec["name"], rec["uei"], round(rec["last12MonthsAmount"] / 1e9, 1), "bn in the last 12 months")
print(len(r["ueis"]), "UEIs searched")
for a in r["awards"]:
print(a["awardId"], a["recipientName"], round(a["amount"] / 1e9, 2), "bn", a["awardingAgency"])
Output from a real run:
{'cik': 936468, 'ticker': 'LMT', 'name': 'LOCKHEED MARTIN CORP'}
exact_normalized_name | LOCKHEED MARTIN CORP ZFN2JJXBLZT3 48.6 bn in the last 12 months
13 UEIs searched
DEAC0494AL85000 LOCKHEED MARTIN CORP 48.06 bn Department of Energy
N0001917C0001 LOCKHEED MARTIN CORPORATION 35.14 bn Department of Defense
N0001902C3002 LOCKHEED MARTIN CORPORATION 34.17 bn Department of Defense
method says how the ticker was matched (here an exact match on the normalised SEC name), recipient is the parent recipient that was picked, and ueis lists every UEI that was searched. The matches array shows the other recipients with the same name, so a wrong pick is easy to see. Awards are sorted by amount by default, over the full USAspending history from fiscal year 2008 on, which is why a long running Department of Energy contract comes first.
Filter by agency and type
type takes contracts, idvs, grants, loans, direct or other. agency is the awarding agency's top tier name as USAspending writes it:
r = requests.get(BASE + "/companies/federal-awards", headers=H, params={
"ticker": "LMT", "type": "contracts", "agency": "National Aeronautics and Space Administration", "size": 3}).json()
for a in r["awards"]:
print(a["startDate"], a["endDate"], a["awardId"], round(a["amount"] / 1e9, 2), "bn", a["naics"]["code"])
print("more:", r["hasNext"])
2006-09-06 2027-04-15 NNJ06TA25C 15.58 bn 541710
2000-10-27 2013-02-28 MSFC0199911DNAS800016 2.87 bn 336415
1998-09-25 2004-03-30 NAS998100 2.15 bn 541330
more: True
You can also filter on naics, psc and state, limit the action dates with startDate and endDate, sort by amount, startDate or endDate, and page with from and size. Each award row also carries secCompany, so rows from several tickers can be mixed in one table.
What to keep in mind
- A ticker is matched only when the SEC name and the USAspending parent name agree after normalisation. If there is no exact match, the response lists candidates instead of guessing.
- Amounts are the obligated amounts USAspending reports for the whole award, not what was paid this year.
outlaysis shown when USAspending has it. - Calls go to USAspending and are cached for two days, so the first call for a company can take up to a minute.
- For contracts that end soon, see the Recompete Radar API. For open solicitations, see SAM.gov opportunities.