Install
$ agentstack add skill-buhe-claude-common-skills-kweb-pe ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo 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.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
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 →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:
- Use agent-browser to visit
https://hk.finance.yahoo.com/quote/KWEB/holdings(direct holdings page) - Extract the top 10 holdings from the holdings table (name, symbol, weight percentage)
- For each stock symbol, visit
https://hk.finance.yahoo.com/quote/{SYMBOL}/ - Extract PE ratio using grep:
agent-browser snapshot | grep -o "市盈率 (最近 12 個月) [0-9.]*" - Parse the PE value from the grep output
- 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/Acalculate_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 percentagePEis the holding's price-to-earnings ratiototal_weight%is the sum of all included holdings' weightsdefault_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.
- Author: buhe
- Source: buhe/claude-common-skills
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.