get_shareholder_overlap
Identify investors holding shares across multiple IBEX 35 companies to analyze ownership patterns in the Spanish stock market.
Instructions
Find shareholders who own stakes in multiple IBEX 35 companies
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/database.ts:168-200 (handler)The handler function getShareholderOverlap that implements the core logic of the tool. It fetches shareholder positions from the API, groups positions by shareholder name, identifies shareholders with holdings in multiple companies, calculates average percentage ownership, and returns a sorted list of overlaps by number of companies.async getShareholderOverlap(): Promise<any[]> { const data = await this.fetchAPI('/api/shareholder-positions'); const shareholders = data.shareholderPositions || data.positions || []; // Group by shareholder name const shareholderMap = new Map(); shareholders.forEach(position => { const name = position.shareholder_name || position.name; if (!name) return; if (!shareholderMap.has(name)) { shareholderMap.set(name, []); } shareholderMap.get(name).push(position); }); const overlaps = []; for (const [name, positions] of shareholderMap.entries()) { if (positions.length > 1) { const companies = positions.map(p => p.company_symbol || p.ticker).filter(Boolean); const avgPercentage = positions.reduce((sum, p) => sum + (p.percentage || 0), 0) / positions.length; overlaps.push({ shareholder_name: name, companies: companies.join(','), company_count: companies.length, avg_percentage: avgPercentage }); } } return overlaps.sort((a, b) => b.company_count - a.company_count); }
- src/index.ts:609-611 (registration)The dispatch case in the CallToolRequestSchema handler that routes calls to 'get_shareholder_overlap' to the DatabaseManager's getShareholderOverlap method.case 'get_shareholder_overlap': result = await this.db.getShareholderOverlap(); break;
- src/index.ts:158-165 (schema)The tool registration entry in ListToolsRequestSchema that defines the tool name, description, and input schema (no required parameters).{ name: 'get_shareholder_overlap', description: 'Find shareholders who own stakes in multiple IBEX 35 companies', inputSchema: { type: 'object', properties: {}, }, },
- src/analytics.ts:10-10 (helper)Usage of getShareholderOverlap in AnalyticsManager's getComplexNetworkAnalysis for network analysis.const shareholders = await this.db.getShareholderOverlap();