Skip to content

Add institutional ownership tools with investor name resolution#154

Open
ChrisPachulski wants to merge 1 commit intovirattt:mainfrom
ChrisPachulski:pr/institutional-ownership
Open

Add institutional ownership tools with investor name resolution#154
ChrisPachulski wants to merge 1 commit intovirattt:mainfrom
ChrisPachulski:pr/institutional-ownership

Conversation

@ChrisPachulski
Copy link

Summary

  • Adds get_institutional_ownership_by_ticker and get_institutional_ownership_by_investor tools backed by SEC 13-F data
  • Investor names are automatically resolved from natural language (e.g. "Scion Asset Management") to the API's UPPERCASE_WITH_UNDERSCORES format via a cached investor list + fuzzy matching (exact → suffix → substring, preferring shortest match)
  • Registers both tools in the financial_search router with prompt guidance so the LLM passes plain-English investor names and lets the tool handle resolution

Details

4 files changed:

File Change
src/tools/finance/api.ts Added getInvestorList() — lazy in-memory cache of ~10k investor names from /institutional-ownership/investors/
src/tools/finance/institutional-ownership.ts New file — both tools + resolveInvestorName() (normalize → exact → suffix → substring matching)
src/tools/finance/financial-search.ts Import, router entries, section 4 prompt guidance, description update
src/tools/finance/index.ts Re-export the new tools

Name resolution strategy:

  1. Normalize input to UPPERCASE_WITH_UNDERSCORES
  2. Exact match against investor list
  3. Try common suffixes (_LLC, _INC, _LP, etc.)
  4. Substring match (prefer shortest/most-specific)
  5. Pass through on no match (let API return error)

Test plan

  • bun run typecheck passes
  • bun test — existing tests unaffected
  • Manual: "Who owns AAPL?" routes to get_institutional_ownership_by_ticker
  • Manual: "What does Berkshire Hathaway own?" resolves to BERKSHIRE_HATHAWAY_INC and returns holdings

Adds get_institutional_ownership_by_ticker and
get_institutional_ownership_by_investor tools backed by SEC 13-F data.

Investor names are automatically resolved from natural language
(e.g. "Scion Asset Management") to the API's UPPERCASE_WITH_UNDERSCORES
format via a cached investor list and fuzzy matching (exact → suffix →
substring, preferring the shortest/most-specific match).

Both tools are registered in the financial_search router with prompt
guidance so the LLM passes plain-English investor names and lets the
tool handle resolution.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments