A-share Intelligent Trading Skill
Connect to Sina Finance's real-time quote API to provide real-time price query, simulated trading, and position management for A-share stocks.
Market data is real data from the Shanghai and Shenzhen Stock Exchanges, and trading is conducted on a simulated platform with no involvement of real accounts or funds.
Available Commands
Query Real-time Stock Price
bash
python3 {baseDir}/scripts/get_price.py --code 600519
Supports stock codes from both Shanghai and Shenzhen markets. Examples: 600519 (Kweichow Moutai), 000858 (Wuliangye), 300750 (CATL)
Returns: Stock name, latest price, price change percentage, trading volume, five levels of bid and ask, etc. (in JSON format)
Batch Query Multiple Stocks
bash
python3 {baseDir}/scripts/get_price.py --code 600519,000858,000001
Separate multiple stock codes with commas to query multiple stocks at once.
Query Market Indices
bash
python3 {baseDir}/scripts/get_price.py --index sh000001
Supports: sh000001 (Shanghai Composite Index), sz399001 (Shenzhen Component Index), sz399006 (ChiNext Index)
Buy Stocks
bash
python3 {baseDir}/scripts/trade.py --action buy --code 600519 --shares 100
Buy a specified number of shares. Shares must be in multiples of 100 (the minimum trading unit for A-shares is 1 lot = 100 shares).
⚠️ Important: You must inform the user of the trading plan and wait for confirmation before calling this command.
Sell Stocks
bash
python3 {baseDir}/scripts/trade.py --action sell --code 600519 --shares 100
View Positions and Profit/Loss
bash
python3 {baseDir}/scripts/portfolio.py
View Trading History
bash
python3 {baseDir}/scripts/portfolio.py --history
Reset Account
bash
python3 {baseDir}/scripts/portfolio.py --reset
Reset to initial state: 1 million yuan in cash, no positions. Use before recording videos.