| name | run2_cross_fund_analysis |
| description | Find which funds hold a specific stock and rank them by holding value |
Cross-Fund Holdings Analysis
Overview
Analyze which funds hold a specific security (identified by CUSIP) and rank them by the size of their investment. This is useful for understanding which asset managers have the largest positions in a given stock.
Finding a Stock's CUSIP
Method 1: Exact Search (if you know CUSIP)
import pandas as pd
palantir_cusip = "69608A108"
Method 2: Fuzzy Search for CUSIP
Method 3: Search INFOTABLE
infotable = pd.read_csv('/root/2025-q3/INFOTABLE.tsv', sep='\t', low_memory=False)
palantir_rows = infotable[infotable['NAMEOFISSUER'].str.contains('Palantir', case=False, na=False)]
cusip = palantir_rows['CUSIP'].unique()[0]
print(f"Palantir CUSIP: {cusip}")
Finding All Funds Holding a Stock
Step 1: Filter INFOTABLE by CUSIP
import pandas as pd
palantir_cusip = "69608A108"
infotable = pd.read_csv('/root/2025-q3/INFOTABLE.tsv', sep='\t', low_memory=False)
stock_holdings = infotable[infotable['CUSIP'] == palantir_cusip]
print(f"Number of funds holding this stock: {stock_holdings['ACCESSION_NUMBER'].nunique()}")
print(f"Total holdings records: {len(stock_holdings)}")
Step 2: Link to Fund Manager Names
coverpage = pd.read_csv('/root/2025-q3/COVERPAGE.tsv', sep='\t')
holdings_with_funds = pd.merge(
stock_holdings,
coverpage[['ACCESSION_NUMBER', 'FILINGMANAGER_NAME']],
on='ACCESSION_NUMBER'
)
print(f"Unique funds: {holdings_with_funds['FILINGMANAGER_NAME'].nunique()}")
Step 3: Aggregate and Rank by Value
fund_holdings = holdings_with_funds.groupby('FILINGMANAGER_NAME').agg({
'VALUE': 'sum',
'SSHPRNAMT': 'sum',
'ACCESSION_NUMBER': 'first'
}).reset_index()
fund_holdings.columns = ['FUND_NAME', 'TOTAL_VALUE', 'TOTAL_SHARES', 'ACCESSION_NUMBER']
fund_holdings = fund_holdings.sort_values('TOTAL_VALUE', ascending=False)
print(fund_holdings.head(10))
Step 4: Get Top N Funds
top_3_funds = fund_holdings.nlargest(3, 'TOTAL_VALUE')
top_3_names = top_3_funds['FUND_NAME'].tolist()
print("Top 3 funds holding Palantir (by value):")
for i, (name, value) in enumerate(zip(top_3_names, top_3_funds['TOTAL_VALUE']), 1):
print(f"{i}. {name}: ${value:,.0f}")
Complete Example: Palantir Holdings
import pandas as pd
palantir_cusip = "69608A108"
infotable = pd.read_csv('/root/2025-q3/INFOTABLE.tsv', sep='\t', low_memory=False)
coverpage = pd.read_csv('/root/2025-q3/COVERPAGE.tsv', sep='\t')
palantir_holdings = infotable[infotable['CUSIP'] == palantir_cusip]
holdings_with_names = pd.merge(
palantir_holdings,
coverpage[['ACCESSION_NUMBER', 'FILINGMANAGER_NAME']],
on='ACCESSION_NUMBER'
)
fund_summary = holdings_with_names.groupby('FILINGMANAGER_NAME').agg({
'VALUE': 'sum'
}).reset_index()
top_3 = fund_summary.nlargest(3, 'VALUE')
fund_names = top_3['FILINGMANAGER_NAME'].tolist()
print(fund_names)
Key Metrics for Cross-Fund Analysis
For a given CUSIP:
- Total Funds Holding:
stock_holdings['ACCESSION_NUMBER'].nunique()
- Total Shares Outstanding (across funds):
stock_holdings['SSHPRNAMT'].sum()
- Aggregate Value:
stock_holdings['VALUE'].sum()
- Largest Holder: First entry after sorting by VALUE descending
- Top 3 Holders:
nlargest(3, 'VALUE')
- Concentration: (Top 3 value / Aggregate value) * 100
Important Considerations
Handling Multiple Records per Fund
Data Types
infotable = pd.read_csv(
'INFOTABLE.tsv',
sep='\t',
low_memory=False,
dtype={'CUSIP': 'str', 'ACCESSION_NUMBER': 'str', 'VALUE': 'int64'}
)
Filtering Options
stock_holdings = infotable[infotable['CUSIP'] == cusip]
stock_holdings = infotable[infotable['CUSIP'].str.contains(cusip_partial, na=False)]
stock_holdings = infotable[infotable['NAMEOFISSUER'].str.contains('Palantir', case=False, na=False)]
Validation Checklist
Output Format
{
"stock_cusip": "69608A108",
"stock_name": "PALANTIR TECHNOLOGIES INC",
"number_of_funds": 4531,
"total_value": 123456789,
"top_3_funds": [
{
"rank": 1,
"name": "VANGUARD GROUP INC",
"value": 39017133374,
"shares": 213886270
},
{
"rank": 2,
"name": "BlackRock, Inc.",
"value": 34409511965,
"shares": 188627957
},