stock-trading

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

A股智能交易技能

A-share Intelligent Trading Skill

连接新浪财经实时行情接口,提供A股股票的实时价格查询、模拟买卖和持仓管理。 行情数据为沪深交易所真实数据,交易为模拟盘,不涉及真实账户和资金。
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
支持沪深两市股票代码。示例:600519(贵州茅台)、000858(五粮液)、300750(宁德时代) 返回:股票名称、最新价、涨跌幅、成交量、买卖五档等(JSON格式)
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
用逗号分隔多个股票代码,一次查询多只。
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
支持:sh000001(上证指数)、sz399001(深证成指)、sz399006(创业板指)
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
买入指定股数的股票。shares 必须为100的整数倍(A股最小交易单位为1手=100股)。 ⚠️ 重要:调用前必须先告知用户交易计划并等待确认。
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
bash
python3 {baseDir}/scripts/trade.py --action sell --code 600519 --shares 100

查看持仓和损益

View Positions and Profit/Loss

bash
python3 {baseDir}/scripts/portfolio.py
bash
python3 {baseDir}/scripts/portfolio.py

查看交易记录

View Trading History

bash
python3 {baseDir}/scripts/portfolio.py --history
bash
python3 {baseDir}/scripts/portfolio.py --history

重置账户

Reset Account

bash
python3 {baseDir}/scripts/portfolio.py --reset
重置为初始状态:100万元现金,无持仓。录制视频前使用。
bash
python3 {baseDir}/scripts/portfolio.py --reset
Reset to initial state: 1 million yuan in cash, no positions. Use before recording videos.