technical-analysis
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTechnical Analysis
技术分析
Compute technical indicators using pandas-ta. Supports multi-symbol analysis and earnings data.
使用pandas-ta计算技术指标,支持多标的分析和收益数据处理。
Instructions
操作说明
Note: Ifis not installed oruvis not found, replacepyproject.tomlwithuv run pythonin all commands below.python
bash
uv run python scripts/technicals.py SYMBOL [--period PERIOD] [--indicators INDICATORS] [--earnings]注意: 若未安装或未找到uv,请将以下所有命令中的pyproject.toml替换为uv run python。python
bash
uv run python scripts/technicals.py SYMBOL [--period PERIOD] [--indicators INDICATORS] [--earnings]Arguments
参数说明
- - Ticker symbol or comma-separated list (e.g.,
SYMBOLorAAPL)AAPL,MSFT,GOOGL - - Historical period: 1mo, 3mo, 6mo, 1y (default: 3mo)
--period - - Comma-separated list: rsi,macd,bb,sma,ema,atr,adx (default: all)
--indicators - - Include earnings data (upcoming date + history)
--earnings
- - 股票代码或逗号分隔的代码列表(例如:
SYMBOL或AAPL)AAPL,MSFT,GOOGL - - 历史数据周期:1mo、3mo、6mo、1y(默认值:3mo)
--period - - 逗号分隔的指标列表:rsi、macd、bb、sma、ema、atr、adx(默认值:全部)
--indicators - - 包含收益数据(即将到来的日期+历史数据)
--earnings
Output
输出结果
Single symbol returns:
- - Current price and recent change
price - - Computed values for each indicator
indicators - - Volatility (annualized %) and Sharpe ratio
risk_metrics - - Buy/sell signals based on indicator levels
signals - - Upcoming date and EPS history (if
earnings)--earnings
Multiple symbols returns:
- - Array of individual symbol results
results
单标的返回内容:
- - 当前价格及近期涨跌幅
price - - 各指标的计算值
indicators - - 波动率(年化百分比)和夏普比率
risk_metrics - - 基于指标水平生成的买卖信号
signals - - 即将到来的收益日期及EPS历史数据(若使用
earnings参数)--earnings
多标的返回内容:
- - 单个标的结果的数组
results
Interpretation
指标解读
- RSI > 70 = overbought, RSI < 30 = oversold
- MACD crossover = momentum shift
- Price near Bollinger Band = potential reversal
- Golden cross (SMA20 > SMA50) = bullish
- ADX > 25 = strong trend
- Sharpe ratio > 1 = good risk-adjusted returns, > 2 = excellent
- Volatility (annualized) = standard deviation of returns scaled to annual basis
- RSI > 70 = 超买,RSI < 30 = 超卖
- MACD交叉 = 动量转变
- 价格接近布林带 = 潜在反转信号
- 黄金交叉(SMA20 > SMA50)= 看涨信号
- ADX > 25 = 趋势强劲
- 夏普比率 > 1 = 风险调整后收益良好,>2 = 收益极佳
- 波动率(年化)= 收益标准差按年度缩放后的数值
Examples
示例
bash
undefinedbash
undefinedSingle symbol with all indicators
单标的计算所有指标
uv run python scripts/technicals.py AAPL
uv run python scripts/technicals.py AAPL
Multiple symbols
多标的分析
uv run python scripts/technicals.py AAPL,MSFT,GOOGL
uv run python scripts/technicals.py AAPL,MSFT,GOOGL
With earnings data
包含收益数据
uv run python scripts/technicals.py NVDA --earnings
uv run python scripts/technicals.py NVDA --earnings
Specific indicators only
仅计算指定指标
uv run python scripts/technicals.py TSLA --indicators rsi,macd
---uv run python scripts/technicals.py TSLA --indicators rsi,macd
---Correlation Analysis
相关性分析
Compute price correlation matrix between multiple symbols for diversification analysis.
计算多个标的之间的价格相关矩阵,用于多元化投资分析。
Instructions
操作说明
bash
uv run python scripts/correlation.py SYMBOLS [--period PERIOD]bash
uv run python scripts/correlation.py SYMBOLS [--period PERIOD]Arguments
参数说明
- - Comma-separated ticker symbols (minimum 2)
SYMBOLS - - Historical period: 1mo, 3mo, 6mo, 1y (default: 3mo)
--period
- - 逗号分隔的股票代码(至少2个)
SYMBOLS - - 历史数据周期:1mo、3mo、6mo、1y(默认值:3mo)
--period
Output
输出结果
- - List of symbols analyzed
symbols - - Time period used
period - - Nested dict with correlation values between all pairs
correlation_matrix
- - 分析的标的列表
symbols - - 使用的时间周期
period - - 包含所有标的对相关值的嵌套字典
correlation_matrix
Interpretation
结果解读
- Correlation near 1.0 = highly correlated (move together)
- Correlation near -1.0 = negatively correlated (move opposite)
- Correlation near 0 = uncorrelated (independent movement)
- For diversification, prefer low/negative correlations
- 相关性接近1.0 = 高度相关(同涨同跌)
- 相关性接近-1.0 = 负相关(反向波动)
- 相关性接近0 = 不相关(独立波动)
- 多元化投资偏好低/负相关性的标的
Examples
示例
bash
undefinedbash
undefinedPortfolio correlation
投资组合相关性分析
uv run python scripts/correlation.py AAPL,MSFT,GOOGL,AMZN
uv run python scripts/correlation.py AAPL,MSFT,GOOGL,AMZN
Sector comparison
板块对比分析
uv run python scripts/correlation.py XLF,XLK,XLE,XLV --period 6mo
uv run python scripts/correlation.py XLF,XLK,XLE,XLV --period 6mo
Check hedge effectiveness
对冲有效性验证
uv run python scripts/correlation.py SPY,GLD,TLT
undefineduv run python scripts/correlation.py SPY,GLD,TLT
undefinedDependencies
依赖库
numpypandaspandas-tayfinance
numpypandaspandas-tayfinance