AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Kweb Pe

skill-buhe-claude-common-skills-kweb-pe · by buhe

Calculate weighted PE ratio for KWEB ETF by fetching top 10 holdings from Yahoo Finance, retrieving individual stock PEs, and computing the weighted average including remaining holdings (assumed PE=20). Use when user wants to: Get KWEB holdings breakdown, Calculate KWEB's weighted PE, Analyze KWEB's valuation metrics.

No reviews yet
0 installs
5 views
0.0% view→install

Install

$ agentstack add skill-buhe-claude-common-skills-kweb-pe

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-buhe-claude-common-skills-kweb-pe)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
5mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Kweb Pe? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

KWEB Weighted PE Calculator

Overview

Calculate the weighted PE ratio for KWEB ETF by fetching its top 10 holdings from Yahoo Finance, retrieving each holding's individual PE ratio, and computing the weighted average PE including all remaining holdings (assumed to have PE=20).

Workflow

This skill works with the agent-browser skill to perform web automation:

  1. Use agent-browser to visit https://hk.finance.yahoo.com/quote/KWEB/holdings (direct holdings page)
  2. Extract the top 10 holdings from the holdings table (name, symbol, weight percentage)
  3. For each stock symbol, visit https://hk.finance.yahoo.com/quote/{SYMBOL}/
  4. Extract PE ratio using grep: agent-browser snapshot | grep -o "市盈率 (最近 12 個月) [0-9.]*"
  5. Parse the PE value from the grep output
  6. Pass the collected data to calculate_weighted_pe() function

Data Format

KWEB Holdings Format (from Yahoo Finance HK)

The holdings data from Yahoo Finance Hong Kong uses Chinese company names and HK stock codes:

| Field | Example | Description | |-------|---------|-------------| | name | 騰訊控股 | Chinese company name | | symbol | 0700.HK | Stock code (HK format) or US ticker | | weight | 10.23 | Weight percentage (as a number) | | pe | 24.81 | PE ratio (as a number) |

Expected Holdings Data Format

holdings = [
    {'name': '騰訊控股', 'symbol': '0700.HK', 'weight': 10.23, 'pe': 24.81},
    {'name': '阿里巴巴-W', 'symbol': '9988.HK', 'weight': 8.77, 'pe': 22.74},
    {'name': 'PDD Holdings Inc.', 'symbol': 'PDD', 'weight': 7.91, 'pe': 10.78},
    # ... more holdings
]

Using the Script

Helper Functions

The script scripts/get_kweb_pe.py provides these functions:

  • parse_weight(weight_text) - Parse weight percentage from text like "10.23%"
  • parse_pe(pe_text) - Parse PE ratio from text, returns None for N/A
  • calculate_weighted_pe(holdings, default_pe=20) - Calculate weighted PE

Running the Script

# Run calculation with holdings data
python3 scripts/get_kweb_pe.py

# Or import the functions in your own script
from scripts.get_kweb_pe import calculate_weighted_pe

Calculation Formula

The weighted PE is calculated as:

Weighted PE = (Σ (weight% × PE) + (100% - total_weight%) × default_pe) / 100

Where:

  • weight% is the holding's weight percentage
  • PE is the holding's price-to-earnings ratio
  • total_weight% is the sum of all included holdings' weights
  • default_pe (default: 20) is used for holdings with no PE data or remaining holdings

Requirements

  • agent-browser skill (for web automation)
  • Python 3.x (for calculation functions)

Resources

scripts/getkwebpe.py

Python helper functions for parsing and calculating weighted PE. Use in conjunction with agent-browser skill for web data extraction.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.