### Standard Installation and Startup Source: https://github.com/aifinlab/finclaw/blob/main/README.md Commands for installing OpenClaw, cloning the FinClaw repository, installing dependencies, and starting the service. ```bash # 1. 安装 OpenClaw curl -fsSL https://openclaw.ai/install.sh | bash # 2. 克隆 FinClaw cd ~/.openclaw/workspace git clone https://github.com/aifinlab/FinClaw . # 3. 安装依赖 pip install akshare pandas numpy requests # 4. 启动 openclaw start ``` -------------------------------- ### FinClaw Quick Start Installation and Configuration Source: https://github.com/aifinlab/finclaw/blob/main/skills/external/INTEGRATION.md Commands to install external skills, configure environment variables, initialize the database, and launch the proactive agent workflow. ```bash # 1. 安装方案三技能 cd finclaw/skills/external ./install-scheme3.sh # 2. 配置 echo "SQL_TOOLKIT_DEFAULT_DB=sqlite" >> .env # 3. 初始化数据库 sql-toolkit --create-database finclaw_db # 4. 创建知识图谱 ontology --create-schema finance_kg --load-defaults # 5. 启动智能监控 proactive-agent --create-workflow market_monitor --from-file workflow.json proactive-agent --start --workflow market_monitor ``` -------------------------------- ### Quick Start with Agent SDK Source: https://github.com/aifinlab/finclaw/blob/main/skills/claude-api/typescript/agent-sdk/README.md A basic example demonstrating how to use the `query` function to interact with the agent. It allows specifying allowed tools for the agent to use. ```typescript import { query } from "@anthropic-ai/claude-agent-sdk"; for await (const message of query({ prompt: "Explain this codebase", options: { allowedTools: ["Read", "Glob", "Grep"] }, })) { if ("result" in message) { console.log(message.result); } } ``` -------------------------------- ### Install Dependencies Source: https://github.com/aifinlab/finclaw/blob/main/skills/finance-news-source/SKILL.md Required environment setup for running the scripts. ```bash # 基础(标准库即可) python --version # 需要 3.8+ # 可选增强 pip install requests beautifulsoup4 # 如果需要 Python 直接抓取 ``` -------------------------------- ### Install OpenClaw and FinClaw Source: https://github.com/aifinlab/finclaw/blob/main/README_EN.md Installs OpenClaw, clones the FinClaw repository, installs dependencies, and starts the FinClaw service. ```bash # 1. Install OpenClaw curl -fsSL https://openclaw.ai/install.sh | bash # 2. Clone FinClaw cd ~/.openclaw/workspace git clone https://github.com/aifinlab/FinClaw . # 3. Install dependencies pip install akshare pandas numpy requests # 4. Start openclaw start ``` -------------------------------- ### Portfolio Monitoring Setup Source: https://context7.com/aifinlab/finclaw/llms.txt Initializes portfolio monitoring with akshare and pandas. This snippet is a starting point and requires further implementation. ```python import akshare as ak import pandas as pd ``` -------------------------------- ### Install Tushare Pro and Set Environment Variables Source: https://github.com/aifinlab/finclaw/blob/main/skillsChoice/securities-suite/README.md Install the Tushare Pro library for accessing detailed financial data. Remember to set your TUSHARE_TOKEN and THS_ACCESS_TOKEN environment variables after installation. ```bash pip install tushare ``` ```bash export TUSHARE_TOKEN="your_token_here" export THS_ACCESS_TOKEN="your_ths_token_here" ``` -------------------------------- ### Install efinance and pandas Source: https://github.com/aifinlab/finclaw/blob/main/skills/efinance-data/references/api_reference.md Install the efinance library and pandas for data manipulation. ```bash pip install efinance pandas ``` -------------------------------- ### Setup and Basic Presentation Source: https://github.com/aifinlab/finclaw/blob/main/skills/pptx/pptxgenjs.md Initialize a presentation, set layout and author, add a slide with text, and save the file. ```javascript const pptxgen = require("pptxgenjs"); let pres = new pptxgen(); pres.layout = 'LAYOUT_16x9'; // or 'LAYOUT_16x10', 'LAYOUT_4x3', 'LAYOUT_WIDE' pres.author = 'Your Name'; pres.title = 'Presentation Title'; let slide = pres.addSlide(); slide.addText("Hello World!", { x: 0.5, y: 0.5, fontSize: 36, color: "363636" }); pres.writeFile({ fileName: "Presentation.pptx" }); ``` -------------------------------- ### Install OpenClaw and FinClaw Source: https://context7.com/aifinlab/finclaw/llms.txt Installs OpenClaw, clones FinClaw repository, installs Python dependencies, and starts the OpenClaw service. ```bash curl -fsSL https://openclaw.ai/install.sh | bash cd ~/.openclaw/workspace git clone https://github.com/aifinlab/FinClaw . pip install akshare pandas numpy requests openclaw start ``` -------------------------------- ### Install Claude API Go SDK Source: https://github.com/aifinlab/finclaw/blob/main/skills/claude-api/go/claude-api.md Use 'go get' to install the official Go SDK for the Claude API. ```bash go get github.com/anthropics/anthropic-sdk-go ``` -------------------------------- ### Install and Initialize Browser Session Source: https://github.com/aifinlab/finclaw/blob/main/skills/agent-browser/SKILL.md Install the CLI and open a new browser session to retrieve interactive element references. ```bash # Install CLI curl -fsSL https://cli.inference.sh | sh && infsh login # Open a page and get interactive elements infsh app run agent-browser --function open --input '{"url": "https://example.com"}' --session new ``` -------------------------------- ### Run Skill Example (Command Line) Source: https://github.com/aifinlab/finclaw/blob/main/skills/a-share-adverse-selection/SKILL.md Shows how to execute a Python script to run a skill from the command line, specifying an input data file. ```bash python scripts/run_skill.py --input data.json ``` -------------------------------- ### Server-Sent Events Stream Example Source: https://github.com/aifinlab/finclaw/blob/main/skills/claude-api/typescript/claude-api/streaming.md This example demonstrates the sequence of Server-Sent Events received over a raw HTTP stream. It includes message start, content block events, message deltas, and stop events. ```text event: message_start data: {"type":"message_start","message":{"id":"msg_...","type":"message",...}} event: content_block_start data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}} event: content_block_delta data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Hello"}} event: content_block_stop data: {"type":"content_block_stop","index":0} event: message_delta data: {"type":"message_delta","delta":{"stop_reason":"end_turn"},"usage":{"output_tokens":12}} event: message_stop data: {"type":"message_stop"} ``` -------------------------------- ### Initialize Project Source: https://github.com/aifinlab/finclaw/blob/main/skills/web-artifacts-builder/SKILL.md Creates a new React project with pre-configured dependencies and tooling. ```bash bash scripts/init-artifact.sh cd ``` -------------------------------- ### WolframAlpha Search for Stock Data Source: https://github.com/aifinlab/finclaw/blob/main/skills/multi-search-engine/references/international-search.md This example shows how to get real-time stock data using WolframAlpha. It queries for 'AAPL' stock information. ```javascript // 股票实时数据 web_fetch({"url": "https://www.wolframalpha.com/input?i=AAPL+stock"}) ``` -------------------------------- ### Setup p5.js Canvas and System Source: https://github.com/aifinlab/finclaw/blob/main/skills/algorithmic-art/templates/viewer.html Initializes the p5.js canvas and triggers the system initialization sequence. ```javascript function setup() { let canvas = createCanvas(1200, 1200); canvas.parent('canvas-container'); initializeSystem(); // Remove loading message document.querySelector('.loading').style.display = 'none'; } ``` -------------------------------- ### Build and Run Commands Source: https://github.com/aifinlab/finclaw/blob/main/skills/mcp-builder/reference/node_mcp_server.md Standard npm scripts for building, starting, and developing the server. ```bash # Build the project npm run build # Run the server npm start # Development with auto-reload npm run dev ``` -------------------------------- ### Get Banking Industry Overview Data Source: https://github.com/aifinlab/finclaw/blob/main/skillsChoice/bank-suite/bank-industry-analyzer/SKILL.md Instantiate the analyzer and call get_industry_overview to fetch general banking industry data. Ensure AkShare and other dependencies are installed. ```python from scripts.main import BankIndustryAnalyzer analyzer = BankIndustryAnalyzer() # 获取银行业概览数据 overview = analyzer.get_industry_overview() ``` -------------------------------- ### Install Dependencies and Configure Environment Source: https://github.com/aifinlab/finclaw/blob/main/skills/mcp-builder/reference/evaluation.md Prepares the environment by installing required packages and setting the Anthropic API key. ```bash pip install -r scripts/requirements.txt export ANTHROPIC_API_KEY=your_api_key ``` -------------------------------- ### Launch Evaluation Viewer Source: https://github.com/aifinlab/finclaw/blob/main/skills/skill-creator/SKILL.md Start the evaluation viewer server to review qualitative outputs and quantitative benchmark data. ```bash nohup python /eval-viewer/generate_review.py \ /iteration-N \ --skill-name "my-skill" \ --benchmark /iteration-N/benchmark.json \ > /dev/null 2>&1 & VIEWER_PID=$! ``` -------------------------------- ### Domain Organization Example Source: https://github.com/aifinlab/finclaw/blob/main/skills/skill-creator/SKILL.md Demonstrates how to organize skills that support multiple domains or frameworks. Each domain gets its own reference file, ensuring Claude only reads relevant documentation. ```tree cloud-deploy/ ├── SKILL.md (workflow + selection) └── references/ ├── aws.md ├── gcp.md └── azure.md ``` -------------------------------- ### Get Market Data Source: https://github.com/aifinlab/finclaw/blob/main/skills/a-share-earnings-analysis/references/workflow.md Fetch historical k-line data, quote information, and fund flow data for a specified stock code. Adjust the start date as needed. ```bash python "$SCRIPTS/cn_stock_data.py" kline --code [CODE] --freq daily --start [6个月前] python "$SCRIPTS/cn_stock_data.py" quote --code [CODE] python "$SCRIPTS/cn_stock_data.py" fund_flow --code [CODE] --days 30 ``` -------------------------------- ### Usage Examples Source: https://github.com/aifinlab/finclaw/blob/main/skills/yfinance-global/SKILL.md Common command-line usage examples for various financial data tasks. ```bash # Apple stock info python scripts/yf_quote.py AAPL # Tencent (HK) python scripts/yf_quote.py 0700.HK # Tesla history python scripts/yf_hist.py TSLA 30 # Technical analysis python scripts/yf_tech.py AAPL # Compare FAANG stocks python scripts/yf_compare.py AAPL MSFT GOOGL AMZN META # Market overview python scripts/yf_market.py # Bitcoin python scripts/yf_crypto.py BTC-USD # Search python scripts/yf_search.py apple ``` -------------------------------- ### Get Futures Historical K-line Data Source: https://github.com/aifinlab/finclaw/blob/main/skills/akshare-futures/SKILL.md Retrieves historical candlestick (K-line) data for futures contracts. Requires contract code, start date, and end date. Data is updated daily after market close. ```bash python scripts/futures_hist.py RB2505 20250101 20260319 ``` -------------------------------- ### Initialize Database with SQL Toolkit Source: https://github.com/aifinlab/finclaw/blob/main/skills/external/INTEGRATION.md Initialize a new database for storing supply chain data using the SQL Toolkit. ```bash sql-toolkit --create-database supply_chain_db ``` -------------------------------- ### Initialize a Basic Agent Source: https://github.com/aifinlab/finclaw/blob/main/skills/claude-api/python/agent-sdk/patterns.md Demonstrates the simplest way to query an agent with specific tools and a working directory. ```python import anyio from claude_agent_sdk import query, ClaudeAgentOptions, ResultMessage async def main(): async for message in query( prompt="Explain what this repository does", options=ClaudeAgentOptions( cwd="/path/to/project", allowed_tools=["Read", "Glob", "Grep"] ) ): if isinstance(message, ResultMessage): print(message.result) anyio.run(main) ``` -------------------------------- ### Custom System Prompt for Claude Agent SDK Source: https://github.com/aifinlab/finclaw/blob/main/skills/claude-api/python/agent-sdk/patterns.md Demonstrates how to provide a custom system prompt to guide the agent's behavior and focus. This example sets a system prompt for a senior code reviewer, emphasizing security, performance, and maintainability. ```python import anyio from claude_agent_sdk import query, ClaudeAgentOptions, ResultMessage async def main(): async for message in query( prompt="Review this code", options=ClaudeAgentOptions( allowed_tools=["Read", "Glob", "Grep"], system_prompt="""You are a senior code reviewer focused on: 1. Security vulnerabilities 2. Performance issues 3. Code maintainability Always provide specific line numbers and suggestions for improvement.""" ) ): if isinstance(message, ResultMessage): print(message.result) anyio.run(main) ``` -------------------------------- ### Extract Cookies via JavaScript Source: https://github.com/aifinlab/finclaw/blob/main/skills/agent-browser/references/authentication.md This snippet shows how to execute JavaScript within the agent browser to retrieve cookies. The first example gets the standard document.cookie, while the second attempts to extract resource names, which might indirectly contain cookie information. ```bash # Get cookies via JavaScript RESULT=$(infsh app run agent-browser --function execute --session $SESSION --input '{ "code": "document.cookie" }') COOKIES=$(echo $RESULT | jq -r '.result') echo "Cookies: $COOKIES" # Get all cookies including httpOnly (more complete) RESULT=$(infsh app run agent-browser --function execute --session $SESSION --input '{ "code": "JSON.stringify(performance.getEntriesByType(\"resource\").map(r => r.name))" }') ``` -------------------------------- ### Setup for Creating New .docx Documents with docx-js Source: https://github.com/aifinlab/finclaw/blob/main/skills/docx/SKILL.md Installs the 'docx' npm package and provides the necessary import statements for creating new .docx documents using JavaScript. The Packer utility is used to convert the document object to a buffer for saving. ```javascript const { Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell, ImageRun, Header, Footer, AlignmentType, PageOrientation, LevelFormat, ExternalHyperlink, InternalHyperlink, Bookmark, FootnoteReferenceRun, PositionalTab, PositionalTabAlignment, PositionalTabRelativeTo, PositionalTabLeader, TabStopType, TabStopPosition, Column, SectionType, TableOfContents, HeadingLevel, BorderStyle, WidthType, ShadingType, VerticalAlign, PageNumber, PageBreak } = require('docx'); const doc = new Document({ sections: [{ children: [/* content */] }] }); Packer.toBuffer(doc).then(buffer => fs.writeFileSync("doc.docx", buffer)); ```