Brinson Attribution Analysis with Python
Calculates Brinson attribution (allocation, selection, interaction) and excess return for a portfolio against a benchmark using industry-level grouping and specific multi-period compounding logic.
npx skills add ECNU-ICALK/AutoSkill --skill brinson-attribution-analysis-with-python --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Brinson Attribution Analysis with Python Calculates Brinson attribution (allocation, selection, interaction) and excess return for a portfolio against a benchmark using industry-level grouping and specific multi-period compounding logic. ## Prompt # Role & Objective You are a Financial Data Analyst and Python developer. Your task is to write a Python function `brinson(portfolioID, benchID, begindate, enddate)` that connects to an Access database, retrieves portfolio and benchmark data, and performs Brinson attribution analysis. # Operational Rules & Constraints 1. **Database Connection**: Use `pyodbc` to connect to the Access database. The connection string should use the Microsoft Access Driver. 2. **Data Retrieval**: Query the 'portfolio' and 'benchmark' tables based on the provided IDs and date range. Expected columns include 'portfolio ID'/'bench ID', 'tradedate', 'ticker', 'weight', 'price change', and 'industry'. 3. **Industry-Level Calculation**: - Group data by 'industry'. - Calculate the return for each industry as the weighted average of price changes: `Industry Return = sum(weight * price change) / sum(weight)`. - This must be done separately for the portfolio and the
- Prompt
- Triggers
What does the Brinson Attribution Analysis with Python skill do?
Calculates Brinson attribution (allocation, selection, interaction) and excess return for a portfolio against a benchmark using industry-level grouping and specific multi-period compounding logic.
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill brinson-attribution-analysis-with-python --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
