Communitygithub.com

gabrielmoreira/agent-skills-mirror

Execute comprehensive portfolio analysis in R, covering data preparation, asset selection (Reward-to-Risk, P/E), optimization (GMVP, Tangency) using PortfolioAnalytics with the ROI solver, and regression analysis.

agent-skills-mirror란 무엇인가요?

agent-skills-mirror is a Claude Code agent skill that execute comprehensive portfolio analysis in R, covering data preparation, asset selection (Reward-to-Risk, P/E), optimization (GMVP, Tangency) using PortfolioAnalytics with the ROI solver, and regression analysis.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/gabrielmoreira/agent-skills-mirror/tree/HEAD/mirrors/repos/ECNU-ICALK@AutoSkill/SkillBank/ConvSkill/english_gpt4_8/r_portfolio_optimization_and_analysis

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

r_portfolio_optimization_and_analysis

Execute comprehensive portfolio analysis in R, covering data preparation, asset selection (Reward-to-Risk, P/E), optimization (GMVP, Tangency) using PortfolioAnalytics with the ROI solver, and regression analysis.

Prompt

Role & Objective

Act as a Financial Data Analyst specializing in R. Your objective is to execute a comprehensive portfolio analysis workflow. This includes rigorous data preparation, asset selection based on specific strategies, portfolio optimization using the PortfolioAnalytics package with the ROI solver, and regression analysis to explain performance.

Operational Rules & Constraints

1. Data Inputs & Preparation

  • Inputs: Expect an assets dataframe (columns: Ticker, Category, MedianReturn, StandardDeviation, PERatio) and a log_returns matrix.
  • Log Returns Calculation: If raw prices are provided, calculate log returns using diff(log(price_column)). This reduces observations by 1 (N prices -> N-1 returns).
  • Date Alignment: When combining date vectors with log return data, remove the first date to align dimensions (e.g., adjusted_dates <- date_vector[-1]).
  • Data Structure: Convert matrix data to data frames using as.data.frame() before using dplyr functions like select().

2. Asset Selection Strategies

Select exactly 5 assets. Constraint: Must include at least one "Forex" and one "Commodities" asset.

  • Strategy 1 (Reward-to-Risk): Calculate RewardToRisk = MedianReturn / StandardDeviation. Rank descending. Select top 5 enforcing constraints.
  • Strategy 2 (P/E Ratio): Rank assets ascending by PERatio. Select top 5 enforcing constraints.

3. Portfolio Optimization

Use the PortfolioAnalytics package. Filter log_returns to include only selected tickers. Convert data to a numeric matrix format expected by the package.

  • Global Minimum Variance Portfolio (GMVP):
    • Objective: Minimize variance.
    • Constraints: weight_sum min_sum = 1, max_sum = 1 (Full investment).
    • Constraints: box min = 0, max = 1 (No short selling).
    • Optimization: Use optimize.portfolio with optimize_method = "ROI".
  • Tangency Portfolio (TP):
    • Objective: Maximize Sharpe Ratio (objective_type = "tangency").
    • Constraints: weight_sum min_sum = 1, max_sum = 1 (Full investment).
    • Constraints: Do not add a box constraint (Short selling allowed).
    • Optimization: Use optimize.portfolio with optimize_method = "ROI".

4. Data Exploration & Regression

  • Perform correlation analysis on selected assets.
  • Generate Histograms, Q-Q plots, and Box-plots.
  • Create an equally weighted index using rowMeans(log_returns).
  • Use lm() to regress portfolio returns against external factors (e.g., lm(Portfolio_Return ~ Factor1 + Factor2)).

Output Requirements

  • Export selected asset lists to CSV.
  • Print summary statistics and portfolio weights using extractWeights.
  • Provide clear, executable R code chunks that load the library, prepare the return matrix, define portfolio specifications, add constraints, run the optimization, and extract results.

Anti-Patterns

  • Do not invent asset categories or specific asset names not provided in the input data.
  • Do not skip the constraint checks for Commodity and Forex assets.
  • Do not use dplyr::select on a matrix object without converting to a data frame.
  • Do not forget to handle the NA value generated in the first row of log return calculations.
  • Do not use optimization methods other than "ROI" for GMVP and Tangency portfolios.
  • Do not add box constraints for the Tangency portfolio.

Triggers

  • perform portfolio analysis in R
  • optimize portfolio weights using GMVP and Tangency
  • select assets based on reward to risk ratio
  • regress portfolio return on factors in R
  • Optimize portfolio using PortfolioAnalytics

Individual skills in this repo

This repo contains 17 individual skills — each has its own dedicated page.

gabrielmoreira/agent-skills-mirror

Design exclusive bonus packages that make YOUR affiliate link the obvious choice. Triggers on: "create bonuses for", "bonus stack", "what bonuses should I offer", "bonus ideas for", "exclusive bonuses", "differentiate my affiliate link", "why buy through my link", "affiliate bonuses", "bonus package", "what can I offer as a bonus", "design bonuses", "build a bonus stack".

gabrielmoreira/agent-skills-mirror

Design irresistible affiliate offers using the Hormozi Grand Slam framework. Triggers on: "create an offer for", "design my offer", "grand slam offer", "make an irresistible offer", "why should someone buy through my link", "offer framework", "value proposition for", "Hormozi offer", "offer stack", "make my offer irresistible", "craft an offer", "what makes my offer different", "offer design", "increase perceived value".

gabrielmoreira/agent-skills-mirror

Create YOUR personal guarantee on top of the product's guarantee for risk reversal. Triggers on: "create a guarantee", "guarantee for my affiliate", "risk reversal", "money back guarantee", "what guarantee can I offer", "reduce buyer risk", "guarantee copy", "how to guarantee", "affiliate guarantee", "personal guarantee", "risk-free offer", "satisfaction guarantee", "results guarantee".

gabrielmoreira/agent-skills-mirror

Build high-converting affiliate landing pages as single self-contained HTML files. Triggers on: "create a landing page for", "build a landing page", "product landing page", "affiliate landing page", "comparison page for", "vs page", "single product page", "conversion page", "sales page for affiliate", "landing page HTML", "build me a page for", "create a page to promote [product]", "I need a landing page", "make a page for [product]".

gabrielmoreira/agent-skills-mirror

Build a single-product deep-dive showcase page as a self-contained HTML file. Triggers on: "build a product showcase page", "deep dive landing page for [product]", "create a product spotlight page", "product feature page", "single product page", "detailed page about [product]", "build a page showing everything about [product]", "create a long-form product page", "build a sales page for [product]", "product deep dive page", "make a feature breakdown page for [product]".

gabrielmoreira/agent-skills-mirror

Build email capture landing pages (squeeze pages) as single self-contained HTML files. Triggers on: "build a squeeze page", "email capture page", "lead magnet page", "create an opt-in page", "build an email list page", "lead capture landing page", "create a freebie page", "build a page to collect emails", "opt-in landing page", "email signup page for [product/niche]", "create a lead magnet landing page", "build a page that captures emails before sending to affiliate offer".

gabrielmoreira/agent-skills-mirror

Design the complete free-to-premium value ladder for affiliate promotions. Triggers on: "value ladder", "customer journey", "upsell path", "ascension model", "free to paid funnel", "tripwire offer", "upsell strategy", "downsell", "product ladder", "price ladder", "customer ascension", "funnel architecture", "map my funnel", "design my funnel stages", "monetization path".

gabrielmoreira/agent-skills-mirror

Build a webinar or live event registration page as a self-contained HTML file with countdown timer, speaker bio, agenda, and registration form. Triggers on: "build a webinar registration page", "create a webinar sign-up page", "event registration landing page", "live training registration page", "workshop sign-up page", "create a webinar page", "build an event page", "free webinar landing page", "live demo registration page", "online event page", "create a registration page for my webinar", "build a training event page".

gabrielmoreira/agent-skills-mirror

Audit paid-ad landing pages for message match, mobile experience, performance, accessibility, trust, forms, consent, tracking, security, and conversion friction. Use for landing-page audit, post-click experience, LP audit, conversion-rate optimization, form optimization, ad-to-page message match, redirects, blocked navigation, or requests involving private, loopback, link-local, or metadata IP destinations.

gabrielmoreira/agent-skills-mirror

Automate Klipfolio tasks via Rube MCP (Composio). Always search tools first for current schemas.

gabrielmoreira/agent-skills-mirror

Review UI code for Web Interface Guidelines compliance.

gabrielmoreira/agent-skills-mirror

Execute a comprehensive 4-step financial analysis in R using dplyr and PortfolioAnalytics: summary statistics, constrained asset selection (Reward/Risk and P/E based), data exploration, and portfolio optimization (GMVP and Tangency) using the ROI solver with specific constraints.

gabrielmoreira/agent-skills-mirror

Generates a single-screen KivyMD application with a centered vertical layout for a personal portfolio, including a profile image, name, role description, biography, and footer.

gabrielmoreira/agent-skills-mirror

Generates a responsive, SEO-optimized landing page for service businesses using Tailwind CSS, featuring specific sections (Header, Hero, Who We Are, Services, Contact) and a responsive grid layout for service cards.

gabrielmoreira/agent-skills-mirror

Generate and rewrite marketing content for software services and portfolios. Adapts tone from professional agency to customer-centric, handles style mimicry, formatting constraints, and strictly manages perspective (e.g., removing first-person pronouns for portfolio contexts).

gabrielmoreira/agent-skills-mirror

Generate complete, deploy-ready landing pages from any repository. Use when creating a homepage for an open-source project, building a project website, converting a README into a marketing page, or standardizing landing pages across multiple repos.

gabrielmoreira/agent-skills-mirror

Shapes job-seeking personal sites: thirty-second hero, outcome-led case studies, hybrid home-plus-project routes, and frictionless contact CTAs, with heavy motion that degrades on mobile. Use for developer, designer, or creative portfolio work. Not a SaaS marketing landing page and not a WebGL engine tutorial.

관련 스킬