Initial commit
This commit is contained in:
348
commands/openbb-crypto.md
Normal file
348
commands/openbb-crypto.md
Normal file
@@ -0,0 +1,348 @@
|
||||
---
|
||||
name: openbb-crypto
|
||||
description: Cryptocurrency market analysis using OpenBB - price data, on-chain metrics, DeFi analytics, whale tracking, and market sentiment
|
||||
---
|
||||
|
||||
# OpenBB Cryptocurrency Analysis
|
||||
|
||||
Comprehensive cryptocurrency analysis using OpenBB Platform's crypto data sources.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
/openbb-crypto SYMBOL [--vs USD|BTC|ETH] [--metrics on-chain|defi|social] [--period 30d]
|
||||
```
|
||||
|
||||
## What This Command Does
|
||||
|
||||
Analyzes cryptocurrency markets with price data, on-chain metrics, DeFi analytics, and sentiment analysis.
|
||||
|
||||
## Workflow
|
||||
|
||||
### 1. Setup OpenBB Connection
|
||||
|
||||
```python
|
||||
from openbb import obb
|
||||
import pandas as pd
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
# Parse arguments
|
||||
symbol = sys.argv[1].upper() if len(sys.argv) > 1 else "BTC"
|
||||
vs_currency = "USD" # USD, BTC, ETH
|
||||
metrics_type = "all" # on-chain, defi, social, all
|
||||
period = "30d" # 7d, 30d, 90d, 1y
|
||||
|
||||
# Parse flags
|
||||
for arg in sys.argv[2:]:
|
||||
if arg.startswith("--vs="):
|
||||
vs_currency = arg.split("=")[1].upper()
|
||||
elif arg.startswith("--metrics="):
|
||||
metrics_type = arg.split("=")[1]
|
||||
elif arg.startswith("--period="):
|
||||
period = arg.split("=")[1]
|
||||
```
|
||||
|
||||
### 2. Retrieve Price Data
|
||||
|
||||
```python
|
||||
# Get historical crypto prices
|
||||
crypto_data = obb.crypto.price.historical(
|
||||
symbol=f"{symbol}{vs_currency}",
|
||||
interval="1d",
|
||||
period=period
|
||||
)
|
||||
|
||||
df = crypto_data.to_dataframe()
|
||||
|
||||
print(f"\n₿ Crypto Analysis: {symbol}/{vs_currency}")
|
||||
print(f"{'='*60}")
|
||||
|
||||
current_price = df['close'].iloc[-1]
|
||||
period_high = df['high'].max()
|
||||
period_low = df['low'].min()
|
||||
period_return = ((current_price / df['close'].iloc[0]) - 1) * 100
|
||||
|
||||
print(f"\n💰 Price Overview:")
|
||||
print(f"Current Price: ${current_price:,.2f}")
|
||||
print(f"{period} High: ${period_high:,.2f}")
|
||||
print(f"{period} Low: ${period_low:,.2f}")
|
||||
print(f"{period} Return: {period_return:+.2f}%")
|
||||
print(f"24h Volume: ${df['volume'].iloc[-1]:,.0f}")
|
||||
```
|
||||
|
||||
### 3. Technical Indicators
|
||||
|
||||
```python
|
||||
# Calculate crypto-specific indicators
|
||||
print(f"\n📊 Technical Indicators:")
|
||||
|
||||
# Moving averages
|
||||
df['MA_7'] = df['close'].rolling(window=7).mean()
|
||||
df['MA_30'] = df['close'].rolling(window=30).mean()
|
||||
df['MA_90'] = df['close'].rolling(window=90).mean()
|
||||
|
||||
ma_7 = df['MA_7'].iloc[-1]
|
||||
ma_30 = df['MA_30'].iloc[-1]
|
||||
ma_90 = df['MA_90'].iloc[-1]
|
||||
|
||||
print(f"MA 7: ${ma_7:,.2f} {'🟢' if current_price > ma_7 else '🔴'}")
|
||||
print(f"MA 30: ${ma_30:,.2f} {'🟢' if current_price > ma_30 else '🔴'}")
|
||||
print(f"MA 90: ${ma_90:,.2f} {'🟢' if current_price > ma_90 else '🔴'}")
|
||||
|
||||
# Volatility
|
||||
returns = df['close'].pct_change()
|
||||
volatility = returns.std() * (365 ** 0.5) * 100 # Annualized
|
||||
|
||||
print(f"\nVolatility (ann.): {volatility:.1f}%")
|
||||
|
||||
# RSI
|
||||
delta = df['close'].diff()
|
||||
gain = delta.where(delta > 0, 0).rolling(window=14).mean()
|
||||
loss = -delta.where(delta < 0, 0).rolling(window=14).mean()
|
||||
rs = gain / loss
|
||||
df['RSI'] = 100 - (100 / (1 + rs))
|
||||
rsi = df['RSI'].iloc[-1]
|
||||
|
||||
print(f"RSI (14): {rsi:.1f}")
|
||||
if rsi > 70:
|
||||
print(" ⚠️ Overbought - potential sell signal")
|
||||
elif rsi < 30:
|
||||
print(" 🟢 Oversold - potential buy signal")
|
||||
```
|
||||
|
||||
### 4. On-Chain Metrics (if available)
|
||||
|
||||
```python
|
||||
if metrics_type in ["on-chain", "all"]:
|
||||
print(f"\n⛓️ On-Chain Metrics:")
|
||||
|
||||
try:
|
||||
# Network activity
|
||||
network_data = obb.crypto.onchain.active_addresses(symbol=symbol)
|
||||
print(f"Active Addresses (24h): {network_data.active_addresses:,}")
|
||||
print(f"Transaction Count: {network_data.tx_count:,}")
|
||||
print(f"Transaction Volume: ${network_data.tx_volume:,.0f}")
|
||||
|
||||
# Hash rate (for PoW coins)
|
||||
if symbol in ["BTC", "ETH", "LTC", "DOGE"]:
|
||||
hash_data = obb.crypto.onchain.hashrate(symbol=symbol)
|
||||
print(f"\nHash Rate: {hash_data.hashrate / 1e18:.2f} EH/s")
|
||||
print(f"Mining Difficulty: {hash_data.difficulty:,.0f}")
|
||||
|
||||
# Holder distribution
|
||||
holders = obb.crypto.onchain.holders(symbol=symbol)
|
||||
print(f"\nTop 10 Holders: {holders.top_10_pct:.1f}%")
|
||||
print(f"Top 100 Holders: {holders.top_100_pct:.1f}%")
|
||||
|
||||
except Exception as e:
|
||||
print(f"On-chain data not available for {symbol}")
|
||||
```
|
||||
|
||||
### 5. DeFi Metrics (if applicable)
|
||||
|
||||
```python
|
||||
if metrics_type in ["defi", "all"] and symbol in ["ETH", "BNB", "AVAX", "SOL"]:
|
||||
print(f"\n🏦 DeFi Metrics:")
|
||||
|
||||
try:
|
||||
defi_data = obb.crypto.defi.tvl(chain=symbol)
|
||||
print(f"Total Value Locked: ${defi_data.tvl / 1e9:.2f}B")
|
||||
print(f"Protocol Count: {defi_data.protocol_count}")
|
||||
print(f"Top Protocol: {defi_data.top_protocol}")
|
||||
print(f" - TVL: ${defi_data.top_protocol_tvl / 1e9:.2f}B")
|
||||
|
||||
# Staking data
|
||||
staking = obb.crypto.defi.staking(symbol=symbol)
|
||||
print(f"\nStaking:")
|
||||
print(f"Total Staked: {staking.total_staked_pct:.1f}%")
|
||||
print(f"Avg APY: {staking.avg_apy:.2f}%")
|
||||
except:
|
||||
print(f"DeFi data not available for {symbol}")
|
||||
```
|
||||
|
||||
### 6. Social Sentiment & News
|
||||
|
||||
```python
|
||||
if metrics_type in ["social", "all"]:
|
||||
print(f"\n📱 Social Sentiment:")
|
||||
|
||||
try:
|
||||
social_data = obb.crypto.social.sentiment(symbol=symbol)
|
||||
print(f"Twitter Mentions (24h): {social_data.twitter_mentions:,}")
|
||||
print(f"Reddit Posts (24h): {social_data.reddit_posts:,}")
|
||||
print(f"Sentiment Score: {social_data.sentiment_score:.2f}/5.0")
|
||||
|
||||
sentiment_emoji = "🟢" if social_data.sentiment_score > 3.5 else "🟡" if social_data.sentiment_score > 2.5 else "🔴"
|
||||
print(f"Overall Sentiment: {sentiment_emoji}")
|
||||
|
||||
# Recent news
|
||||
news = obb.crypto.news(symbol=symbol, limit=3)
|
||||
print(f"\n📰 Latest News:")
|
||||
for i, article in enumerate(news[:3], 1):
|
||||
print(f"{i}. {article.title}")
|
||||
print(f" {article.source} - {article.published_date}")
|
||||
except:
|
||||
print("Social/news data not available")
|
||||
```
|
||||
|
||||
### 7. Whale Activity Tracker
|
||||
|
||||
```python
|
||||
print(f"\n🐋 Whale Activity (Large Transfers):")
|
||||
|
||||
try:
|
||||
# Get large transactions (>$100k)
|
||||
whales = obb.crypto.onchain.large_transactions(
|
||||
symbol=symbol,
|
||||
min_value=100000,
|
||||
limit=5
|
||||
)
|
||||
|
||||
if len(whales) > 0:
|
||||
print(f"Last {len(whales)} large transfers:")
|
||||
for tx in whales:
|
||||
print(f" ${tx.value_usd:,.0f} - {tx.from_address[:10]}...→ {tx.to_address[:10]}...")
|
||||
print(f" {tx.timestamp} ({tx.exchange if tx.exchange else 'Unknown'})")
|
||||
else:
|
||||
print("No significant whale activity detected")
|
||||
except:
|
||||
print("Whale tracking not available")
|
||||
```
|
||||
|
||||
### 8. AI-Powered Market Analysis
|
||||
|
||||
```python
|
||||
print(f"\n🤖 AI Market Analysis for {symbol}:")
|
||||
print(f"\n📈 Trend Analysis:")
|
||||
|
||||
# Determine trend
|
||||
if current_price > ma_7 > ma_30 > ma_90:
|
||||
trend = "Strong Uptrend"
|
||||
trend_emoji = "🚀"
|
||||
elif current_price > ma_30:
|
||||
trend = "Bullish"
|
||||
trend_emoji = "📈"
|
||||
elif current_price < ma_7 < ma_30 < ma_90:
|
||||
trend = "Strong Downtrend"
|
||||
trend_emoji = "📉"
|
||||
else:
|
||||
trend = "Consolidating"
|
||||
trend_emoji = "↔️"
|
||||
|
||||
print(f"{trend_emoji} Market Trend: {trend}")
|
||||
|
||||
# Risk assessment
|
||||
if volatility > 100:
|
||||
risk = "Very High"
|
||||
risk_emoji = "🔴"
|
||||
elif volatility > 60:
|
||||
risk = "High"
|
||||
risk_emoji = "🟡"
|
||||
else:
|
||||
risk = "Moderate"
|
||||
risk_emoji = "🟢"
|
||||
|
||||
print(f"{risk_emoji} Volatility Risk: {risk}")
|
||||
|
||||
# Trading signals
|
||||
print(f"\n💡 Trading Signals:")
|
||||
signals = []
|
||||
|
||||
if rsi < 30:
|
||||
signals.append("🟢 RSI oversold - potential buy zone")
|
||||
if rsi > 70:
|
||||
signals.append("🔴 RSI overbought - consider taking profits")
|
||||
if current_price > ma_30 and returns.iloc[-1] > 0.05:
|
||||
signals.append("🚀 Strong momentum detected")
|
||||
if df['volume'].iloc[-1] > df['volume'].rolling(20).mean().iloc[-1] * 2:
|
||||
signals.append("📊 Unusual volume spike")
|
||||
|
||||
if signals:
|
||||
for signal in signals:
|
||||
print(f" {signal}")
|
||||
else:
|
||||
print(" No strong signals detected - market in equilibrium")
|
||||
```
|
||||
|
||||
### 9. Price Targets & Support/Resistance
|
||||
|
||||
```python
|
||||
print(f"\n🎯 Key Levels:")
|
||||
|
||||
# Calculate support and resistance
|
||||
high_30d = df['high'].tail(30).max()
|
||||
low_30d = df['low'].tail(30).min()
|
||||
pivot = (high_30d + low_30d + current_price) / 3
|
||||
|
||||
resistance_1 = 2 * pivot - low_30d
|
||||
support_1 = 2 * pivot - high_30d
|
||||
|
||||
print(f"Resistance: ${resistance_1:,.2f} ({((resistance_1/current_price - 1) * 100):+.1f}%)")
|
||||
print(f"Current: ${current_price:,.2f}")
|
||||
print(f"Support: ${support_1:,.2f} ({((support_1/current_price - 1) * 100):+.1f}%)")
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### Basic crypto analysis
|
||||
```bash
|
||||
/openbb-crypto BTC
|
||||
```
|
||||
|
||||
### Ethereum DeFi metrics
|
||||
```bash
|
||||
/openbb-crypto ETH --metrics=defi
|
||||
```
|
||||
|
||||
### Altcoin vs BTC
|
||||
```bash
|
||||
/openbb-crypto LINK --vs=BTC --period=90d
|
||||
```
|
||||
|
||||
### Social sentiment check
|
||||
```bash
|
||||
/openbb-crypto DOGE --metrics=social
|
||||
```
|
||||
|
||||
## Supported Cryptocurrencies
|
||||
|
||||
- **Major**: BTC, ETH, BNB, SOL, ADA, XRP, DOT, AVAX
|
||||
- **DeFi**: UNI, AAVE, LINK, COMP, MKR, SNX
|
||||
- **Meme**: DOGE, SHIB, PEPE
|
||||
- **Layer 2**: MATIC, ARB, OP
|
||||
- **1000+ more via OpenBB data providers**
|
||||
|
||||
## Data Sources
|
||||
|
||||
- Price data: Multiple exchanges (Binance, Coinbase, etc.)
|
||||
- On-chain: Glassnode, Santiment, IntoTheBlock
|
||||
- DeFi: DeFi Llama, The Graph
|
||||
- Social: LunarCrush, Santiment
|
||||
|
||||
## Tips
|
||||
|
||||
1. **Compare to BTC**: Use `--vs=BTC` to see altcoin strength vs Bitcoin
|
||||
2. **Track Whales**: Monitor large transfers for market-moving activity
|
||||
3. **DeFi Context**: Check TVL and staking for ecosystem health
|
||||
4. **Sentiment Analysis**: Social metrics can predict short-term moves
|
||||
5. **Correlation**: Compare multiple cryptos to find divergences
|
||||
|
||||
## Integration
|
||||
|
||||
```bash
|
||||
# Portfolio tracking
|
||||
/openbb-portfolio --add-crypto=BTC,ETH,SOL
|
||||
|
||||
# Compare with equity markets
|
||||
/openbb-macro --crypto-correlation
|
||||
|
||||
# AI research
|
||||
/openbb-research --crypto --symbol=BTC
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- Cryptocurrency markets are 24/7
|
||||
- High volatility - use appropriate risk management
|
||||
- Not financial advice - DYOR (Do Your Own Research)
|
||||
- Consider transaction costs and slippage for trading
|
||||
267
commands/openbb-equity.md
Normal file
267
commands/openbb-equity.md
Normal file
@@ -0,0 +1,267 @@
|
||||
---
|
||||
name: openbb-equity
|
||||
description: Comprehensive equity analysis using OpenBB - historical prices, fundamentals, technical indicators, insider trading, analyst ratings, and AI-powered insights
|
||||
---
|
||||
|
||||
# OpenBB Equity Analysis
|
||||
|
||||
Perform comprehensive stock analysis using the OpenBB Platform.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
/openbb-equity TICKER [--analysis fundamental|technical|all] [--period 1y]
|
||||
```
|
||||
|
||||
## What This Command Does
|
||||
|
||||
Retrieves and analyzes equity data for any stock ticker using OpenBB's comprehensive data sources.
|
||||
|
||||
## Workflow
|
||||
|
||||
### 1. Check OpenBB Installation
|
||||
|
||||
First, verify OpenBB is installed:
|
||||
|
||||
```python
|
||||
try:
|
||||
from openbb import obb
|
||||
print("✅ OpenBB installed")
|
||||
except ImportError:
|
||||
print("⚠️ Installing OpenBB...")
|
||||
import subprocess
|
||||
subprocess.run(["pip", "install", "openbb"], check=True)
|
||||
from openbb import obb
|
||||
```
|
||||
|
||||
### 2. Parse Arguments
|
||||
|
||||
```python
|
||||
# Parse user input
|
||||
import sys
|
||||
ticker = sys.argv[1].upper() if len(sys.argv) > 1 else "AAPL"
|
||||
analysis_type = "all" # fundamental, technical, or all
|
||||
period = "1y" # 1d, 1w, 1m, 3m, 6m, 1y, 5y
|
||||
|
||||
# Parse flags
|
||||
for arg in sys.argv[2:]:
|
||||
if arg.startswith("--analysis="):
|
||||
analysis_type = arg.split("=")[1]
|
||||
elif arg.startswith("--period="):
|
||||
period = arg.split("=")[1]
|
||||
```
|
||||
|
||||
### 3. Retrieve Historical Price Data
|
||||
|
||||
```python
|
||||
# Get historical prices
|
||||
price_data = obb.equity.price.historical(
|
||||
symbol=ticker,
|
||||
interval="1d",
|
||||
period=period
|
||||
)
|
||||
|
||||
df = price_data.to_dataframe()
|
||||
print(f"\n📈 Historical Prices for {ticker}")
|
||||
print(f"Period: {period}")
|
||||
print(f"Latest Close: ${df['close'].iloc[-1]:.2f}")
|
||||
print(f"52-Week High: ${df['high'].max():.2f}")
|
||||
print(f"52-Week Low: ${df['low'].min():.2f}")
|
||||
print(f"YTD Return: {((df['close'].iloc[-1] / df['close'].iloc[0]) - 1) * 100:.2f}%")
|
||||
```
|
||||
|
||||
### 4. Fundamental Analysis (if requested)
|
||||
|
||||
```python
|
||||
if analysis_type in ["fundamental", "all"]:
|
||||
print(f"\n📊 Fundamental Analysis for {ticker}")
|
||||
|
||||
# Company profile
|
||||
try:
|
||||
profile = obb.equity.profile(symbol=ticker)
|
||||
print(f"\nCompany: {profile.name}")
|
||||
print(f"Sector: {profile.sector}")
|
||||
print(f"Industry: {profile.industry}")
|
||||
print(f"Market Cap: ${profile.market_cap / 1e9:.2f}B")
|
||||
except:
|
||||
print("Profile data not available")
|
||||
|
||||
# Financial metrics
|
||||
try:
|
||||
metrics = obb.equity.fundamental.metrics(symbol=ticker)
|
||||
print(f"\nKey Metrics:")
|
||||
print(f"P/E Ratio: {metrics.pe_ratio:.2f}")
|
||||
print(f"EPS: ${metrics.eps:.2f}")
|
||||
print(f"Dividend Yield: {metrics.dividend_yield:.2%}")
|
||||
print(f"ROE: {metrics.roe:.2%}")
|
||||
except:
|
||||
print("Metrics data not available")
|
||||
|
||||
# Analyst ratings
|
||||
try:
|
||||
ratings = obb.equity.estimates.analyst(symbol=ticker)
|
||||
print(f"\nAnalyst Consensus:")
|
||||
print(f"Buy: {ratings.buy_count}")
|
||||
print(f"Hold: {ratings.hold_count}")
|
||||
print(f"Sell: {ratings.sell_count}")
|
||||
print(f"Target Price: ${ratings.target_price:.2f}")
|
||||
except:
|
||||
print("Analyst ratings not available")
|
||||
```
|
||||
|
||||
### 5. Technical Analysis (if requested)
|
||||
|
||||
```python
|
||||
if analysis_type in ["technical", "all"]:
|
||||
print(f"\n📉 Technical Analysis for {ticker}")
|
||||
|
||||
# Calculate technical indicators
|
||||
import pandas as pd
|
||||
|
||||
# Simple Moving Averages
|
||||
df['SMA_20'] = df['close'].rolling(window=20).mean()
|
||||
df['SMA_50'] = df['close'].rolling(window=50).mean()
|
||||
df['SMA_200'] = df['close'].rolling(window=200).mean()
|
||||
|
||||
current_price = df['close'].iloc[-1]
|
||||
sma_20 = df['SMA_20'].iloc[-1]
|
||||
sma_50 = df['SMA_50'].iloc[-1]
|
||||
sma_200 = df['SMA_200'].iloc[-1]
|
||||
|
||||
print(f"\nMoving Averages:")
|
||||
print(f"Current Price: ${current_price:.2f}")
|
||||
print(f"SMA 20: ${sma_20:.2f} {'🟢' if current_price > sma_20 else '🔴'}")
|
||||
print(f"SMA 50: ${sma_50:.2f} {'🟢' if current_price > sma_50 else '🔴'}")
|
||||
print(f"SMA 200: ${sma_200:.2f} {'🟢' if current_price > sma_200 else '🔴'}")
|
||||
|
||||
# RSI calculation
|
||||
delta = df['close'].diff()
|
||||
gain = (delta.where(delta > 0, 0)).rolling(window=14).mean()
|
||||
loss = (-delta.where(delta < 0, 0)).rolling(window=14).mean()
|
||||
rs = gain / loss
|
||||
df['RSI'] = 100 - (100 / (1 + rs))
|
||||
|
||||
rsi = df['RSI'].iloc[-1]
|
||||
print(f"\nRSI (14): {rsi:.2f}")
|
||||
if rsi > 70:
|
||||
print("⚠️ Overbought territory")
|
||||
elif rsi < 30:
|
||||
print("🟢 Oversold territory - potential buy")
|
||||
else:
|
||||
print("Neutral zone")
|
||||
|
||||
# Volume analysis
|
||||
avg_volume = df['volume'].rolling(window=20).mean().iloc[-1]
|
||||
current_volume = df['volume'].iloc[-1]
|
||||
print(f"\nVolume:")
|
||||
print(f"Current: {current_volume:,.0f}")
|
||||
print(f"20-day Avg: {avg_volume:,.0f}")
|
||||
print(f"Relative: {(current_volume / avg_volume):.2f}x")
|
||||
```
|
||||
|
||||
### 6. AI-Powered Insights
|
||||
|
||||
Generate investment insights using Claude's analysis:
|
||||
|
||||
```python
|
||||
# Prepare summary for AI analysis
|
||||
summary = {
|
||||
"ticker": ticker,
|
||||
"current_price": current_price,
|
||||
"52w_high": df['high'].max(),
|
||||
"52w_low": df['low'].min(),
|
||||
"ytd_return": ((df['close'].iloc[-1] / df['close'].iloc[0]) - 1) * 100,
|
||||
"technical": {
|
||||
"sma_position": "bullish" if current_price > sma_200 else "bearish",
|
||||
"rsi": rsi,
|
||||
"volume_trend": "high" if current_volume > avg_volume else "normal"
|
||||
}
|
||||
}
|
||||
|
||||
print(f"\n🤖 AI Analysis for {ticker}:")
|
||||
print("\nBased on the data above, here's my assessment:")
|
||||
print(f"- Trend: {'Bullish' if current_price > sma_200 else 'Bearish'} (price {'above' if current_price > sma_200 else 'below'} 200-day SMA)")
|
||||
print(f"- Momentum: {'Overbought' if rsi > 70 else 'Oversold' if rsi < 30 else 'Neutral'} (RSI: {rsi:.1f})")
|
||||
print(f"- Volume: {'Elevated' if current_volume > avg_volume * 1.5 else 'Normal'} trading activity")
|
||||
print(f"\n💡 Recommendation: Consider {summary} in context of your investment strategy and risk tolerance.")
|
||||
```
|
||||
|
||||
### 7. Generate Report
|
||||
|
||||
Create a formatted analysis report:
|
||||
|
||||
```python
|
||||
print(f"\n{'='*60}")
|
||||
print(f"EQUITY ANALYSIS REPORT: {ticker}")
|
||||
print(f"{'='*60}")
|
||||
print(f"Generated: {pd.Timestamp.now().strftime('%Y-%m-%d %H:%M:%S')}")
|
||||
print(f"Data Source: OpenBB Platform")
|
||||
print(f"\nAnalysis Type: {analysis_type.upper()}")
|
||||
print(f"Period Analyzed: {period}")
|
||||
print(f"\n{'='*60}")
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### Basic equity analysis
|
||||
```bash
|
||||
/openbb-equity AAPL
|
||||
```
|
||||
|
||||
### Fundamental analysis only
|
||||
```bash
|
||||
/openbb-equity TSLA --analysis=fundamental
|
||||
```
|
||||
|
||||
### Technical analysis with custom period
|
||||
```bash
|
||||
/openbb-equity NVDA --analysis=technical --period=6m
|
||||
```
|
||||
|
||||
### Complete analysis
|
||||
```bash
|
||||
/openbb-equity GOOGL --analysis=all --period=1y
|
||||
```
|
||||
|
||||
## Data Coverage
|
||||
|
||||
- **Price Data**: Historical OHLCV, real-time quotes
|
||||
- **Fundamentals**: Income statements, balance sheets, cash flow, ratios
|
||||
- **Technical**: SMA, EMA, RSI, MACD, Bollinger Bands, volume
|
||||
- **Analyst Data**: Ratings, price targets, recommendations
|
||||
- **Insider Trading**: Recent insider transactions
|
||||
- **News**: Latest company news and sentiment
|
||||
|
||||
## Tips
|
||||
|
||||
1. **Compare Multiple Stocks**: Run for different tickers to compare
|
||||
2. **Track Over Time**: Save reports to monitor changes
|
||||
3. **Combine with AI Agents**: Use with equity-analyst agent for deeper insights
|
||||
4. **Export Data**: Save dataframes to CSV for further analysis
|
||||
5. **Set Alerts**: Monitor key technical levels (support/resistance)
|
||||
|
||||
## Integration with Other Commands
|
||||
|
||||
```bash
|
||||
# Compare with crypto
|
||||
/openbb-crypto BTC --compare=equity
|
||||
|
||||
# Portfolio context
|
||||
/openbb-portfolio --add=AAPL
|
||||
|
||||
# Macro correlation
|
||||
/openbb-macro --impact=equity
|
||||
```
|
||||
|
||||
## Requirements
|
||||
|
||||
- OpenBB Platform installed (`pip install openbb`)
|
||||
- Python 3.9.21 - 3.12
|
||||
- Optional: API keys for premium data providers (configured in OpenBB)
|
||||
|
||||
## Notes
|
||||
|
||||
- Free tier provides delayed data (15-20 minutes)
|
||||
- Premium data requires API keys (configured via `obb.user.credentials`)
|
||||
- All financial data is for informational purposes only
|
||||
- Not financial advice - always do your own research
|
||||
92
commands/openbb-macro.md
Normal file
92
commands/openbb-macro.md
Normal file
@@ -0,0 +1,92 @@
|
||||
---
|
||||
name: openbb-macro
|
||||
description: Macroeconomic analysis using OpenBB - GDP, inflation, interest rates, employment, global economic indicators
|
||||
---
|
||||
|
||||
# OpenBB Macroeconomic Analysis
|
||||
|
||||
Analyze global macroeconomic trends and indicators using OpenBB Platform.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
/openbb-macro [--country US|UK|EU|CN|JP] [--indicators gdp|inflation|rates|employment|all]
|
||||
```
|
||||
|
||||
## What This Command Does
|
||||
|
||||
Retrieves and analyzes macroeconomic indicators to understand economic trends and market implications.
|
||||
|
||||
## Key Features
|
||||
|
||||
### Economic Indicators
|
||||
- **GDP**: Growth rates, forecasts, components
|
||||
- **Inflation**: CPI, PPI, PCE, core inflation
|
||||
- **Interest Rates**: Federal funds, treasury yields, central bank rates
|
||||
- **Employment**: Unemployment, NFP, job openings, labor participation
|
||||
- **Consumer**: Confidence, spending, retail sales
|
||||
- **Manufacturing**: PMI, industrial production, capacity utilization
|
||||
|
||||
### Workflow
|
||||
|
||||
```python
|
||||
from openbb import obb
|
||||
|
||||
# GDP Analysis
|
||||
gdp_data = obb.economy.gdp(country="US")
|
||||
print(f"GDP Growth: {gdp_data.growth_rate:.2f}%")
|
||||
print(f"GDP per Capita: ${gdp_data.gdp_per_capita:,.0f}")
|
||||
|
||||
# Inflation Data
|
||||
cpi = obb.economy.cpi(country="US")
|
||||
print(f"CPI (YoY): {cpi.yoy_change:.2f}%")
|
||||
print(f"Core CPI: {cpi.core_cpi:.2f}%")
|
||||
|
||||
# Interest Rates
|
||||
rates = obb.economy.fed_rates()
|
||||
print(f"Fed Funds Rate: {rates.current_rate:.2f}%")
|
||||
print(f"10Y Treasury: {rates.treasury_10y:.2f}%")
|
||||
|
||||
# Employment
|
||||
employment = obb.economy.employment()
|
||||
print(f"Unemployment Rate: {employment.unemployment_rate:.1f}%")
|
||||
print(f"NFP (last month): {employment.nfp_change:+,}")
|
||||
```
|
||||
|
||||
### Market Impact Analysis
|
||||
|
||||
```python
|
||||
# Analyze impact on markets
|
||||
print("\n💡 Market Implications:")
|
||||
|
||||
if cpi.yoy_change > 3.0:
|
||||
print("⚠️ High inflation - Fed likely to maintain hawkish stance")
|
||||
print(" → Negative for growth stocks, positive for commodities")
|
||||
|
||||
if employment.unemployment_rate < 4.0:
|
||||
print("🔥 Tight labor market - wage pressures building")
|
||||
print(" → Could sustain inflation, support consumer stocks")
|
||||
|
||||
if rates.current_rate > 5.0:
|
||||
print("💸 High interest rates - restrictive monetary policy")
|
||||
print(" → Headwind for equities, tailwind for bonds")
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
```bash
|
||||
# US macro overview
|
||||
/openbb-macro --country=US --indicators=all
|
||||
|
||||
# UK inflation focus
|
||||
/openbb-macro --country=UK --indicators=inflation
|
||||
|
||||
# China GDP analysis
|
||||
/openbb-macro --country=CN --indicators=gdp
|
||||
```
|
||||
|
||||
## Integration
|
||||
|
||||
- Correlate with equity performance via `/openbb-equity`
|
||||
- Impact crypto markets via `/openbb-crypto`
|
||||
- Portfolio positioning via `/openbb-portfolio`
|
||||
88
commands/openbb-options.md
Normal file
88
commands/openbb-options.md
Normal file
@@ -0,0 +1,88 @@
|
||||
---
|
||||
name: openbb-options
|
||||
description: Options analysis using OpenBB - chain data, Greeks, implied volatility, strategies, unusual activity
|
||||
---
|
||||
|
||||
# OpenBB Options Analysis
|
||||
|
||||
Options chain analysis, Greeks calculations, and strategy optimization using OpenBB Platform.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
/openbb-options TICKER [--strategy covered-call|put|spread] [--expiry 30d]
|
||||
```
|
||||
|
||||
## Key Features
|
||||
|
||||
### Options Data
|
||||
- Options chains (calls/puts, all strikes)
|
||||
- Greeks (Delta, Gamma, Theta, Vega, Rho)
|
||||
- Implied volatility smile/skew
|
||||
- Open interest and volume analysis
|
||||
- Unusual options activity
|
||||
|
||||
### Workflow
|
||||
|
||||
```python
|
||||
from openbb import obb
|
||||
|
||||
ticker = "AAPL"
|
||||
expiry = "2024-12-20"
|
||||
|
||||
# Get options chain
|
||||
chain = obb.derivatives.options.chains(symbol=ticker, expiration=expiry)
|
||||
|
||||
# Analyze call options
|
||||
calls = chain[chain['option_type'] == 'call']
|
||||
print(f"\n📞 Call Options for {ticker} (Exp: {expiry})")
|
||||
print(f"{'Strike':>8} {'Last':>8} {'IV':>8} {'Delta':>8} {'OI':>10} {'Volume':>10}")
|
||||
|
||||
for _, opt in calls.iterrows():
|
||||
print(f"${opt['strike']:>7.2f} ${opt['last']:>7.2f} {opt['iv']:>7.1f}% "
|
||||
f"{opt['delta']:>7.3f} {opt['open_interest']:>9,} {opt['volume']:>9,}")
|
||||
|
||||
# Greeks summary
|
||||
print(f"\n🔢 Portfolio Greeks:")
|
||||
print(f"Net Delta: {calls['delta'].sum():.2f}")
|
||||
print(f"Net Gamma: {calls['gamma'].sum():.4f}")
|
||||
print(f"Net Theta: {calls['theta'].sum():.2f} (daily decay)")
|
||||
print(f"Net Vega: {calls['vega'].sum():.2f} (per 1% IV move)")
|
||||
```
|
||||
|
||||
### Strategy Analysis
|
||||
|
||||
```python
|
||||
# Covered Call Strategy
|
||||
stock_price = obb.equity.price.quote(symbol=ticker).price
|
||||
strike = stock_price * 1.05 # 5% OTM
|
||||
|
||||
call_premium = chain[(chain['strike'] == strike) & (chain['option_type'] == 'call')]['last'].iloc[0]
|
||||
|
||||
print(f"\n📊 Covered Call Strategy ({ticker}):")
|
||||
print(f"Stock Price: ${stock_price:.2f}")
|
||||
print(f"Sell Call: ${strike:.2f} strike")
|
||||
print(f"Premium: ${call_premium:.2f}")
|
||||
print(f"Max Profit: ${(strike - stock_price + call_premium):.2f} ({((strike - stock_price + call_premium) / stock_price * 100):.1f}%)")
|
||||
print(f"Breakeven: ${(stock_price - call_premium):.2f}")
|
||||
```
|
||||
|
||||
### Unusual Activity
|
||||
|
||||
```python
|
||||
# Detect unusual options activity
|
||||
unusual = chain[chain['volume'] > chain['open_interest'] * 2]
|
||||
print(f"\n🚨 Unusual Activity ({len(unusual)} contracts):")
|
||||
|
||||
for _, opt in unusual.head(5).iterrows():
|
||||
print(f"{opt['option_type'].upper()} ${opt['strike']:.2f} - "
|
||||
f"Vol: {opt['volume']:,} (OI: {opt['open_interest']:,})")
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
```bash
|
||||
/openbb-options SPY --strategy=covered-call
|
||||
/openbb-options TSLA --expiry=14d
|
||||
/openbb-options NVDA --unusual-activity
|
||||
```
|
||||
155
commands/openbb-portfolio.md
Normal file
155
commands/openbb-portfolio.md
Normal file
@@ -0,0 +1,155 @@
|
||||
---
|
||||
name: openbb-portfolio
|
||||
description: Portfolio analysis and optimization using OpenBB - performance tracking, risk metrics, asset allocation, rebalancing
|
||||
---
|
||||
|
||||
# OpenBB Portfolio Analysis
|
||||
|
||||
Comprehensive portfolio management and optimization using OpenBB Platform.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
/openbb-portfolio [--analyze] [--optimize] [--benchmark SPY]
|
||||
```
|
||||
|
||||
## What This Command Does
|
||||
|
||||
Analyzes portfolio performance, calculates risk metrics, and provides optimization recommendations.
|
||||
|
||||
## Key Features
|
||||
|
||||
### Portfolio Metrics
|
||||
- **Returns**: Total return, annualized, Sharpe ratio, Sortino ratio
|
||||
- **Risk**: Volatility, max drawdown, VaR, conditional VaR
|
||||
- **Allocation**: Asset mix, sector exposure, geographic distribution
|
||||
- **Performance Attribution**: Contribution analysis by position
|
||||
|
||||
### Workflow
|
||||
|
||||
```python
|
||||
from openbb import obb
|
||||
import pandas as pd
|
||||
|
||||
# Define portfolio (can load from file or define inline)
|
||||
portfolio = {
|
||||
"AAPL": {"shares": 50, "cost_basis": 150.00},
|
||||
"MSFT": {"shares": 30, "cost_basis": 300.00},
|
||||
"GOOGL": {"shares": 20, "cost_basis": 2500.00},
|
||||
"BTC-USD": {"shares": 0.5, "cost_basis": 45000.00}
|
||||
}
|
||||
|
||||
# Calculate current values
|
||||
total_value = 0
|
||||
positions = []
|
||||
|
||||
for symbol, data in portfolio.items():
|
||||
current_price = obb.equity.price.quote(symbol=symbol).price
|
||||
position_value = current_price * data["shares"]
|
||||
total_value += position_value
|
||||
|
||||
pnl = (current_price - data["cost_basis"]) * data["shares"]
|
||||
pnl_pct = (current_price / data["cost_basis"] - 1) * 100
|
||||
|
||||
positions.append({
|
||||
"symbol": symbol,
|
||||
"shares": data["shares"],
|
||||
"cost_basis": data["cost_basis"],
|
||||
"current_price": current_price,
|
||||
"value": position_value,
|
||||
"pnl": pnl,
|
||||
"pnl_pct": pnl_pct,
|
||||
"weight": 0 # Calculate after total_value known
|
||||
})
|
||||
|
||||
# Calculate weights
|
||||
for pos in positions:
|
||||
pos["weight"] = (pos["value"] / total_value) * 100
|
||||
|
||||
# Display portfolio
|
||||
print(f"\n💼 Portfolio Overview")
|
||||
print(f"{'='*80}")
|
||||
print(f"Total Value: ${total_value:,.2f}\n")
|
||||
print(f"{'Symbol':<10} {'Shares':>10} {'Price':>12} {'Value':>15} {'P/L %':>10} {'Weight':>10}")
|
||||
print(f"{'-'*80}")
|
||||
|
||||
for pos in positions:
|
||||
print(f"{pos['symbol']:<10} {pos['shares']:>10.2f} ${pos['current_price']:>11.2f} "
|
||||
f"${pos['value']:>14.2f} {pos['pnl_pct']:>9.1f}% {pos['weight']:>9.1f}%")
|
||||
```
|
||||
|
||||
### Risk Analysis
|
||||
|
||||
```python
|
||||
# Calculate portfolio-level risk metrics
|
||||
returns = []
|
||||
for symbol in portfolio.keys():
|
||||
hist = obb.equity.price.historical(symbol=symbol, period="1y")
|
||||
returns.append(hist.to_dataframe()['close'].pct_change())
|
||||
|
||||
portfolio_returns = pd.concat(returns, axis=1).mean(axis=1)
|
||||
portfolio_vol = portfolio_returns.std() * (252 ** 0.5) * 100 # Annualized
|
||||
|
||||
# Sharpe Ratio (assuming 4% risk-free rate)
|
||||
risk_free_rate = 0.04
|
||||
sharpe = (portfolio_returns.mean() * 252 - risk_free_rate) / (portfolio_returns.std() * (252 ** 0.5))
|
||||
|
||||
# Max Drawdown
|
||||
cumulative = (1 + portfolio_returns).cumprod()
|
||||
running_max = cumulative.expanding().max()
|
||||
drawdown = (cumulative - running_max) / running_max
|
||||
max_dd = drawdown.min() * 100
|
||||
|
||||
print(f"\n📊 Risk Metrics:")
|
||||
print(f"Annualized Volatility: {portfolio_vol:.2f}%")
|
||||
print(f"Sharpe Ratio: {sharpe:.2f}")
|
||||
print(f"Max Drawdown: {max_dd:.2f}%")
|
||||
```
|
||||
|
||||
### Portfolio Optimization
|
||||
|
||||
```python
|
||||
print(f"\n🎯 Optimization Recommendations:")
|
||||
|
||||
# Diversification score
|
||||
diversification = 100 - max([pos['weight'] for pos in positions])
|
||||
print(f"Diversification Score: {diversification:.0f}/100")
|
||||
|
||||
if diversification < 70:
|
||||
print("⚠️ Portfolio concentrated - consider adding positions")
|
||||
|
||||
# Rebalancing suggestions
|
||||
target_weight = 100 / len(positions)
|
||||
rebalance_needed = []
|
||||
|
||||
for pos in positions:
|
||||
diff = abs(pos['weight'] - target_weight)
|
||||
if diff > 10:
|
||||
action = "Reduce" if pos['weight'] > target_weight else "Increase"
|
||||
rebalance_needed.append(f"{action} {pos['symbol']}: {pos['weight']:.1f}% → {target_weight:.1f}%")
|
||||
|
||||
if rebalance_needed:
|
||||
print(f"\n🔄 Rebalancing Suggestions:")
|
||||
for suggestion in rebalance_needed:
|
||||
print(f" • {suggestion}")
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
```bash
|
||||
# Analyze current portfolio
|
||||
/openbb-portfolio --analyze
|
||||
|
||||
# Optimize allocation
|
||||
/openbb-portfolio --optimize
|
||||
|
||||
# Compare to SPY benchmark
|
||||
/openbb-portfolio --benchmark=SPY
|
||||
```
|
||||
|
||||
## Integration
|
||||
|
||||
- Import positions from CSV/Excel
|
||||
- Export reports to PDF
|
||||
- Sync with brokerage accounts (via supported integrations)
|
||||
- Tax-loss harvesting analysis
|
||||
174
commands/openbb-research.md
Normal file
174
commands/openbb-research.md
Normal file
@@ -0,0 +1,174 @@
|
||||
---
|
||||
name: openbb-research
|
||||
description: AI-powered investment research using OpenBB - comprehensive analysis, thesis generation, risk assessment, actionable insights
|
||||
---
|
||||
|
||||
# OpenBB AI Investment Research
|
||||
|
||||
AI-powered comprehensive investment research combining OpenBB data with Claude's analytical capabilities.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
/openbb-research SYMBOL [--depth deep|quick] [--focus thesis|risks|opportunities]
|
||||
```
|
||||
|
||||
## What This Command Does
|
||||
|
||||
Conducts comprehensive AI-powered investment research by combining multiple OpenBB data sources with advanced analysis.
|
||||
|
||||
## Workflow
|
||||
|
||||
### 1. Data Aggregation
|
||||
|
||||
```python
|
||||
from openbb import obb
|
||||
|
||||
symbol = "AAPL"
|
||||
|
||||
# Gather comprehensive data
|
||||
data = {
|
||||
"price": obb.equity.price.historical(symbol=symbol, period="1y"),
|
||||
"fundamentals": obb.equity.fundamental.metrics(symbol=symbol),
|
||||
"analyst": obb.equity.estimates.analyst(symbol=symbol),
|
||||
"news": obb.equity.news(symbol=symbol, limit=10),
|
||||
"peers": obb.equity.compare.peers(symbol=symbol),
|
||||
"insider": obb.equity.ownership.insider(symbol=symbol)
|
||||
}
|
||||
```
|
||||
|
||||
### 2. Investment Thesis Generation
|
||||
|
||||
```python
|
||||
print(f"\n📋 Investment Thesis for {symbol}")
|
||||
print(f"{'='*60}")
|
||||
|
||||
# Business Analysis
|
||||
print(f"\n1. Business Quality:")
|
||||
print(f" - Competitive moats identified")
|
||||
print(f" - Revenue growth trajectory")
|
||||
print(f" - Margin trends and sustainability")
|
||||
print(f" - Market position and share")
|
||||
|
||||
# Financial Health
|
||||
print(f"\n2. Financial Strength:")
|
||||
print(f" - Balance sheet assessment")
|
||||
print(f" - Cash flow generation")
|
||||
print(f" - Capital allocation efficiency")
|
||||
print(f" - Debt levels and coverage")
|
||||
|
||||
# Valuation
|
||||
print(f"\n3. Valuation Assessment:")
|
||||
print(f" - P/E vs sector average")
|
||||
print(f" - PEG ratio analysis")
|
||||
print(f" - DCF model implications")
|
||||
print(f" - Historical valuation ranges")
|
||||
|
||||
# Catalysts
|
||||
print(f"\n4. Key Catalysts:")
|
||||
print(f" - Upcoming earnings/events")
|
||||
print(f" - Product launches")
|
||||
print(f" - Regulatory developments")
|
||||
print(f" - Industry trends")
|
||||
```
|
||||
|
||||
### 3. Risk Assessment
|
||||
|
||||
```python
|
||||
print(f"\n⚠️ Risk Factors:")
|
||||
|
||||
risks = []
|
||||
|
||||
# Check technical risks
|
||||
if data["price"].rsi[-1] > 75:
|
||||
risks.append("Overbought conditions - potential pullback risk")
|
||||
|
||||
# Check fundamental risks
|
||||
if data["fundamentals"].debt_to_equity > 1.5:
|
||||
risks.append("High leverage - financial risk elevated")
|
||||
|
||||
# Check market risks
|
||||
if data["price"].volatility > 50:
|
||||
risks.append("High volatility - price uncertainty")
|
||||
|
||||
for i, risk in enumerate(risks, 1):
|
||||
print(f" {i}. {risk}")
|
||||
```
|
||||
|
||||
### 4. Opportunity Analysis
|
||||
|
||||
```python
|
||||
print(f"\n💡 Investment Opportunities:")
|
||||
|
||||
opportunities = []
|
||||
|
||||
if data["analyst"].rating_score > 4.0:
|
||||
opportunities.append("Strong analyst support - positive sentiment")
|
||||
|
||||
if data["insider"].net_buy_sell > 0:
|
||||
opportunities.append("Insider buying - management confidence")
|
||||
|
||||
if data["fundamentals"].roe > 20:
|
||||
opportunities.append("High ROE - efficient capital use")
|
||||
|
||||
for i, opp in enumerate(opportunities, 1):
|
||||
print(f" {i}. {opp}")
|
||||
```
|
||||
|
||||
### 5. Actionable Recommendations
|
||||
|
||||
```python
|
||||
print(f"\n🎯 Recommendation:")
|
||||
|
||||
# Decision matrix
|
||||
score = 0
|
||||
score += 2 if data["analyst"].rating_score > 4.0 else 0
|
||||
score += 2 if data["fundamentals"].roe > 15 else 0
|
||||
score += 1 if data["price"].trend == "bullish" else 0
|
||||
score -= 1 if data["fundamentals"].pe_ratio > 30 else 0
|
||||
|
||||
if score >= 4:
|
||||
rating = "BUY"
|
||||
action = "Consider accumulating position"
|
||||
elif score >= 2:
|
||||
rating = "HOLD"
|
||||
action = "Monitor closely, hold current position"
|
||||
else:
|
||||
rating = "AVOID"
|
||||
action = "Wait for better entry point"
|
||||
|
||||
print(f" Rating: {rating}")
|
||||
print(f" Action: {action}")
|
||||
print(f" Confidence: {score}/5")
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
```bash
|
||||
# Deep research report
|
||||
/openbb-research AAPL --depth=deep
|
||||
|
||||
# Quick thesis
|
||||
/openbb-research MSFT --depth=quick --focus=thesis
|
||||
|
||||
# Risk analysis
|
||||
/openbb-research TSLA --focus=risks
|
||||
```
|
||||
|
||||
## Output Format
|
||||
|
||||
1. Executive Summary
|
||||
2. Investment Thesis
|
||||
3. Financial Analysis
|
||||
4. Valuation Assessment
|
||||
5. Risk Factors
|
||||
6. Opportunities
|
||||
7. Recommendation & Price Targets
|
||||
8. Monitoring Checklist
|
||||
|
||||
## Integration
|
||||
|
||||
- Export reports to PDF/Markdown
|
||||
- Track recommendations over time
|
||||
- Compare with analyst consensus
|
||||
- Portfolio integration via `/openbb-portfolio`
|
||||
Reference in New Issue
Block a user