### Get Started Example Source: https://github.com/hkuds/vibe-trading/blob/main/wiki/alpha-library/index.html Example of how to get started with the Alpha Library, demonstrating a command-line interface for benchmarking alphas. ```bash vibe-trading alpha bench --zoo qlib158 --universe ``` -------------------------------- ### Quick Example Source: https://github.com/hkuds/vibe-trading/blob/main/README.md Examples of how to install and run vibe-trading for natural-language research and alpha zoo benchmarking. ```bash pip install vibe-trading-ai # Natural-language research vibe-trading run -p "Backtest a BTC-USDT 20/50 moving-average strategy for 2024, summarize return and drawdown, then export the report" # Bench a pre-built alpha zoo (one line) vibe-trading alpha bench --zoo gtja191 --universe csi300 --period 2018-2025 --top 20 ``` ```bash vibe-trading --upload trades_export.csv vibe-trading run -p "Analyze my trading behavior, extract my shadow strategy, and compare it with my actual trades" ``` -------------------------------- ### Start Web UI (Local Install - Optional) Source: https://github.com/hkuds/vibe-trading/blob/main/README.md Instructions to start the API server and the frontend development server for the web UI. ```bash # Terminal 1: API server vibe-trading serve --port 8899 # Terminal 2: Frontend dev server cd frontend && npm install && npm run dev ``` -------------------------------- ### AKShare Quick Start Examples Source: https://github.com/hkuds/vibe-trading/blob/main/agent/src/skills/akshare/SKILL.md Demonstrates how to fetch daily historical data for A-shares, US stocks, and HK stocks using the akshare library. ```python import akshare as ak # A-share daily OHLCV (前复权) df = ak.stock_zh_a_hist(symbol="000001", period="daily", start_date="20240101", end_date="20260101", adjust="qfq") # US stock daily df = ak.stock_us_hist(symbol="105.AAPL", period="daily", start_date="20240101", end_date="20260101", adjust="qfq") # HK stock daily df = ak.stock_hk_hist(symbol="00700", period="daily", start_date="20240101", end_date="20260101", adjust="qfq") ``` -------------------------------- ### CCXT Quick Start Example Source: https://github.com/hkuds/vibe-trading/blob/main/agent/src/skills/ccxt/SKILL.md Demonstrates how to initialize a CCXT exchange object and fetch OHLCV data and ticker information for a given symbol. ```python import ccxt exchange = ccxt.binance({"enableRateLimit": True}) # Fetch daily OHLCV ohlcv = exchange.fetch_ohlcv("BTC/USDT", "1d", limit=100) # Returns: [[timestamp, open, high, low, close, volume], ...] # Fetch ticker ticker = exchange.fetch_ticker("ETH/USDT") print(f"ETH price: {ticker['last']}") ``` -------------------------------- ### Install yfinance Source: https://github.com/hkuds/vibe-trading/blob/main/agent/src/skills/yfinance/SKILL.md Install the yfinance library and pandas for data manipulation. ```bash pip install yfinance pandas ``` -------------------------------- ### Runtime Error Fix Example Source: https://github.com/hkuds/vibe-trading/blob/main/agent/src/skills/backtest-diagnose/SKILL.md Example of how to fix an ImportError by installing a missing dependency. ```bash bash("pip install xxx") ``` -------------------------------- ### Fund Dividend API Example Source: https://github.com/hkuds/vibe-trading/blob/main/agent/src/skills/tushare/references/公募基金/基金分红.md Example of how to call the fund_div API to get fund dividend data for a specific announcement date. ```python pro = ts.pro_api() df = pro.fund_div(ann_date='20181018') ``` -------------------------------- ### Local Preview Server Source: https://github.com/hkuds/vibe-trading/blob/main/wiki/README.md Commands to run a local HTTP server for previewing the wiki. ```bash cd wiki python3 -m http.server 8088 ``` -------------------------------- ### Fut_settle Interface Example Source: https://github.com/hkuds/vibe-trading/blob/main/agent/src/skills/tushare/references/期货数据/每日结算参数.md Example of how to call the fut_settle interface to get daily settlement parameters for a specific trade date and exchange. ```python pro = ts.pro_api('your token') df = pro.fut_settle(trade_date='20181114', exchange='SHFE') ``` -------------------------------- ### Interface Example Source: https://github.com/hkuds/vibe-trading/blob/main/agent/src/skills/tushare/references/指数专题/申万行业成分(分级).md Examples of how to use the index_member_all interface to retrieve industry components. ```python #获取黄金分类的成份股 df = pro.index_member_all(l3_code='850531.SI') #获取000001.SZ所属行业 df = pro.index_member_all(ts_code='000001.SZ') ``` -------------------------------- ### FutHolding API Example Source: https://github.com/hkuds/vibe-trading/blob/main/agent/src/skills/tushare/references/期货数据/每日持仓排名.md Example of how to call the fut_holding API to get daily turnover and holding ranking data for a specific trade date and symbol. ```python pro = ts.pro_api() df = pro.fut_holding(trade_date='20181113', symbol='C1905', exchange='DCE') ``` -------------------------------- ### Vibe-Trading Installation Source: https://github.com/hkuds/vibe-trading/blob/main/wiki/home/index.html Commands for installing vibe-trading via PyPI or from source. ```bash pip install vibe-trading-ai vibe-trading init vibe-trading ``` ```bash uv tool install vibe-trading-ai vibe-trading init vibe-trading serve --port 8899 ``` ```bash git clone https://github.com/HKUDS/Vibe-Trading cd Vibe-Trading pip install -e . vibe-trading ``` -------------------------------- ### Get BTC-USDT Spot Market Ticker Source: https://github.com/hkuds/vibe-trading/blob/main/agent/src/skills/okx-market/references/现货行情/单个行情.md Example of how to fetch the latest market ticker for BTC-USDT spot trading pair. ```python import requests BASE_URL = "https://www.okx.com/api/v5" # 获取 BTC-USDT 现货行情 resp = requests.get(f"{BASE_URL}/market/ticker", params={"instId": "BTC-USDT"}) data = resp.json()["data"][0] print(f"最新价: {data['last']}, 24h量: {data['vol24h']}") ``` -------------------------------- ### Vibe-Trading CLI Examples Source: https://github.com/hkuds/vibe-trading/blob/main/wiki/home/index.html Examples of using the vibe-trading command-line interface for running backtests and swarm analysis. ```bash $ vibe-trading run -p "Backtest BTC-USDT 20/50 MA for 2024" route: crypto data -> strategy -> backtest -> run card return +18.6% max drawdown -7.4% ``` ```bash $ vibe-trading --swarm-run investment_committee workers: macro, quant, risk, catalyst report saved with evidence, metrics, and caveats BTC-USDTSPY510300.SHUSDCNH ``` -------------------------------- ### Docker Installation Source: https://github.com/hkuds/vibe-trading/blob/main/README.md Steps to clone the repository, set up the environment, and run the application using Docker Compose. ```bash git clone https://github.com/HKUDS/Vibe-Trading.git cd Vibe-Trading cp agent/.env.example agent/.env # Edit agent/.env — uncomment your LLM provider and set API key docker compose up --build ``` -------------------------------- ### Get Hot Money Directory Information Source: https://github.com/hkuds/vibe-trading/blob/main/agent/src/skills/tushare/references/股票数据/打板专题数据/市场游资最全名录.md Example of how to use the `hm_list` interface to retrieve hot money directory information. ```python #代码示例 pro = ts.pro_api() df = pro.hm_list() ``` -------------------------------- ### Install Vibe-Trading Source: https://github.com/hkuds/vibe-trading/blob/main/agent/SKILL.md Command to install the vibe-trading-ai package using pip. ```bash pip install vibe-trading-ai ``` -------------------------------- ### Get All Swap Market Data Source: https://github.com/hkuds/vibe-trading/blob/main/agent/src/skills/okx-market/references/现货行情/批量行情.md This example shows how to retrieve all swap market tickers and print the total count. ```python # 获取所有永续合约行情 resp = requests.get(f"{BASE_URL}/market/tickers", params={"instType": "SWAP"}) swaps = resp.json()["data"] print(f"永续合约数量: {len(swaps)}") ``` -------------------------------- ### Get ETH-USDT Perpetual Contract Market Ticker Source: https://github.com/hkuds/vibe-trading/blob/main/agent/src/skills/okx-market/references/现货行情/单个行情.md Example of how to fetch the latest market ticker for ETH-USDT perpetual futures contract. ```python import requests BASE_URL = "https://www.okx.com/api/v5" # 获取 ETH-USDT 永续合约行情 resp = requests.get(f"{BASE_URL}/market/ticker", params={"instId": "ETH-USDT-SWAP"}) data = resp.json()["data"][0] print(f"ETH永续最新价: {data['last']}") ``` -------------------------------- ### Get BTC Index Price Source: https://github.com/hkuds/vibe-trading/blob/main/agent/src/skills/okx-market/references/指数行情/指数行情.md Example of how to fetch the index price for BTC-USD using the /api/v5/market/index-tickers endpoint. ```python import requests BASE_URL = "https://www.okx.com/api/v5" # 获取 BTC 指数价格 resp = requests.get(f"{BASE_URL}/market/index-tickers", params={"instId": "BTC-USD"}) data = resp.json()["data"][0] print(f"BTC 指数价格: {data['idxPx']}") ``` -------------------------------- ### Local Installation Source: https://github.com/hkuds/vibe-trading/blob/main/README.md Steps to clone the repository, set up a virtual environment, install dependencies, and launch the interactive TUI. ```bash git clone https://github.com/HKUDS/Vibe-Trading.git cd Vibe-Trading python -m venv .venv # Activate source .venv/bin/activate # Linux / macOS # .venv\Scripts\Activate.ps1 # Windows PowerShell pip install -e . cp agent/.env.example agent/.env # Edit — set your LLM provider API key vibe-trading # Launch interactive TUI ``` -------------------------------- ### Get All Changed Stock Code Mapping Table Source: https://github.com/hkuds/vibe-trading/blob/main/agent/src/skills/tushare/references/股票数据/基础数据/北交所新旧代码对照.md This example shows how to retrieve the complete mapping table for all stocks whose codes have changed. ```python #获取全部变更的股票代码对照表 df = pro.bse_mapping() ``` -------------------------------- ### Backtest Configuration Example Source: https://github.com/hkuds/vibe-trading/blob/main/agent/src/skills/minute-analysis/SKILL.md Example of config.json for minute-level backtests. ```json { "source": "okx", "codes": ["BTC-USDT"], "start_date": "2026-03-01", "end_date": "2026-03-15", "interval": "5m", "initial_cash": 1000000, "commission": 0.0005 } ``` -------------------------------- ### Cross-Session Memory Examples Source: https://github.com/hkuds/vibe-trading/blob/main/README.md Examples demonstrating how to save preferences and how the agent recalls them in future sessions. ```bash # Save your preferences once vibe-trading run -p "Remember: I prefer RSI-based strategies, max 10% drawdown, hold period 5–20 days" # The agent recalls them in future sessions automatically vibe-trading run -p "Build a crypto strategy that fits my risk profile" ``` -------------------------------- ### Get Margin Securities Data Source: https://github.com/hkuds/vibe-trading/blob/main/agent/src/skills/tushare/references/股票数据/两融及转融通/融资融券标的(盘前).md Example of how to retrieve margin securities data for the Shanghai Stock Exchange on April 17, 2024. ```python pro = ts.pro_api() #获取2024年4月17日上交所融资融券标的 df = pro.margin_secs(trade_date='20240417', exchange='SSE') ``` -------------------------------- ### Install Dependencies Source: https://github.com/hkuds/vibe-trading/blob/main/agent/src/skills/smc/SKILL.md Installs the necessary Python libraries for the SMC skill. ```bash pip install smartmoneyconcepts pandas numpy requests ``` -------------------------------- ### Get FTSE China A50 Index Data Source: https://github.com/hkuds/vibe-trading/blob/main/agent/src/skills/tushare/references/指数专题/国际主要指数.md Example of how to use the `index_global` function to fetch data for the FTSE China A50 Index. ```python pro = ts.pro_api() #获取富时中国50指数 df = pro.index_global(ts_code='XIN9', start_date='20200201', end_date='20200220') ``` -------------------------------- ### Get PMI Data Source: https://github.com/hkuds/vibe-trading/blob/main/agent/src/skills/tushare/references/宏观经济/国内宏观/景气度/采购经理指数(PMI).md Example of how to retrieve PMI data for a specified date range and specific fields using the Tushare API. ```python pro = ts.pro_api() #获取指定字段 df = pro.cn_pmi(start_m='201901', end_m='202003', fields='month,pmi010000,pmi010400') ``` -------------------------------- ### Installation and Usage Source: https://github.com/hkuds/vibe-trading/blob/main/wiki/alpha-library/index.html Commands to install the library and list/benchmark alphas. ```bash # install pip install vibe-trading-ai # list every alpha in a zoo vibe-trading alpha list --zoo gtja191 # benchmark a zoo on your universe and period vibe-trading alpha bench --zoo gtja191 --universe csi300 --period 2020-2025 ``` -------------------------------- ### Strategy & Backtesting Examples Source: https://github.com/hkuds/vibe-trading/blob/main/README.md Examples of running backtests for various strategies on different asset classes and timeframes, including exporting results. ```bash # Moving average crossover on US equities vibe-trading run -p "Backtest a 20/50-day moving average crossover on AAPL for the past year, show Sharpe ratio and max drawdown" # RSI mean-reversion on crypto vibe-trading run -p "Test RSI(14) mean-reversion on BTC-USDT: buy below 30, sell above 70, last 6 months" # Multi-factor strategy on A-shares vibe-trading run -p "Backtest a momentum + value + quality multi-factor strategy on CSI 300 constituents over 2 years" # After backtesting, export to TradingView / TDX / MetaTrader 5 vibe-trading --pine ``` -------------------------------- ### Interface Call Source: https://github.com/hkuds/vibe-trading/blob/main/agent/src/skills/tushare/references/宏观经济/国际宏观/美国利率/国债收益率曲线利率.md Example of how to call the `us_tycr` interface to get all data within a date range. ```python pro = ts.pro_api() df = pro.us_tycr(start_date='20180101', end_date='20200327') ``` -------------------------------- ### Get All USD Index Tickers Source: https://github.com/hkuds/vibe-trading/blob/main/agent/src/skills/okx-market/references/指数行情/指数行情.md Example of how to fetch all index tickers for USD-denominated instruments using the /api/v5/market/index-tickers endpoint. ```python import requests BASE_URL = "https://www.okx.com/api/v5" # 获取所有 USD 指数 resp = requests.get(f"{BASE_URL}/market/index-tickers", params={"quoteCcy": "USD"}) indexes = resp.json()["data"] for idx in indexes[:10]: print(f" {idx['instId']:15s} {idx['idxPx']:>10s}") ``` -------------------------------- ### Production Mode Web UI (Local Install) Source: https://github.com/hkuds/vibe-trading/blob/main/README.md Steps to build the frontend for production and run the FastAPI server to serve static files. ```bash cd frontend && npm run build && cd .. vibe-trading serve --port 8899 # FastAPI serves dist/ as static files ``` -------------------------------- ### Swarm Workflows Examples Source: https://github.com/hkuds/vibe-trading/blob/main/README.md Examples of initiating swarm workflows for various financial desks and analyses. ```bash # Bull/bear debate on a stock vibe-trading --swarm-run investment_committee '{"topic": "Is TSLA a buy at current levels?"}' # Quant strategy from screening to backtest vibe-trading --swarm-run quant_strategy_desk '{"universe": "S&P 500", "horizon": "3 months"}' # Crypto desk: funding + liquidation + flow → risk manager vibe-trading --swarm-run crypto_trading_desk '{"asset": "ETH-USDT", "timeframe": "1w"}' # Global macro portfolio allocation vibe-trading --swarm-run macro_rates_fx_desk '{"focus": "Fed pivot impact on EM bonds"}' ``` -------------------------------- ### Get BTC Perpetual Mark Price Source: https://github.com/hkuds/vibe-trading/blob/main/agent/src/skills/okx-market/references/合约行情/标记价格.md This example shows how to retrieve the mark price for a specific perpetual contract (BTC-USDT-SWAP). ```python import requests BASE_URL = "https://www.okx.com/api/v5" # 获取 BTC 永续标记价格 resp = requests.get(f"{BASE_URL}/public/mark-price", params={ "instType": "SWAP", "instId": "BTC-USDT-SWAP" }) data = resp.json()["data"][0] print(f"BTC 永续标记价格: {data['markPx']}") ``` -------------------------------- ### Strategy Suggestions Example Source: https://github.com/hkuds/vibe-trading/blob/main/agent/src/skills/crypto-derivatives/SKILL.md An example of a strategy suggestions table for crypto derivatives analysis. ```markdown ### Strategy Suggestions | Strategy | Direction | Expected Annualized Return | Risk Level | |------|------|---------|---------| | BTC funding-rate arbitrage | Short perpetual + long spot | 25-35% | Medium | | ETH Calendar Spread | Long near month / short far month | 12-18% | Medium-low | | BTC Short Strangle | Sell OTM call + put | Collect premium | High | ```