### Install Awesome Finance Skills using npx Source: https://context7.com/rkiding/awesome-finance-skills/llms.txt Use npx for a one-step installation of the Awesome Finance Skills. Alternatively, find skills interactively or install manually by cloning the repository. ```bash npx skills add RKiding/Awesome-finance-skills@alphaear-news ``` ```bash npx skills find "alphaear" ``` ```bash git clone https://github.com/RKiding/Awesome-finance-skills.git cp -r Awesome-finance-skills/skills/* ~/.config/opencode/skills/ ``` -------------------------------- ### Clone the Repository Source: https://github.com/rkiding/awesome-finance-skills/blob/main/README.md Clone the Awesome Finance Skills repository to manually install the skills. This method is useful for offline installations or custom setups. ```bash git clone https://github.com/RKiding/Awesome-finance-skills.git ``` -------------------------------- ### Skill Structure Example Source: https://github.com/rkiding/awesome-finance-skills/blob/main/skills/skill-creator/SKILL.md Illustrates the directory structure for a typical skill, including the required SKILL.md file and optional bundled resources. ```tree skill-name/ ├── SKILL.md (required) │ ├── YAML frontmatter metadata (required) │ │ ├── name: (required) │ │ └── description: (required) │ └── Markdown instructions (required) └── Bundled Resources (optional) ├── scripts/ - Executable code (Python/Bash/etc.) ├── references/ - Documentation intended to be loaded into context as needed └── assets/ - Files used in output (templates, icons, fonts, etc.) ``` -------------------------------- ### Clone the Repository (Chinese) Source: https://github.com/rkiding/awesome-finance-skills/blob/main/README.md Clone the Awesome Finance Skills repository to manually install the skills. This method is useful for offline installations or custom setups, with Chinese comments. ```bash # 克隆仓库 git clone https://github.com/RKiding/Awesome-finance-skills.git ``` -------------------------------- ### Install a Specific Skill with npx (Chinese) Source: https://github.com/rkiding/awesome-finance-skills/blob/main/README.md Use `npx skills add` to install individual skills from the Awesome Finance Skills collection. This is the recommended one-step installation method, shown with Chinese comments. ```bash # 安装指定技能(如:alphaear-news) npx skills add RKiding/Awesome-finance-skills@alphaear-news ``` -------------------------------- ### Install a Specific Skill with npx Source: https://github.com/rkiding/awesome-finance-skills/blob/main/README.md Use `npx skills add` to install individual skills from the Awesome Finance Skills collection. This is the recommended one-step installation method. ```bash npx skills add RKiding/Awesome-finance-skills@alphaear-news ``` -------------------------------- ### SKILL.md Frontmatter Example Source: https://github.com/rkiding/awesome-finance-skills/blob/main/skills/skill-creator/SKILL.md Shows the required YAML frontmatter for a SKILL.md file, including name and description fields. ```yaml name: (required) description: (required) ``` -------------------------------- ### Initialize a New Skill Source: https://github.com/rkiding/awesome-finance-skills/blob/main/skills/skill-creator/SKILL.md Use the init_skill.py script to generate a new skill template. Specify the skill name, output path, and optionally include resource directories or example files. ```bash scripts/init_skill.py --path [--resources scripts,references,assets] [--examples] ``` ```bash scripts/init_skill.py my-skill --path skills/public ``` ```bash scripts/init_skill.py my-skill --path skills/public --resources scripts,references ``` ```bash scripts/init_skill.py my-skill --path skills/public --resources scripts --examples ``` -------------------------------- ### Install Skills to Agent Frameworks Source: https://context7.com/rkiding/awesome-finance-skills/llms.txt Copies skill folders to the appropriate directories for various agent frameworks. The destination path determines the scope (personal, project, global, workspace). ```bash # Claude Code / Codex - Personal scope cp -r alphaear-news ~/.claude/skills/ cp -r alphaear-news ~/.codex/skills/ ``` ```bash # Claude Code / Codex - Project scope cp -r alphaear-news .claude/skills/ ``` ```bash # OpenCode - Global scope cp -r alphaear-news ~/.config/opencode/skills/ ``` ```bash # OpenCode - Project scope cp -r alphaear-news .opencode/skills/ # or cp -r alphaear-news .claude/skills/ ``` ```bash # Antigravity - Workspace scope cp -r alphaear-news .agent/skills/ ``` ```bash # Antigravity - Global scope cp -r alphaear-news ~/.gemini/antigravity/global_skills/ ``` ```bash # OpenClaw - Workspace scope (highest priority) cp -r alphaear-news ./skills/ ``` ```bash # OpenClaw - Managed scope cp -r alphaear-news ~/.openclaw/skills/ ``` -------------------------------- ### Python Example for Market Forecasting Source: https://github.com/rkiding/awesome-finance-skills/blob/main/skills/alphaear-predictor/SKILL.md Demonstrates how to use KronosPredictorUtility to forecast market trends for a given stock symbol. Ensure DatabaseManager and KronosPredictorUtility are correctly imported and initialized. ```python from scripts.utils.kronos_predictor import KronosPredictorUtility from scripts.utils.database_manager import DatabaseManager db = DatabaseManager() predictor = KronosPredictorUtility() # Forecast forecast = predictor.predict("600519", horizon="7d") print(forecast) ``` -------------------------------- ### Markdown for PDF Processing Quick Start Source: https://github.com/rkiding/awesome-finance-skills/blob/main/skills/skill-creator/SKILL.md This markdown snippet shows how to extract text using pdfplumber. It's part of a high-level guide with references pattern. ```markdown # PDF Processing ## Quick start Extract text with pdfplumber: [code example] ## Advanced features - **Form filling**: See [FORMS.md](FORMS.md) for complete guide - **API reference**: See [REFERENCE.md](REFERENCE.md) for all methods - **Examples**: See [EXAMPLES.md](EXAMPLES.md) for common patterns ``` -------------------------------- ### Search for Skills with npx (Chinese) Source: https://github.com/rkiding/awesome-finance-skills/blob/main/README.md Use `npx skills find` to search for available skills within the Awesome Finance Skills collection. This helps in discovering and selecting specific skills, with Chinese search query example. ```bash # 或者搜索更多金融技能 npx skills find "get the finance news (alphaear-news)" ``` -------------------------------- ### Write Financial Analysis Section (Writer) Source: https://github.com/rkiding/awesome-finance-skills/blob/main/skills/alphaear-reporter/references/PROMPTS.md This prompt guides an AI agent to write a deep analysis section for a specific financial theme. It requires weaving input signals into a coherent narrative, citing ISQ scores and using a specific citation format, and including detailed predictions for affected tickers. The prompt also specifies formatting for titles, subtitles, and the inclusion of chart blocks. ```markdown You are a senior financial analyst. Write a deep analysis section for the core theme **"{theme_title}"**. ### Input Signals (Cluster) {signal_cluster_text} ### Requirements 1. **Narrative**: Weave signals into a coherent story. Start with Macro/Industry background, then transmission mechanism, finally stock impact. 2. **Quantification**: Cite ISQ scores (Confidence, Intensity) to support views. 3. **Citations**: Use `[@CITE_KEY]` format. Keys are provided in input. 4. **Predictions**: detailed predictions for affected tickers (T+3/T+5 direction). ### Formatting - Main Title: `## {theme_title}` - Subtitles: `###` - **Charts**: Insert at least 1-2 `json-chart` blocks. **Chart Example:** ```json-chart {"type": "forecast", "ticker": "002371.SZ", "title": "Forecast", "pred_len": 5} ``` ``` -------------------------------- ### Analyst Forecast Adjustment Prompt Source: https://github.com/rkiding/awesome-finance-skills/blob/main/skills/alphaear-predictor/references/PROMPTS.md Use this prompt to guide a quantitative strategy analyst in adjusting a base forecast using latest intelligence. Ensure the output adheres to the specified JSON structure. ```markdown You are a senior quantitative strategy analyst. Your task is to subjectively/logically adjust the given [Kronos Model Forecast] based on the [Latest Intelligence/News Context]. Ticker: {ticker} 【Kronos Base Forecast (OHLC)】: {forecast_str} 【Latest Intelligence Context】: {news_context} **Adjustment Principles:** 1. Base forecast is technical-only. 2. Context may contain a "Quantitative Correction" from a news-aware model. **Highly respect** this unless logic is flawed. 3. Use qualitative analysis (news logic) to verify or fine-tune. 4. If no quantitative correction exists, verify trend manually against news sentiment. **Output (Strict JSON):** ```json { "adjusted_forecast": [ { "date": "YYYY-MM-DD", "open": , "high": , "low": , "close": , "volume": }, ... ], "rationale": "Detailed logic..." } ``` Ensure same number of data points as base forecast. ``` -------------------------------- ### Generate Unified Trends Report Source: https://github.com/rkiding/awesome-finance-skills/blob/main/skills/alphaear-news/SKILL.md Aggregates top news from multiple specified sources into a unified trends report. This is useful for getting a consolidated view of market sentiment. ```python news_tools.get_unified_trends(sources) ``` -------------------------------- ### Fetch Hot News with NewsNowTools Source: https://context7.com/rkiding/awesome-finance-skills/llms.txt Initialize NewsNowTools with a database manager to fetch trending financial news from various sources. Content extraction and database persistence are supported. Specify sources like 'cls', 'wallstreetcn', 'weibo', etc. ```python from scripts.news_tools import NewsNowTools from scripts.database_manager import DatabaseManager db = DatabaseManager("data/signal_flux.db") news_tools = NewsNowTools(db) # Fetch top 15 news from Cailian (财联社) news = news_tools.fetch_hot_news(source_id="cls", count=15, fetch_content=False) for item in news[:3]: print(f"[{item['rank']}] {item['title']}") print(f" URL: {item['url']}") print(f" Published: {item['publish_time']}") # Fetch with full content extraction news_with_content = news_tools.fetch_hot_news("wallstreetcn", count=5, fetch_content=True) print(news_with_content[0]['content'][:200]) # Markdown content from Jina # Fetch specific URL content content = news_tools.fetch_news_content("https://www.cls.cn/detail/1234567") print(content) # Returns Markdown formatted article ``` -------------------------------- ### Run DeepEar Lite Test Script Source: https://github.com/rkiding/awesome-finance-skills/blob/main/skills/alphaear-deepear-lite/SKILL.md Execute this command to verify the connection and data fetching capabilities of the DeepEar Lite skill. ```bash python scripts/deepear_lite.py ``` -------------------------------- ### Generate Chart Configurations with visualizer.py Source: https://github.com/rkiding/awesome-finance-skills/blob/main/skills/alphaear-reporter/SKILL.md Use the `visualizer.py` script to manually generate chart configurations. This script is typically invoked by the Writer Prompt for creating visual aids within reports. ```python scripts/visualizer.py ``` -------------------------------- ### Package a Skill Source: https://github.com/rkiding/awesome-finance-skills/blob/main/skills/skill-creator/SKILL.md Use this script to package a completed skill into a distributable .skill file. It automatically validates the skill before packaging. ```bash scripts/package_skill.py ``` ```bash scripts/package_skill.py ./dist ``` -------------------------------- ### Copy Skills to OpenCode Agent (Chinese) Source: https://github.com/rkiding/awesome-finance-skills/blob/main/README.md Manually copy the skills from the cloned repository to the designated skills directory for the OpenCode agent. Ensure the path is correct for your agent's configuration, with Chinese comments. ```bash # 复制技能到你的 Agent(以 OpenCode 为例) cp -r Awesome-finance-skills/skills/* ~/.config/opencode/skills/ ``` -------------------------------- ### Assemble Final Financial Report (Editor) Source: https://github.com/rkiding/awesome-finance-skills/blob/main/skills/alphaear-reporter/references/PROMPTS.md Use this prompt to instruct an AI agent to assemble drafted financial report sections into a final, professional document. It requires ensuring correct structural hierarchy, generating reference and risk factor sections, and creating an executive summary with a quick scan table. The output must be strictly in Markdown format. ```markdown You are a professional editor. Assemble the drafted sections into a final report. ### Draft Sections {draft_sections} ### Requirements 1. **Structure**: Ensure H2/H3 hierarchy is correct. 2. **References**: Generate `## References` section from source list. 3. **Risk**: Generate `## Risk Factors`. 4. **Summary**: Generate `## Executive Summary` with a "Quick Scan" table. Output strictly Markdown. ``` -------------------------------- ### Generate Draw.io XML from Logic Description Source: https://github.com/rkiding/awesome-finance-skills/blob/main/skills/alphaear-logic-visualizer/references/PROMPTS.md Use this prompt to instruct an AI to create Draw.io (MxGraph) XML diagrams. It specifies rules for XML format, node styling (including colors for positive, negative, and neutral impacts), auto-layout strategies, and edge connections. Requires a JSON input for nodes and logic. ```markdown You are an expert at creating Draw.io (MxGraph) diagrams in XML format. Your task is to generate a valid MXGraphModel XML based on the logic description. ### Rules: 1. Output ONLY the XML code. Start with `` and end with ``. 2. Do not use compressed XML. Use plain XML. 3. Use standard shapes: `rounded=1;whiteSpace=wrap;html=1;` for boxes. 4. **Auto-layout Strategy**: - Identify "layers" or "stages" in the logic. - Assign X coordinates based on layers (e.g., 0, 200, 400). - Assign Y coordinates to distribute nodes vertically (e.g., 0, 100, 200). - Ensure nodes do not overlap. 5. **Edges**: Connect nodes logically using ``. ### Template: Please generate a Draw.io XML diagram for the following logic flow: **Title**: {title} **Nodes and Logic**: {nodes_json} Ensure the layout flows logically from Left to Right (or Top to Bottom for hierarchies). Use different colors for 'Positive' (Green/fillColor=#d5e8d4), 'Negative' (Red/fillColor=#f8cecc), and 'Neutral' (Grey/fillColor=#f5f5f5) impacts. ``` -------------------------------- ### Fetch Prediction Market Data with PolymarketTools Source: https://context7.com/rkiding/awesome-finance-skills/llms.txt Initialize PolymarketTools with a database manager to retrieve active prediction market data from Polymarket. This includes questions, possible outcomes, prices, and trading volume. A formatted summary report can also be generated. ```python from scripts.news_tools import PolymarketTools from scripts.database_manager import DatabaseManager db = DatabaseManager() poly_tools = PolymarketTools(db) # Get active prediction markets markets = poly_tools.get_active_markets(limit=10) for m in markets[:3]: print(f"Question: {m['question']}") print(f" Outcomes: {m['outcomes']}") print(f" Prices: {m['outcomePrices']}") print(f" Volume: ${float(m['volume']):,.0f}") # Get formatted summary report summary = poly_tools.get_market_summary(limit=5) print(summary) ``` -------------------------------- ### Set HTTP Proxy Environment Variable Source: https://github.com/rkiding/awesome-finance-skills/blob/main/skills/alphaear-stock/SKILL.md Configure HTTP proxy settings for network requests, particularly for accessing US stock data via yfinance when direct connection is not possible. ```bash export HTTP_PROXY="http://:" export HTTPS_PROXY="http://:" ``` -------------------------------- ### Cluster Financial Signals into Themes (Planner) Source: https://github.com/rkiding/awesome-finance-skills/blob/main/skills/alphaear-reporter/references/PROMPTS.md Use this prompt to instruct an AI agent to group scattered financial signals into 3-5 core logical themes for a structured report. It requires the agent to aggregate correlated signals, generate theme titles with signal IDs, and adhere to a specified JSON output format. ```markdown You are a senior financial report editor. Your task is to cluster the following scattered financial signals into 3-5 core logical themes for a structured report. ### Input Signals {signals_text} ### Requirements 1. **Theme Aggregation**: Group highly correlated signals (e.g., all related to "supply chain restructuring" or "policy tightening"). 2. **Narrative Logic**: Generate only theme titles and list of signal IDs. 3. **Quantity Control**: 3-5 major themes. ### Output Format (JSON) { "clusters": [ { "theme_title": "Theme Name (e.g. Supply Chain Shock)", "signal_ids": [1, 3, 5], "rationale": "These signals all point to..." }, ... ] } ``` -------------------------------- ### Copy Skills to OpenCode Agent Source: https://github.com/rkiding/awesome-finance-skills/blob/main/README.md Manually copy the skills from the cloned repository to the designated skills directory for the OpenCode agent. Ensure the path is correct for your agent's configuration. ```bash cp -r Awesome-finance-skills/skills/* ~/.config/opencode/skills/ ``` -------------------------------- ### Fetch Company Fundamentals with StockTools Source: https://context7.com/rkiding/awesome-finance-skills/llms.txt Retrieve basic company information such as sector, market cap, and PE ratio using `get_stock_fundamentals`. This method supports both A-Share and US stocks, utilizing different data sources. ```python from scripts.stock_tools import StockTools, get_stock_analysis from scripts.database_manager import DatabaseManager db = DatabaseManager() stock_tools = StockTools(db) # A-Share fundamentals (via akshare/EastMoney) fundamentals = stock_tools.get_stock_fundamentals("600519") print(fundamentals) # Output: # { # 'name': '贵州茅台', # 'code': '600519', # 'sector': '酿酒行业', # 'market_cap': '22500亿', # 'listing_date': '2001-08-27', # 'pe_ratio': '35.2' # } # US stock fundamentals (via yfinance) fundamentals_us = stock_tools.get_stock_fundamentals("AAPL") print(fundamentals_us) # Output: # { # 'name': 'Apple Inc.', # 'sector': 'Technology', # 'industry': 'Consumer Electronics', # 'market_cap': 2950000000000, # 'pe_ratio': 28.5, # 'summary': 'Apple Inc. designs, manufactures, and markets smartphones...', # 'currency': 'USD' # } # Generate complete stock analysis report report = get_stock_analysis("600519", db) print(report) # Output: # ## 📊 600519 分析报告 # - **查询时段**: 2023-10-15 -> 2024-01-15 # - **当前价**: ¥1788.30 # - **时段涨跌**: +5.23% # - **最高/最低**: ¥1850.00 / ¥1680.00 # # ### 最近交易概览 # ``` # date close change_pct volume # 2024-01-11 1755.20 -0.75 2123456.0 # 2024-01-12 1780.00 1.41 2567890.0 # ... # ``` ``` -------------------------------- ### Search for Skills with npx Source: https://github.com/rkiding/awesome-finance-skills/blob/main/README.md Use `npx skills find` to search for available skills within the Awesome Finance Skills collection. This helps in discovering and selecting specific skills. ```bash npx skills find "alphaear" ``` -------------------------------- ### NewsNowTools - Real-time Hot News Fetching Source: https://context7.com/rkiding/awesome-finance-skills/llms.txt Fetches trending financial news from multiple sources with optional content extraction and database persistence. ```APIDOC ## NewsNowTools - Real-time Hot News Fetching ### Description Fetches trending financial news from multiple sources with 5-minute caching, content extraction via Jina Reader, and automatic database persistence. ### Method ```python news_tools.fetch_hot_news(source_id: str, count: int = 10, fetch_content: bool = False) ``` ### Parameters #### Query Parameters - **source_id** (str) - Required - The ID of the news source (e.g., "cls", "wallstreetcn", "weibo"). - **count** (int) - Optional - The number of news items to fetch. Defaults to 10. - **fetch_content** (bool) - Optional - Whether to fetch the full content of the news articles. Defaults to False. ### Method ```python news_tools.fetch_news_content(url: str) ``` ### Parameters #### Query Parameters - **url** (str) - Required - The URL of the news article to fetch content from. ### Request Example ```python from scripts.news_tools import NewsNowTools from scripts.database_manager import DatabaseManager db = DatabaseManager("data/signal_flux.db") news_tools = NewsNowTools(db) # Fetch top 15 news from Cailian (财联社) news = news_tools.fetch_hot_news(source_id="cls", count=15, fetch_content=False) for item in news[:3]: print(f"[{item['rank']}] {item['title']}") print(f" URL: {item['url']}") print(f" Published: {item['publish_time']}") # Fetch with full content extraction news_with_content = news_tools.fetch_hot_news("wallstreetcn", count=5, fetch_content=True) print(news_with_content[0]['content'][:200]) # Markdown content from Jina # Fetch specific URL content content = news_tools.fetch_news_content("https://www.cls.cn/detail/1234567") print(content) # Returns Markdown formatted article ``` ### Response #### Success Response (200) - **news** (list) - A list of news items, each containing 'rank', 'title', 'url', and 'publish_time'. If fetch_content is True, each item also includes 'content'. - **content** (str) - Markdown formatted content of the article if fetch_news_content is used. #### Response Example ```json [ { "rank": 1, "title": "央行宣布降准50个基点", "url": "https://www.cls.cn/detail/1234567", "publish_time": "2024-01-15 09:30:00", "content": "# 央行宣布降准..." } ] ``` ``` -------------------------------- ### Proxy Configuration for US Stocks Source: https://github.com/rkiding/awesome-finance-skills/blob/main/skills/alphaear-stock/SKILL.md Instructions on how to configure proxy settings for accessing US stock data via yfinance if direct network access is restricted. ```APIDOC ## Proxy Configuration For accessing US stock data through `yfinance`, you might need to configure proxy settings if your network environment restricts direct access to Yahoo Finance. ### Environment Variables Set the following environment variables in your terminal: ```bash export HTTP_PROXY="http://:" export HTTPS_PROXY="http://:" ``` Replace `` and `` with your actual proxy server IP address and port number. ``` -------------------------------- ### Supported News Sources Source: https://github.com/rkiding/awesome-finance-skills/blob/main/skills/alphaear-news/references/sources.md A list of supported news sources with their IDs, names, categories, and descriptions. ```APIDOC ## Supported News Sources This section lists the news sources available for fetching financial and general news. ### News Sources Table | Source ID | Name | Category | Description | |:----------|:-----|:---------|:------------| | `cls` | 财联社 | Finance | Real-time financial news, focus on A-shares and macro. | | `wallstreetcn` | 华尔街见闻 | Finance | Global markets, macroeconomics, and detailed analysis. | | `xueqiu` | 雪球热榜 | Finance | Community-driven stock discussions and hot topics. | | `weibo` | 微博热搜 | General | Trending social topics, good for public sentiment. | | `zhihu` | 知乎热榜 | General | In-depth discussions and Q&A on trending topics. | | `baidu` | 百度热搜 | General | General public search trends. | | `toutiao` | 今日头条 | General | Algorithmic news recommendations. | | `douyin` | 抖音热榜 | General | Short video trends (titles only). | | `thepaper` | 澎湃新闻 | General | Serious journalism and current affairs. | | `36kr` | 36氪 | Tech | Startup, venture capital, and tech industry news. | | `ithome` | IT之家 | Tech | Consumer electronics and tech gadgets. | | `v2ex` | V2EX | Tech | Developer community trends. | | `juejin` | 掘金 | Tech | Developer blogs and tutorials. | | `hackernews` | Hacker News | Tech | Global tech and startup news (English). | ``` -------------------------------- ### Generate Unified Trends Report with NewsNowTools Source: https://context7.com/rkiding/awesome-finance-skills/llms.txt Use the `get_unified_trends` method from NewsNowTools to aggregate top news from multiple specified sources into a single Markdown-formatted report. Requires initialization with a DatabaseManager. ```python from scripts.news_tools import NewsNowTools from scripts.database_manager import DatabaseManager db = DatabaseManager() news_tools = NewsNowTools(db) # Generate unified report from multiple sources report = news_tools.get_unified_trends(sources=["weibo", "zhihu", "wallstreetcn"]) print(report) ``` -------------------------------- ### Fetch Hot News with NewsNowTools Source: https://github.com/rkiding/awesome-finance-skills/blob/main/skills/alphaear-news/SKILL.md Use this function to fetch a specified number of hot news articles from a given source. Ensure you consult sources.md for valid source IDs. ```python news_tools.fetch_hot_news(source_id, count) ``` -------------------------------- ### Retrieve Historical Stock Price Data with StockTools Source: https://context7.com/rkiding/awesome-finance-skills/llms.txt Fetch historical OHLCV data for stocks using `get_stock_price`. This method includes intelligent caching and falls back to multiple data sources. It supports specifying date ranges and forcing a network refresh. ```python from scripts.stock_tools import StockTools from scripts.database_manager import DatabaseManager db = DatabaseManager() stock_tools = StockTools(db) # Get 90 days of price data (default) df = stock_tools.get_stock_price("600519") print(df.tail()) # Output: # date open close high low volume change_pct # 85 2024-01-10 1750.00 1768.50 1775.00 1745.00 2345678.0 1.05 # 86 2024-01-11 1770.00 1755.20 1772.00 1750.00 2123456.0 -0.75 # 87 2024-01-12 1756.00 1780.00 1785.00 1752.00 2567890.0 1.41 # 88 2024-01-14 1782.00 1795.50 1800.00 1778.00 2890123.0 0.87 # 89 2024-01-15 1796.00 1788.30 1802.00 1785.00 2345678.0 -0.40 # Get specific date range df = stock_tools.get_stock_price( ticker="600519", start_date="2023-06-01", end_date="2023-12-31" ) print(f"Retrieved {len(df)} trading days") # Force refresh from network (bypass cache) df = stock_tools.get_stock_price("600519", force_sync=True) # Hong Kong stocks (5-digit codes) df_hk = stock_tools.get_stock_price("00700") # Tencent print(df_hk.tail(3)) # US stocks (alphabetic tickers via yfinance) df_us = stock_tools.get_stock_price("AAPL") print(df_us.tail(3)) ``` -------------------------------- ### Generate Transmission Graph with Pyecharts Source: https://context7.com/rkiding/awesome-finance-skills/llms.txt Generates a transmission graph from node data and saves it as an HTML file. Requires VisualizerTools to be available. ```python nodes = [ {"node_name": "央行降准", "impact_type": "利好", "logic": "释放流动性"}, {"node_name": "银行成本下降", "impact_type": "利好", "logic": "负债端成本降低"}, {"node_name": "信贷扩张", "impact_type": "利好", "logic": "放贷意愿增强"}, {"node_name": "股市流动性", "impact_type": "利好", "logic": "资金入市"} ] graph = VisualizerTools.generate_transmission_graph(nodes, title="货币政策传导链") VisualizerTools.render_chart_to_file(graph, "output/transmission_chain.html") ``` -------------------------------- ### DatabaseManager - Core Data Persistence Source: https://context7.com/rkiding/awesome-finance-skills/llms.txt Manages SQLite database operations for news, stock prices, and analysis results. Initializes the database schema automatically. Ensure to close the connection when done. ```python from scripts.database_manager import DatabaseManager # Initialize (creates database if not exists) db = DatabaseManager("data/signal_flux.db") # Save news items news_list = [ { "id": "cls_1_2024-01-15", "source": "cls", "rank": 1, "title": "央行降准50个基点", "url": "https://www.cls.cn/detail/123", "content": "Full article content...", "publish_time": "2024-01-15 09:00:00", "sentiment_score": 0.72, "meta_data": {"category": "policy"} } ] count = db.save_daily_news(news_list) print(f"Saved {count} news items") # Retrieve recent news recent_news = db.get_daily_news(source="cls", limit=10, days=1) for news in recent_news: print(f"[{news['source']}] {news['title']} (Sentiment: {news['sentiment_score']})") # Update news content/analysis db.update_news_content( news_id="cls_1_2024-01-15", content="Updated full content...", analysis="Bullish signal for banking sector" ) # Delete news db.delete_news("cls_1_2024-01-15") # Clean up db.close() ``` -------------------------------- ### Prediction Markets Summary Source: https://github.com/rkiding/awesome-finance-skills/blob/main/skills/alphaear-news/SKILL.md Fetches a summary of active prediction markets. ```APIDOC ## Prediction Markets Summary ### Description Retrieves a formatted report of active prediction markets from Polymarket. ### Method GET ### Endpoint /get_market_summary ### Parameters #### Query Parameters - **limit** (integer) - Optional - The maximum number of markets to return. If not specified, a default limit is applied. ### Request Example ```json { "limit": 5 } ``` ### Response #### Success Response (200) - **market_summary** (array) - A list of active prediction markets, each with details like title, current odds, and end date. #### Response Example ```json { "market_summary": [ { "title": "Will BTC reach $50k next month?", "odds": "65%", "end_date": "2023-12-31" } ] } ``` ``` -------------------------------- ### NewsNowTools - Unified Trends Report Source: https://context7.com/rkiding/awesome-finance-skills/llms.txt Aggregates top news from multiple sources into a formatted Markdown report. ```APIDOC ## NewsNowTools - Unified Trends Report ### Description Aggregates top news from multiple sources into a formatted Markdown report. ### Method ```python news_tools.get_unified_trends(sources: list[str]) ``` ### Parameters #### Query Parameters - **sources** (list[str]) - Required - A list of news source IDs to include in the report (e.g., ["weibo", "zhihu", "wallstreetcn"]). ### Request Example ```python from scripts.news_tools import NewsNowTools from scripts.database_manager import DatabaseManager db = DatabaseManager() news_tools = NewsNowTools(db) # Generate unified report from multiple sources report = news_tools.get_unified_trends(sources=["weibo", "zhihu", "wallstreetcn"]) print(report) ``` ### Response #### Success Response (200) - **report** (str) - A Markdown formatted string containing the aggregated news trends. #### Response Example ```markdown # 实时全网热点汇总 (2024-01-15 14:30) ### 🔥 微博热搜 - 央行降准释放流动性 ([链接](https://weibo.com/...)) - 新能源汽车销量破纪录 ([链接](https://weibo.com/...)) ... ### 🔥 知乎热榜 - 如何看待最新经济数据 ([链接](https://zhihu.com/...)) ... ### 🔥 华尔街见闻 - 美联储会议纪要解读 ([链接](https://wallstreetcn.com/...)) ... ``` ``` -------------------------------- ### Stock Search and Ticker Lookup with StockTools Source: https://context7.com/rkiding/awesome-finance-skills/llms.txt Use StockTools to perform fuzzy searches for A-Share, Hong Kong, and US stock tickers. It supports Chinese and English names, common aliases, and automatically cleans ticker suffixes. ```python from scripts.stock_tools import StockTools from scripts.database_manager import DatabaseManager db = DatabaseManager() stock_tools = StockTools(db, auto_update=True) # auto_update fetches stock list on first run # Search by name (supports Chinese and English) results = stock_tools.search_ticker("茅台", limit=5) print(results) # Output: [{'code': '600519', 'name': '贵州茅台'}] # Search by ticker code results = stock_tools.search_ticker("000001", limit=5) print(results) # Output: [{'code': '000001', 'name': '平安银行'}] # Search using common aliases (CATL, BYD, Moutai, etc.) results = stock_tools.search_ticker("CATL", limit=5) print(results) # Output: [{'code': '300750', 'name': '宁德时代'}] # US stock tickers pass through directly results = stock_tools.search_ticker("AAPL", limit=5) print(results) # Output: [{'code': 'AAPL', 'name': 'AAPL'}] # Search with suffix (automatically cleaned) results = stock_tools.search_ticker("600519.SH", limit=5) print(results) # Output: [{'code': '600519', 'name': '贵州茅台'}] ``` -------------------------------- ### Analyze Sentiment (FinBERT / Local) Source: https://github.com/rkiding/awesome-finance-skills/blob/main/skills/alphaear-sentiment/SKILL.md Performs high-speed, local sentiment analysis using the FinBERT model via the `sentiment_tools.py` script. ```APIDOC ## POST /analyze/sentiment/finbert ### Description Analyzes the sentiment of a given financial text using a local FinBERT model. ### Method POST ### Endpoint /analyze/sentiment/finbert ### Parameters #### Request Body - **text** (string) - Required - The financial text to analyze. ### Request Example { "text": "The stock market experienced a significant surge today." } ### Response #### Success Response (200) - **score** (float) - The sentiment score ranging from -1.0 (Negative) to 1.0 (Positive). - **label** (string) - The sentiment label (e.g., 'positive', 'negative', 'neutral'). - **reason** (string) - A brief explanation for the determined sentiment. #### Response Example { "score": 0.85, "label": "positive", "reason": "Positive market trends and investor confidence." } ``` ```APIDOC ## POST /batch/update/news/sentiment ### Description Batch processes unanalyzed news in the database for sentiment analysis using the FinBERT model. ### Method POST ### Endpoint /batch/update/news/sentiment ### Parameters #### Request Body - **source** (string) - Required - The source of the news to process. - **limit** (integer) - Optional - The maximum number of news items to process. ### Request Example { "source": "financial_times", "limit": 100 } ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating the batch update status. #### Response Example { "message": "Batch sentiment update completed for 100 news items." } ``` -------------------------------- ### Sentiment Analysis Prompt for LLM Source: https://github.com/rkiding/awesome-finance-skills/blob/main/skills/alphaear-sentiment/SKILL.md Use this prompt when performing sentiment analysis via an LLM, especially when higher accuracy or reasoning is required. Ensure the LLM returns a JSON object with 'score', 'label', and 'reason'. ```markdown 请分析以下金融/新闻文本的情绪极性。 返回严格的 JSON 格式: {"score": , "label": "", "reason": "<简短理由>"} 文本: {text} ``` -------------------------------- ### Analyze Sentiment with FinBERT Source: https://github.com/rkiding/awesome-finance-skills/blob/main/skills/alphaear-sentiment/SKILL.md Use this method for high-speed, local sentiment analysis of financial text using a FinBERT model. It returns a sentiment score, label, and a brief reason. ```python analyze_sentiment(text) ``` -------------------------------- ### PolymarketTools - Prediction Market Data Source: https://context7.com/rkiding/awesome-finance-skills/llms.txt Retrieves active prediction market data from Polymarket. ```APIDOC ## PolymarketTools - Prediction Market Data ### Description Retrieves active prediction market data from Polymarket, reflecting public sentiment and probability forecasts for major events. ### Method ```python poly_tools.get_active_markets(limit: int = 10) ``` ### Parameters #### Query Parameters - **limit** (int) - Optional - The maximum number of active markets to retrieve. Defaults to 10. ### Method ```python poly_tools.get_market_summary(limit: int = 5) ``` ### Parameters #### Query Parameters - **limit** (int) - Optional - The maximum number of market summaries to generate. Defaults to 5. ### Request Example ```python from scripts.news_tools import PolymarketTools from scripts.database_manager import DatabaseManager db = DatabaseManager() poly_tools = PolymarketTools(db) # Get active prediction markets markets = poly_tools.get_active_markets(limit=10) for m in markets[:3]: print(f"Question: {m['question']}") print(f" Outcomes: {m['outcomes']}") print(f" Prices: {m['outcomePrices']}") print(f" Volume: ${float(m['volume']):,.0f}") # Get formatted summary report summary = poly_tools.get_market_summary(limit=5) print(summary) ``` ### Response #### Success Response (200) - **markets** (list) - A list of active prediction markets, each containing 'question', 'outcomes', 'outcomePrices', and 'volume'. - **summary** (str) - A Markdown formatted string summarizing the top prediction markets. #### Response Example ```json [ { "question": "Will the Fed cut rates in March 2024?", "outcomes": ["Yes", "No"], "outcomePrices": ["0.35", "0.65"], "volume": "2500000" } ] ``` ```markdown # 🔮 Polymarket 热门预测 (2024-01-15 14:30) **1. Will the Fed cut rates in March 2024?** 概率: ['0.35', '0.65'] 交易量: $2,500,000 ... ``` ``` -------------------------------- ### Fetch Prediction Market Summary Source: https://github.com/rkiding/awesome-finance-skills/blob/main/skills/alphaear-news/SKILL.md Retrieves a formatted report of currently active prediction markets. This function is part of the PolymarketTools utility. ```python polymarket_tools.get_market_summary(limit) ``` -------------------------------- ### Markdown for DOCX Processing Source: https://github.com/rkiding/awesome-finance-skills/blob/main/skills/skill-creator/SKILL.md This markdown snippet illustrates conditional details for DOCX processing, linking to advanced topics like redlining and OOXML. ```markdown # DOCX Processing ## Creating documents Use docx-js for new documents. See [DOCX-JS.md](DOCX-JS.md). ## Editing documents For simple edits, modify the XML directly. **For tracked changes**: See [REDLINING.md](REDLINING.md) **For OOXML details**: See [OOXML.md](OOXML.md) ``` -------------------------------- ### Polymarket API Source: https://github.com/rkiding/awesome-finance-skills/blob/main/skills/alphaear-news/references/sources.md Information about the Polymarket API for accessing prediction markets. ```APIDOC ## Polymarket API ### Base URL `https://gamma-api.polymarket.com` ### Data Provides access to prediction markets, such as "Will Fed cut rates?". ### Endpoint: Get Active Markets #### Description Retrieves the top active prediction markets by trading volume. ### Method GET ### Endpoint `/markets/active` ### Query Parameters None specified. ### Request Example (No request body for GET request) ### Response #### Success Response (200) - **markets** (array) - A list of active markets. - **market_id** (string) - Unique identifier for the market. - **question** (string) - The question posed by the prediction market. - **volume** (number) - The current trading volume for the market. #### Response Example ```json { "markets": [ { "market_id": "fed-rate-cut-q3-2024", "question": "Will the Federal Reserve cut interest rates in Q3 2024?", "volume": 1500000.50 }, { "market_id": "election-winner-2024", "question": "Who will win the 2024 US Presidential Election?", "volume": 1200000.75 } ] } ``` ``` -------------------------------- ### Web Search API Source: https://github.com/rkiding/awesome-finance-skills/blob/main/skills/alphaear-search/SKILL.md Perform finance web searches using various engines like Jina, DDG, and Baidu. Includes options for smart caching and aggregating results. ```APIDOC ## Web Search ### Description Performs finance web searches using specified engines. ### Method `search(query, engine, max_results)` ### Parameters #### Query Parameters - **query** (string) - Required - The search query. - **engine** (string) - Required - The search engine to use (e.g., `jina`, `ddg`, `baidu`, `local`). - **max_results** (integer) - Optional - The maximum number of results to return. ### Response #### Success Response (200) - **summary** (string) - A summary of the search results. - **results** (List[Dict]) - A list of detailed search results. ### Method `aggregate_search(query)` ### Description Combines search results from multiple web engines. ### Parameters #### Query Parameters - **query** (string) - Required - The search query. ### Response #### Success Response (200) - **combined_results** (List[Dict]) - Aggregated search results from multiple engines. ``` -------------------------------- ### Local RAG Search API Source: https://github.com/rkiding/awesome-finance-skills/blob/main/skills/alphaear-search/SKILL.md Searches a local 'daily_news' database using Retrieval Augmented Generation (RAG). ```APIDOC ## Local RAG Search ### Description Searches the local 'daily_news' database for relevant financial information. ### Method `search(query, engine='local')` ### Parameters #### Query Parameters - **query** (string) - Required - The search query. - **engine** (string) - Required - Must be set to `local` for RAG search. ### Response #### Success Response (200) - **results** (List[Dict]) - A list of relevant documents from the local database. ``` -------------------------------- ### Unified Trends Report Source: https://github.com/rkiding/awesome-finance-skills/blob/main/skills/alphaear-news/SKILL.md Aggregates and unifies top news trends from multiple sources. ```APIDOC ## Unified Trends Report ### Description Aggregates top news from multiple specified sources to provide a unified trend report. ### Method POST ### Endpoint /get_unified_trends ### Parameters #### Request Body - **sources** (array of strings) - Required - A list of source IDs to aggregate trends from (e.g., ['weibo', 'zhihu', 'wallstreetcn']). ### Request Example ```json { "sources": ["weibo", "zhihu"] } ``` ### Response #### Success Response (200) - **trends** (array) - A list of unified trend reports, each containing aggregated news items. #### Response Example ```json { "trends": [ { "source": "Unified", "title": "Top Trend Example", "summary": "Summary of the aggregated trend." } ] } ``` ``` -------------------------------- ### Financial Text Sentiment Analysis with SentimentTools Source: https://context7.com/rkiding/awesome-finance-skills/llms.txt Perform sentiment analysis on financial texts using FinBERT for local inference. The `analyze_sentiment` method returns a score from -1.0 (negative) to 1.0 (positive) and a sentiment label. ```python from scripts.sentiment_tools import SentimentTools from scripts.database_manager import DatabaseManager db = DatabaseManager() # Initialize with BERT mode (default) sentiment_tools = SentimentTools(db, mode="bert") # Analyze single text result = sentiment_tools.analyze_sentiment("央行宣布降准,释放长期资金约1万亿元") print(result) # Output: # { # 'score': 0.72, # 'label': 'positive', # 'reason': 'BERT automated analysis' # } # Negative sentiment example result = sentiment_tools.analyze_sentiment("公司业绩大幅下滑,股价暴跌10%") print(result) # Output: # { # 'score': -0.85, # 'label': 'negative', # 'reason': 'BERT automated analysis' # } ```