Technical Analysis API
Get comprehensive technical analysis data including indicators, signals, and automated analysis for any stock symbol.
Available Endpoints
Technical Indicators
Get detailed technical analysis with multiple indicators and signals.
GET /api/technicals/{symbol}
Query Parameters:
interval
(optional): Time interval (1m
, 5m
, 15m
, 30m
, 1h
, 1d
, 1wk
, 1mo
)
indicators
(optional): Comma-separated list of indicators
period
(optional): Analysis period (default: 14)
Example Request:
curl -X GET "https://api.financialcontext.com/api/technicals/AAPL?interval=1d&indicators=rsi,macd,sma" \
-H "X-API-Key: your-api-key"
Response:
{
"success": true,
"data": {
"symbol": "AAPL",
"interval": "1d",
"timestamp": "2024-01-15T16:00:00Z",
"summary": {
"recommendation": "BUY",
"score": 0.75,
"signals": {
"bullish": 8,
"bearish": 3,
"neutral": 4
}
},
"indicators": {
"rsi": {
"value": 65.4,
"signal": "NEUTRAL",
"description": "RSI indicates moderate momentum"
},
"macd": {
"macd": 2.15,
"signal": 1.89,
"histogram": 0.26,
"signal": "BUY",
"description": "MACD line above signal line"
},
"sma": {
"sma20": 182.45,
"sma50": 178.90,
"sma200": 165.30,
"signal": "BUY",
"description": "Price above all moving averages"
},
"bollinger": {
"upper": 188.50,
"middle": 182.45,
"lower": 176.40,
"signal": "NEUTRAL",
"description": "Price near middle band"
}
},
"patterns": [
{
"name": "Golden Cross",
"type": "BULLISH",
"confidence": 0.85,
"description": "50-day MA crossed above 200-day MA"
}
]
}
}
Technical Indicators
Momentum Indicators
RSI (Relative Strength Index)
- Range: 0-100
- Overbought: > 70
- Oversold: < 30
- Neutral: 30-70
MACD (Moving Average Convergence Divergence)
- Components: MACD line, Signal line, Histogram
- Buy Signal: MACD crosses above signal line
- Sell Signal: MACD crosses below signal line
Stochastic Oscillator
- Range: 0-100
- Overbought: > 80
- Oversold: < 20
Trend Indicators
Moving Averages
- SMA: Simple Moving Average
- EMA: Exponential Moving Average
- WMA: Weighted Moving Average
- Common Periods: 20, 50, 100, 200 days
Bollinger Bands
- Upper Band: SMA + (2 × Standard Deviation)
- Middle Band: 20-period SMA
- Lower Band: SMA - (2 × Standard Deviation)
ADX (Average Directional Index)
- Range: 0-100
- Strong Trend: > 25
- Weak Trend: < 20
Volume Indicators
OBV (On-Balance Volume)
- Confirms: Price trends with volume
- Divergence: Price vs OBV direction
Volume SMA
- Above Average: High interest
- Below Average: Low interest
Signal Interpretation
Buy Signals
- RSI crosses above 30 (oversold recovery)
- MACD line crosses above signal line
- Price breaks above resistance with volume
- Golden Cross (50-day MA > 200-day MA)
Sell Signals
- RSI crosses below 70 (overbought correction)
- MACD line crosses below signal line
- Price breaks below support with volume
- Death Cross (50-day MA < 200-day MA)
Neutral Signals
- RSI between 30-70
- MACD histogram near zero
- Price consolidating between support/resistance
Pattern Recognition
Bullish Patterns
Golden Cross, Cup & Handle, Ascending Triangle
Bearish Patterns
Death Cross, Head & Shoulders, Descending Triangle
Reversal Patterns
Double Top/Bottom, Triple Top/Bottom, Wedges
Continuation Patterns
Flags, Pennants, Rectangles, Symmetrical Triangles
Multi-Timeframe Analysis
class TechnicalAnalyzer {
constructor(apiKey) {
this.apiKey = apiKey;
this.baseUrl = 'https://api.financialcontext.com';
}
async getMultiTimeframeAnalysis(symbol) {
const timeframes = ['1d', '1wk', '1mo'];
const analyses = {};
for (const interval of timeframes) {
const response = await fetch(
`${this.baseUrl}/api/technicals/${symbol}?interval=${interval}`,
{ headers: { 'X-API-Key': this.apiKey } }
);
const data = await response.json();
analyses[interval] = data.data;
}
return this.consolidateSignals(analyses);
}
consolidateSignals(analyses) {
const signals = Object.values(analyses).map(a => a.summary.recommendation);
const bullishCount = signals.filter(s => s === 'BUY').length;
const bearishCount = signals.filter(s => s === 'SELL').length;
if (bullishCount > bearishCount) return 'BULLISH';
if (bearishCount > bullishCount) return 'BEARISH';
return 'NEUTRAL';
}
}
// Usage
const analyzer = new TechnicalAnalyzer('your-api-key');
const analysis = await analyzer.getMultiTimeframeAnalysis('AAPL');
console.log('Overall Signal:', analysis);
Custom Indicator Combinations
Trend Following Strategy
function trendFollowingSignal(indicators) {
const { sma, macd, adx } = indicators;
// Strong trend with momentum
if (adx.value > 25 &&
macd.signal === 'BUY' &&
sma.signal === 'BUY') {
return { signal: 'STRONG_BUY', confidence: 0.9 };
}
// Weak trend
if (adx.value < 20) {
return { signal: 'NEUTRAL', confidence: 0.3 };
}
return { signal: 'HOLD', confidence: 0.5 };
}
Mean Reversion Strategy
function meanReversionSignal(indicators) {
const { rsi, bollinger } = indicators;
// Oversold at lower band
if (rsi.value < 30 &&
indicators.price < bollinger.lower) {
return { signal: 'BUY', confidence: 0.8 };
}
// Overbought at upper band
if (rsi.value > 70 &&
indicators.price > bollinger.upper) {
return { signal: 'SELL', confidence: 0.8 };
}
return { signal: 'NEUTRAL', confidence: 0.4 };
}
Backtesting Support
import requests
import pandas as pd
def backtest_strategy(symbol, start_date, end_date):
# Get historical technical data
url = f"https://api.financialcontext.com/api/technicals/{symbol}"
params = {
'interval': '1d',
'from': start_date,
'to': end_date,
'indicators': 'rsi,macd,sma'
}
response = requests.get(url, params=params,
headers={'X-API-Key': 'your-api-key'})
data = response.json()['data']
# Convert to DataFrame for analysis
df = pd.DataFrame(data['historical'])
# Apply strategy logic
df['signal'] = df.apply(lambda row:
'BUY' if row['rsi'] < 30 and row['macd_signal'] == 'BUY'
else 'SELL' if row['rsi'] > 70 and row['macd_signal'] == 'SELL'
else 'HOLD', axis=1)
return calculate_returns(df)
Best Practices
Signal Confirmation
- Use multiple indicators for confirmation
- Consider different timeframes
- Validate with volume analysis
- Account for market conditions
Risk Management
- Set stop-loss levels based on technical levels
- Use position sizing based on volatility
- Monitor correlation between signals
- Regular strategy performance review
Technical analysis should be combined with fundamental analysis and proper risk management. Past performance does not guarantee future results.
All technical indicators are calculated using standard formulas and periods. Custom periods and parameters can be specified in API requests.