Connects to the Sina Finance real-time quote interface, providing real-time price queries, simulated buying and selling, and position management for A-share stocks. The quote data is real data from the Shanghai and Shenzhen exchanges, and trading is simulated, not involving real accounts or funds.
Available Commands
Query real-time stock prices
python3 {baseDir}/scripts/get_price.py --code 600519
Supports stock codes from both the Shanghai and Shenzhen markets. Examples: 600519 (Kweichow Moutai), 000858 (Wuliangye), 300750 (CATL) Returns: stock name, latest price, price change percentage, trading volume, five-level bid/ask, etc. (JSON format)
Batch query multiple stocks
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
python3 {baseDir}/scripts/get_price.py --index sh000001
Supports: sh000001 (Shanghai Composite Index), sz399001 (Shenzhen Component Index), sz399006 (ChiNext Index)
Buy stocks
python3 {baseDir}/scripts/trade.py --action buy --code 600519 --shares 100
Buy the specified number of shares of a stock. shares must be an integer multiple of 100 (the minimum trading unit for A-shares is 1 lot = 100 shares). ⚠️ Important: Before calling, you must first inform the user of the trading plan and wait for confirmation.
Sell stocks
python3 {baseDir}/scripts/trade.py --action sell --code 600519 --shares 100
View positions and profit/loss
python3 {baseDir}/scripts/portfolio.py
View transaction records
python3 {baseDir}/scripts/portfolio.py --history
Reset account
python3 {baseDir}/scripts/portfolio.py --reset
Reset to the initial state: 1 million yuan in cash, no positions. Use before recording a video.