@intentsolutionsio/openbb-terminal 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +29 -0
- package/LICENSE +21 -0
- package/README.md +1162 -0
- package/agents/crypto-analyst.md +165 -0
- package/agents/equity-analyst.md +148 -0
- package/agents/macro-economist.md +228 -0
- package/agents/portfolio-manager.md +163 -0
- package/commands/openbb-crypto.md +347 -0
- package/commands/openbb-equity.md +266 -0
- package/commands/openbb-macro.md +91 -0
- package/commands/openbb-options.md +87 -0
- package/commands/openbb-portfolio.md +154 -0
- package/commands/openbb-research.md +173 -0
- package/package.json +51 -0
- package/skills/skill-adapter/assets/README.md +7 -0
- package/skills/skill-adapter/assets/config-template.json +32 -0
- package/skills/skill-adapter/assets/skill-schema.json +28 -0
- package/skills/skill-adapter/assets/test-data.json +27 -0
- package/skills/skill-adapter/references/README.md +4 -0
- package/skills/skill-adapter/references/best-practices.md +69 -0
- package/skills/skill-adapter/references/examples.md +73 -0
- package/skills/skill-adapter/scripts/README.md +7 -0
- package/skills/skill-adapter/scripts/helper-template.sh +42 -0
- package/skills/skill-adapter/scripts/validation.sh +32 -0
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: openbb-crypto
|
|
3
|
+
description: Cryptocurrency market analysis using OpenBB - price data, on-chain metrics,...
|
|
4
|
+
---
|
|
5
|
+
# OpenBB Cryptocurrency Analysis
|
|
6
|
+
|
|
7
|
+
Comprehensive cryptocurrency analysis using OpenBB Platform's crypto data sources.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
/openbb-crypto SYMBOL [--vs USD|BTC|ETH] [--metrics on-chain|defi|social] [--period 30d]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## What This Command Does
|
|
16
|
+
|
|
17
|
+
Analyzes cryptocurrency markets with price data, on-chain metrics, DeFi analytics, and sentiment analysis.
|
|
18
|
+
|
|
19
|
+
## Workflow
|
|
20
|
+
|
|
21
|
+
### 1. Setup OpenBB Connection
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
from openbb import obb
|
|
25
|
+
import pandas as pd
|
|
26
|
+
from datetime import datetime, timedelta
|
|
27
|
+
|
|
28
|
+
# Parse arguments
|
|
29
|
+
symbol = sys.argv[1].upper() if len(sys.argv) > 1 else "BTC"
|
|
30
|
+
vs_currency = "USD" # USD, BTC, ETH
|
|
31
|
+
metrics_type = "all" # on-chain, defi, social, all
|
|
32
|
+
period = "30d" # 7d, 30d, 90d, 1y
|
|
33
|
+
|
|
34
|
+
# Parse flags
|
|
35
|
+
for arg in sys.argv[2:]:
|
|
36
|
+
if arg.startswith("--vs="):
|
|
37
|
+
vs_currency = arg.split("=")[1].upper()
|
|
38
|
+
elif arg.startswith("--metrics="):
|
|
39
|
+
metrics_type = arg.split("=")[1]
|
|
40
|
+
elif arg.startswith("--period="):
|
|
41
|
+
period = arg.split("=")[1]
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### 2. Retrieve Price Data
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
# Get historical crypto prices
|
|
48
|
+
crypto_data = obb.crypto.price.historical(
|
|
49
|
+
symbol=f"{symbol}{vs_currency}",
|
|
50
|
+
interval="1d",
|
|
51
|
+
period=period
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
df = crypto_data.to_dataframe()
|
|
55
|
+
|
|
56
|
+
print(f"\nāæ Crypto Analysis: {symbol}/{vs_currency}")
|
|
57
|
+
print(f"{'='*60}")
|
|
58
|
+
|
|
59
|
+
current_price = df['close'].iloc[-1]
|
|
60
|
+
period_high = df['high'].max()
|
|
61
|
+
period_low = df['low'].min()
|
|
62
|
+
period_return = ((current_price / df['close'].iloc[0]) - 1) * 100
|
|
63
|
+
|
|
64
|
+
print(f"\nš° Price Overview:")
|
|
65
|
+
print(f"Current Price: ${current_price:,.2f}")
|
|
66
|
+
print(f"{period} High: ${period_high:,.2f}")
|
|
67
|
+
print(f"{period} Low: ${period_low:,.2f}")
|
|
68
|
+
print(f"{period} Return: {period_return:+.2f}%")
|
|
69
|
+
print(f"24h Volume: ${df['volume'].iloc[-1]:,.0f}")
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 3. Technical Indicators
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
# Calculate crypto-specific indicators
|
|
76
|
+
print(f"\nš Technical Indicators:")
|
|
77
|
+
|
|
78
|
+
# Moving averages
|
|
79
|
+
df['MA_7'] = df['close'].rolling(window=7).mean()
|
|
80
|
+
df['MA_30'] = df['close'].rolling(window=30).mean()
|
|
81
|
+
df['MA_90'] = df['close'].rolling(window=90).mean()
|
|
82
|
+
|
|
83
|
+
ma_7 = df['MA_7'].iloc[-1]
|
|
84
|
+
ma_30 = df['MA_30'].iloc[-1]
|
|
85
|
+
ma_90 = df['MA_90'].iloc[-1]
|
|
86
|
+
|
|
87
|
+
print(f"MA 7: ${ma_7:,.2f} {'š¢' if current_price > ma_7 else 'š“'}")
|
|
88
|
+
print(f"MA 30: ${ma_30:,.2f} {'š¢' if current_price > ma_30 else 'š“'}")
|
|
89
|
+
print(f"MA 90: ${ma_90:,.2f} {'š¢' if current_price > ma_90 else 'š“'}")
|
|
90
|
+
|
|
91
|
+
# Volatility
|
|
92
|
+
returns = df['close'].pct_change()
|
|
93
|
+
volatility = returns.std() * (365 ** 0.5) * 100 # Annualized
|
|
94
|
+
|
|
95
|
+
print(f"\nVolatility (ann.): {volatility:.1f}%")
|
|
96
|
+
|
|
97
|
+
# RSI
|
|
98
|
+
delta = df['close'].diff()
|
|
99
|
+
gain = delta.where(delta > 0, 0).rolling(window=14).mean()
|
|
100
|
+
loss = -delta.where(delta < 0, 0).rolling(window=14).mean()
|
|
101
|
+
rs = gain / loss
|
|
102
|
+
df['RSI'] = 100 - (100 / (1 + rs))
|
|
103
|
+
rsi = df['RSI'].iloc[-1]
|
|
104
|
+
|
|
105
|
+
print(f"RSI (14): {rsi:.1f}")
|
|
106
|
+
if rsi > 70:
|
|
107
|
+
print(" ā ļø Overbought - potential sell signal")
|
|
108
|
+
elif rsi < 30:
|
|
109
|
+
print(" š¢ Oversold - potential buy signal")
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 4. On-Chain Metrics (if available)
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
if metrics_type in ["on-chain", "all"]:
|
|
116
|
+
print(f"\nāļø On-Chain Metrics:")
|
|
117
|
+
|
|
118
|
+
try:
|
|
119
|
+
# Network activity
|
|
120
|
+
network_data = obb.crypto.onchain.active_addresses(symbol=symbol)
|
|
121
|
+
print(f"Active Addresses (24h): {network_data.active_addresses:,}")
|
|
122
|
+
print(f"Transaction Count: {network_data.tx_count:,}")
|
|
123
|
+
print(f"Transaction Volume: ${network_data.tx_volume:,.0f}")
|
|
124
|
+
|
|
125
|
+
# Hash rate (for PoW coins)
|
|
126
|
+
if symbol in ["BTC", "ETH", "LTC", "DOGE"]:
|
|
127
|
+
hash_data = obb.crypto.onchain.hashrate(symbol=symbol)
|
|
128
|
+
print(f"\nHash Rate: {hash_data.hashrate / 1e18:.2f} EH/s")
|
|
129
|
+
print(f"Mining Difficulty: {hash_data.difficulty:,.0f}")
|
|
130
|
+
|
|
131
|
+
# Holder distribution
|
|
132
|
+
holders = obb.crypto.onchain.holders(symbol=symbol)
|
|
133
|
+
print(f"\nTop 10 Holders: {holders.top_10_pct:.1f}%")
|
|
134
|
+
print(f"Top 100 Holders: {holders.top_100_pct:.1f}%")
|
|
135
|
+
|
|
136
|
+
except Exception as e:
|
|
137
|
+
print(f"On-chain data not available for {symbol}")
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### 5. DeFi Metrics (if applicable)
|
|
141
|
+
|
|
142
|
+
```python
|
|
143
|
+
if metrics_type in ["defi", "all"] and symbol in ["ETH", "BNB", "AVAX", "SOL"]:
|
|
144
|
+
print(f"\nš¦ DeFi Metrics:")
|
|
145
|
+
|
|
146
|
+
try:
|
|
147
|
+
defi_data = obb.crypto.defi.tvl(chain=symbol)
|
|
148
|
+
print(f"Total Value Locked: ${defi_data.tvl / 1e9:.2f}B")
|
|
149
|
+
print(f"Protocol Count: {defi_data.protocol_count}")
|
|
150
|
+
print(f"Top Protocol: {defi_data.top_protocol}")
|
|
151
|
+
print(f" - TVL: ${defi_data.top_protocol_tvl / 1e9:.2f}B")
|
|
152
|
+
|
|
153
|
+
# Staking data
|
|
154
|
+
staking = obb.crypto.defi.staking(symbol=symbol)
|
|
155
|
+
print(f"\nStaking:")
|
|
156
|
+
print(f"Total Staked: {staking.total_staked_pct:.1f}%")
|
|
157
|
+
print(f"Avg APY: {staking.avg_apy:.2f}%")
|
|
158
|
+
except:
|
|
159
|
+
print(f"DeFi data not available for {symbol}")
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### 6. Social Sentiment & News
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
if metrics_type in ["social", "all"]:
|
|
166
|
+
print(f"\nš± Social Sentiment:")
|
|
167
|
+
|
|
168
|
+
try:
|
|
169
|
+
social_data = obb.crypto.social.sentiment(symbol=symbol)
|
|
170
|
+
print(f"Twitter Mentions (24h): {social_data.twitter_mentions:,}")
|
|
171
|
+
print(f"Reddit Posts (24h): {social_data.reddit_posts:,}")
|
|
172
|
+
print(f"Sentiment Score: {social_data.sentiment_score:.2f}/5.0")
|
|
173
|
+
|
|
174
|
+
sentiment_emoji = "š¢" if social_data.sentiment_score > 3.5 else "š”" if social_data.sentiment_score > 2.5 else "š“"
|
|
175
|
+
print(f"Overall Sentiment: {sentiment_emoji}")
|
|
176
|
+
|
|
177
|
+
# Recent news
|
|
178
|
+
news = obb.crypto.news(symbol=symbol, limit=3)
|
|
179
|
+
print(f"\nš° Latest News:")
|
|
180
|
+
for i, article in enumerate(news[:3], 1):
|
|
181
|
+
print(f"{i}. {article.title}")
|
|
182
|
+
print(f" {article.source} - {article.published_date}")
|
|
183
|
+
except:
|
|
184
|
+
print("Social/news data not available")
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### 7. Whale Activity Tracker
|
|
188
|
+
|
|
189
|
+
```python
|
|
190
|
+
print(f"\nš Whale Activity (Large Transfers):")
|
|
191
|
+
|
|
192
|
+
try:
|
|
193
|
+
# Get large transactions (>$100k)
|
|
194
|
+
whales = obb.crypto.onchain.large_transactions(
|
|
195
|
+
symbol=symbol,
|
|
196
|
+
min_value=100000,
|
|
197
|
+
limit=5
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
if len(whales) > 0:
|
|
201
|
+
print(f"Last {len(whales)} large transfers:")
|
|
202
|
+
for tx in whales:
|
|
203
|
+
print(f" ${tx.value_usd:,.0f} - {tx.from_address[:10]}...ā {tx.to_address[:10]}...")
|
|
204
|
+
print(f" {tx.timestamp} ({tx.exchange if tx.exchange else 'Unknown'})")
|
|
205
|
+
else:
|
|
206
|
+
print("No significant whale activity detected")
|
|
207
|
+
except:
|
|
208
|
+
print("Whale tracking not available")
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### 8. AI-Powered Market Analysis
|
|
212
|
+
|
|
213
|
+
```python
|
|
214
|
+
print(f"\nš¤ AI Market Analysis for {symbol}:")
|
|
215
|
+
print(f"\nš Trend Analysis:")
|
|
216
|
+
|
|
217
|
+
# Determine trend
|
|
218
|
+
if current_price > ma_7 > ma_30 > ma_90:
|
|
219
|
+
trend = "Strong Uptrend"
|
|
220
|
+
trend_emoji = "š"
|
|
221
|
+
elif current_price > ma_30:
|
|
222
|
+
trend = "Bullish"
|
|
223
|
+
trend_emoji = "š"
|
|
224
|
+
elif current_price < ma_7 < ma_30 < ma_90:
|
|
225
|
+
trend = "Strong Downtrend"
|
|
226
|
+
trend_emoji = "š"
|
|
227
|
+
else:
|
|
228
|
+
trend = "Consolidating"
|
|
229
|
+
trend_emoji = "āļø"
|
|
230
|
+
|
|
231
|
+
print(f"{trend_emoji} Market Trend: {trend}")
|
|
232
|
+
|
|
233
|
+
# Risk assessment
|
|
234
|
+
if volatility > 100:
|
|
235
|
+
risk = "Very High"
|
|
236
|
+
risk_emoji = "š“"
|
|
237
|
+
elif volatility > 60:
|
|
238
|
+
risk = "High"
|
|
239
|
+
risk_emoji = "š”"
|
|
240
|
+
else:
|
|
241
|
+
risk = "Moderate"
|
|
242
|
+
risk_emoji = "š¢"
|
|
243
|
+
|
|
244
|
+
print(f"{risk_emoji} Volatility Risk: {risk}")
|
|
245
|
+
|
|
246
|
+
# Trading signals
|
|
247
|
+
print(f"\nš” Trading Signals:")
|
|
248
|
+
signals = []
|
|
249
|
+
|
|
250
|
+
if rsi < 30:
|
|
251
|
+
signals.append("š¢ RSI oversold - potential buy zone")
|
|
252
|
+
if rsi > 70:
|
|
253
|
+
signals.append("š“ RSI overbought - consider taking profits")
|
|
254
|
+
if current_price > ma_30 and returns.iloc[-1] > 0.05:
|
|
255
|
+
signals.append("š Strong momentum detected")
|
|
256
|
+
if df['volume'].iloc[-1] > df['volume'].rolling(20).mean().iloc[-1] * 2:
|
|
257
|
+
signals.append("š Unusual volume spike")
|
|
258
|
+
|
|
259
|
+
if signals:
|
|
260
|
+
for signal in signals:
|
|
261
|
+
print(f" {signal}")
|
|
262
|
+
else:
|
|
263
|
+
print(" No strong signals detected - market in equilibrium")
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### 9. Price Targets & Support/Resistance
|
|
267
|
+
|
|
268
|
+
```python
|
|
269
|
+
print(f"\nšÆ Key Levels:")
|
|
270
|
+
|
|
271
|
+
# Calculate support and resistance
|
|
272
|
+
high_30d = df['high'].tail(30).max()
|
|
273
|
+
low_30d = df['low'].tail(30).min()
|
|
274
|
+
pivot = (high_30d + low_30d + current_price) / 3
|
|
275
|
+
|
|
276
|
+
resistance_1 = 2 * pivot - low_30d
|
|
277
|
+
support_1 = 2 * pivot - high_30d
|
|
278
|
+
|
|
279
|
+
print(f"Resistance: ${resistance_1:,.2f} ({((resistance_1/current_price - 1) * 100):+.1f}%)")
|
|
280
|
+
print(f"Current: ${current_price:,.2f}")
|
|
281
|
+
print(f"Support: ${support_1:,.2f} ({((support_1/current_price - 1) * 100):+.1f}%)")
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
## Examples
|
|
285
|
+
|
|
286
|
+
### Basic crypto analysis
|
|
287
|
+
```bash
|
|
288
|
+
/openbb-crypto BTC
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### Ethereum DeFi metrics
|
|
292
|
+
```bash
|
|
293
|
+
/openbb-crypto ETH --metrics=defi
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### Altcoin vs BTC
|
|
297
|
+
```bash
|
|
298
|
+
/openbb-crypto LINK --vs=BTC --period=90d
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### Social sentiment check
|
|
302
|
+
```bash
|
|
303
|
+
/openbb-crypto DOGE --metrics=social
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## Supported Cryptocurrencies
|
|
307
|
+
|
|
308
|
+
- **Major**: BTC, ETH, BNB, SOL, ADA, XRP, DOT, AVAX
|
|
309
|
+
- **DeFi**: UNI, AAVE, LINK, COMP, MKR, SNX
|
|
310
|
+
- **Meme**: DOGE, SHIB, PEPE
|
|
311
|
+
- **Layer 2**: MATIC, ARB, OP
|
|
312
|
+
- **1000+ more via OpenBB data providers**
|
|
313
|
+
|
|
314
|
+
## Data Sources
|
|
315
|
+
|
|
316
|
+
- Price data: Multiple exchanges (Binance, Coinbase, etc.)
|
|
317
|
+
- On-chain: Glassnode, Santiment, IntoTheBlock
|
|
318
|
+
- DeFi: DeFi Llama, The Graph
|
|
319
|
+
- Social: LunarCrush, Santiment
|
|
320
|
+
|
|
321
|
+
## Tips
|
|
322
|
+
|
|
323
|
+
1. **Compare to BTC**: Use `--vs=BTC` to see altcoin strength vs Bitcoin
|
|
324
|
+
2. **Track Whales**: Monitor large transfers for market-moving activity
|
|
325
|
+
3. **DeFi Context**: Check TVL and staking for ecosystem health
|
|
326
|
+
4. **Sentiment Analysis**: Social metrics can predict short-term moves
|
|
327
|
+
5. **Correlation**: Compare multiple cryptos to find divergences
|
|
328
|
+
|
|
329
|
+
## Integration
|
|
330
|
+
|
|
331
|
+
```bash
|
|
332
|
+
# Portfolio tracking
|
|
333
|
+
/openbb-portfolio --add-crypto=BTC,ETH,SOL
|
|
334
|
+
|
|
335
|
+
# Compare with equity markets
|
|
336
|
+
/openbb-macro --crypto-correlation
|
|
337
|
+
|
|
338
|
+
# AI research
|
|
339
|
+
/openbb-research --crypto --symbol=BTC
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
## Notes
|
|
343
|
+
|
|
344
|
+
- Cryptocurrency markets are 24/7
|
|
345
|
+
- High volatility - use appropriate risk management
|
|
346
|
+
- Not financial advice - DYOR (Do Your Own Research)
|
|
347
|
+
- Consider transaction costs and slippage for trading
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: openbb-equity
|
|
3
|
+
description: Comprehensive equity analysis using OpenBB - historical prices,...
|
|
4
|
+
---
|
|
5
|
+
# OpenBB Equity Analysis
|
|
6
|
+
|
|
7
|
+
Perform comprehensive stock analysis using the OpenBB Platform.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
/openbb-equity TICKER [--analysis fundamental|technical|all] [--period 1y]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## What This Command Does
|
|
16
|
+
|
|
17
|
+
Retrieves and analyzes equity data for any stock ticker using OpenBB's comprehensive data sources.
|
|
18
|
+
|
|
19
|
+
## Workflow
|
|
20
|
+
|
|
21
|
+
### 1. Check OpenBB Installation
|
|
22
|
+
|
|
23
|
+
First, verify OpenBB is installed:
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
try:
|
|
27
|
+
from openbb import obb
|
|
28
|
+
print("ā
OpenBB installed")
|
|
29
|
+
except ImportError:
|
|
30
|
+
print("ā ļø Installing OpenBB...")
|
|
31
|
+
import subprocess
|
|
32
|
+
subprocess.run(["pip", "install", "openbb"], check=True)
|
|
33
|
+
from openbb import obb
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 2. Parse Arguments
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
# Parse user input
|
|
40
|
+
import sys
|
|
41
|
+
ticker = sys.argv[1].upper() if len(sys.argv) > 1 else "AAPL"
|
|
42
|
+
analysis_type = "all" # fundamental, technical, or all
|
|
43
|
+
period = "1y" # 1d, 1w, 1m, 3m, 6m, 1y, 5y
|
|
44
|
+
|
|
45
|
+
# Parse flags
|
|
46
|
+
for arg in sys.argv[2:]:
|
|
47
|
+
if arg.startswith("--analysis="):
|
|
48
|
+
analysis_type = arg.split("=")[1]
|
|
49
|
+
elif arg.startswith("--period="):
|
|
50
|
+
period = arg.split("=")[1]
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 3. Retrieve Historical Price Data
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
# Get historical prices
|
|
57
|
+
price_data = obb.equity.price.historical(
|
|
58
|
+
symbol=ticker,
|
|
59
|
+
interval="1d",
|
|
60
|
+
period=period
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
df = price_data.to_dataframe()
|
|
64
|
+
print(f"\nš Historical Prices for {ticker}")
|
|
65
|
+
print(f"Period: {period}")
|
|
66
|
+
print(f"Latest Close: ${df['close'].iloc[-1]:.2f}")
|
|
67
|
+
print(f"52-Week High: ${df['high'].max():.2f}")
|
|
68
|
+
print(f"52-Week Low: ${df['low'].min():.2f}")
|
|
69
|
+
print(f"YTD Return: {((df['close'].iloc[-1] / df['close'].iloc[0]) - 1) * 100:.2f}%")
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 4. Fundamental Analysis (if requested)
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
if analysis_type in ["fundamental", "all"]:
|
|
76
|
+
print(f"\nš Fundamental Analysis for {ticker}")
|
|
77
|
+
|
|
78
|
+
# Company profile
|
|
79
|
+
try:
|
|
80
|
+
profile = obb.equity.profile(symbol=ticker)
|
|
81
|
+
print(f"\nCompany: {profile.name}")
|
|
82
|
+
print(f"Sector: {profile.sector}")
|
|
83
|
+
print(f"Industry: {profile.industry}")
|
|
84
|
+
print(f"Market Cap: ${profile.market_cap / 1e9:.2f}B")
|
|
85
|
+
except:
|
|
86
|
+
print("Profile data not available")
|
|
87
|
+
|
|
88
|
+
# Financial metrics
|
|
89
|
+
try:
|
|
90
|
+
metrics = obb.equity.fundamental.metrics(symbol=ticker)
|
|
91
|
+
print(f"\nKey Metrics:")
|
|
92
|
+
print(f"P/E Ratio: {metrics.pe_ratio:.2f}")
|
|
93
|
+
print(f"EPS: ${metrics.eps:.2f}")
|
|
94
|
+
print(f"Dividend Yield: {metrics.dividend_yield:.2%}")
|
|
95
|
+
print(f"ROE: {metrics.roe:.2%}")
|
|
96
|
+
except:
|
|
97
|
+
print("Metrics data not available")
|
|
98
|
+
|
|
99
|
+
# Analyst ratings
|
|
100
|
+
try:
|
|
101
|
+
ratings = obb.equity.estimates.analyst(symbol=ticker)
|
|
102
|
+
print(f"\nAnalyst Consensus:")
|
|
103
|
+
print(f"Buy: {ratings.buy_count}")
|
|
104
|
+
print(f"Hold: {ratings.hold_count}")
|
|
105
|
+
print(f"Sell: {ratings.sell_count}")
|
|
106
|
+
print(f"Target Price: ${ratings.target_price:.2f}")
|
|
107
|
+
except:
|
|
108
|
+
print("Analyst ratings not available")
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### 5. Technical Analysis (if requested)
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
if analysis_type in ["technical", "all"]:
|
|
115
|
+
print(f"\nš Technical Analysis for {ticker}")
|
|
116
|
+
|
|
117
|
+
# Calculate technical indicators
|
|
118
|
+
import pandas as pd
|
|
119
|
+
|
|
120
|
+
# Simple Moving Averages
|
|
121
|
+
df['SMA_20'] = df['close'].rolling(window=20).mean()
|
|
122
|
+
df['SMA_50'] = df['close'].rolling(window=50).mean()
|
|
123
|
+
df['SMA_200'] = df['close'].rolling(window=200).mean()
|
|
124
|
+
|
|
125
|
+
current_price = df['close'].iloc[-1]
|
|
126
|
+
sma_20 = df['SMA_20'].iloc[-1]
|
|
127
|
+
sma_50 = df['SMA_50'].iloc[-1]
|
|
128
|
+
sma_200 = df['SMA_200'].iloc[-1]
|
|
129
|
+
|
|
130
|
+
print(f"\nMoving Averages:")
|
|
131
|
+
print(f"Current Price: ${current_price:.2f}")
|
|
132
|
+
print(f"SMA 20: ${sma_20:.2f} {'š¢' if current_price > sma_20 else 'š“'}")
|
|
133
|
+
print(f"SMA 50: ${sma_50:.2f} {'š¢' if current_price > sma_50 else 'š“'}")
|
|
134
|
+
print(f"SMA 200: ${sma_200:.2f} {'š¢' if current_price > sma_200 else 'š“'}")
|
|
135
|
+
|
|
136
|
+
# RSI calculation
|
|
137
|
+
delta = df['close'].diff()
|
|
138
|
+
gain = (delta.where(delta > 0, 0)).rolling(window=14).mean()
|
|
139
|
+
loss = (-delta.where(delta < 0, 0)).rolling(window=14).mean()
|
|
140
|
+
rs = gain / loss
|
|
141
|
+
df['RSI'] = 100 - (100 / (1 + rs))
|
|
142
|
+
|
|
143
|
+
rsi = df['RSI'].iloc[-1]
|
|
144
|
+
print(f"\nRSI (14): {rsi:.2f}")
|
|
145
|
+
if rsi > 70:
|
|
146
|
+
print("ā ļø Overbought territory")
|
|
147
|
+
elif rsi < 30:
|
|
148
|
+
print("š¢ Oversold territory - potential buy")
|
|
149
|
+
else:
|
|
150
|
+
print("Neutral zone")
|
|
151
|
+
|
|
152
|
+
# Volume analysis
|
|
153
|
+
avg_volume = df['volume'].rolling(window=20).mean().iloc[-1]
|
|
154
|
+
current_volume = df['volume'].iloc[-1]
|
|
155
|
+
print(f"\nVolume:")
|
|
156
|
+
print(f"Current: {current_volume:,.0f}")
|
|
157
|
+
print(f"20-day Avg: {avg_volume:,.0f}")
|
|
158
|
+
print(f"Relative: {(current_volume / avg_volume):.2f}x")
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### 6. AI-Powered Insights
|
|
162
|
+
|
|
163
|
+
Generate investment insights using Claude's analysis:
|
|
164
|
+
|
|
165
|
+
```python
|
|
166
|
+
# Prepare summary for AI analysis
|
|
167
|
+
summary = {
|
|
168
|
+
"ticker": ticker,
|
|
169
|
+
"current_price": current_price,
|
|
170
|
+
"52w_high": df['high'].max(),
|
|
171
|
+
"52w_low": df['low'].min(),
|
|
172
|
+
"ytd_return": ((df['close'].iloc[-1] / df['close'].iloc[0]) - 1) * 100,
|
|
173
|
+
"technical": {
|
|
174
|
+
"sma_position": "bullish" if current_price > sma_200 else "bearish",
|
|
175
|
+
"rsi": rsi,
|
|
176
|
+
"volume_trend": "high" if current_volume > avg_volume else "normal"
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
print(f"\nš¤ AI Analysis for {ticker}:")
|
|
181
|
+
print("\nBased on the data above, here's my assessment:")
|
|
182
|
+
print(f"- Trend: {'Bullish' if current_price > sma_200 else 'Bearish'} (price {'above' if current_price > sma_200 else 'below'} 200-day SMA)")
|
|
183
|
+
print(f"- Momentum: {'Overbought' if rsi > 70 else 'Oversold' if rsi < 30 else 'Neutral'} (RSI: {rsi:.1f})")
|
|
184
|
+
print(f"- Volume: {'Elevated' if current_volume > avg_volume * 1.5 else 'Normal'} trading activity")
|
|
185
|
+
print(f"\nš” Recommendation: Consider {summary} in context of your investment strategy and risk tolerance.")
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### 7. Generate Report
|
|
189
|
+
|
|
190
|
+
Create a formatted analysis report:
|
|
191
|
+
|
|
192
|
+
```python
|
|
193
|
+
print(f"\n{'='*60}")
|
|
194
|
+
print(f"EQUITY ANALYSIS REPORT: {ticker}")
|
|
195
|
+
print(f"{'='*60}")
|
|
196
|
+
print(f"Generated: {pd.Timestamp.now().strftime('%Y-%m-%d %H:%M:%S')}")
|
|
197
|
+
print(f"Data Source: OpenBB Platform")
|
|
198
|
+
print(f"\nAnalysis Type: {analysis_type.upper()}")
|
|
199
|
+
print(f"Period Analyzed: {period}")
|
|
200
|
+
print(f"\n{'='*60}")
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Examples
|
|
204
|
+
|
|
205
|
+
### Basic equity analysis
|
|
206
|
+
```bash
|
|
207
|
+
/openbb-equity AAPL
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Fundamental analysis only
|
|
211
|
+
```bash
|
|
212
|
+
/openbb-equity TSLA --analysis=fundamental
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Technical analysis with custom period
|
|
216
|
+
```bash
|
|
217
|
+
/openbb-equity NVDA --analysis=technical --period=6m
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Complete analysis
|
|
221
|
+
```bash
|
|
222
|
+
/openbb-equity GOOGL --analysis=all --period=1y
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Data Coverage
|
|
226
|
+
|
|
227
|
+
- **Price Data**: Historical OHLCV, real-time quotes
|
|
228
|
+
- **Fundamentals**: Income statements, balance sheets, cash flow, ratios
|
|
229
|
+
- **Technical**: SMA, EMA, RSI, MACD, Bollinger Bands, volume
|
|
230
|
+
- **Analyst Data**: Ratings, price targets, recommendations
|
|
231
|
+
- **Insider Trading**: Recent insider transactions
|
|
232
|
+
- **News**: Latest company news and sentiment
|
|
233
|
+
|
|
234
|
+
## Tips
|
|
235
|
+
|
|
236
|
+
1. **Compare Multiple Stocks**: Run for different tickers to compare
|
|
237
|
+
2. **Track Over Time**: Save reports to monitor changes
|
|
238
|
+
3. **Combine with AI Agents**: Use with equity-analyst agent for deeper insights
|
|
239
|
+
4. **Export Data**: Save dataframes to CSV for further analysis
|
|
240
|
+
5. **Set Alerts**: Monitor key technical levels (support/resistance)
|
|
241
|
+
|
|
242
|
+
## Integration with Other Commands
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
# Compare with crypto
|
|
246
|
+
/openbb-crypto BTC --compare=equity
|
|
247
|
+
|
|
248
|
+
# Portfolio context
|
|
249
|
+
/openbb-portfolio --add=AAPL
|
|
250
|
+
|
|
251
|
+
# Macro correlation
|
|
252
|
+
/openbb-macro --impact=equity
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## Requirements
|
|
256
|
+
|
|
257
|
+
- OpenBB Platform installed (`pip install openbb`)
|
|
258
|
+
- Python 3.9.21 - 3.12
|
|
259
|
+
- Optional: API keys for premium data providers (configured in OpenBB)
|
|
260
|
+
|
|
261
|
+
## Notes
|
|
262
|
+
|
|
263
|
+
- Free tier provides delayed data (15-20 minutes)
|
|
264
|
+
- Premium data requires API keys (configured via `obb.user.credentials`)
|
|
265
|
+
- All financial data is for informational purposes only
|
|
266
|
+
- Not financial advice - always do your own research
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: openbb-macro
|
|
3
|
+
description: Macroeconomic analysis using OpenBB - GDP, inflation, interest rates,...
|
|
4
|
+
---
|
|
5
|
+
# OpenBB Macroeconomic Analysis
|
|
6
|
+
|
|
7
|
+
Analyze global macroeconomic trends and indicators using OpenBB Platform.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
/openbb-macro [--country US|UK|EU|CN|JP] [--indicators gdp|inflation|rates|employment|all]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## What This Command Does
|
|
16
|
+
|
|
17
|
+
Retrieves and analyzes macroeconomic indicators to understand economic trends and market implications.
|
|
18
|
+
|
|
19
|
+
## Key Features
|
|
20
|
+
|
|
21
|
+
### Economic Indicators
|
|
22
|
+
- **GDP**: Growth rates, forecasts, components
|
|
23
|
+
- **Inflation**: CPI, PPI, PCE, core inflation
|
|
24
|
+
- **Interest Rates**: Federal funds, treasury yields, central bank rates
|
|
25
|
+
- **Employment**: Unemployment, NFP, job openings, labor participation
|
|
26
|
+
- **Consumer**: Confidence, spending, retail sales
|
|
27
|
+
- **Manufacturing**: PMI, industrial production, capacity utilization
|
|
28
|
+
|
|
29
|
+
### Workflow
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from openbb import obb
|
|
33
|
+
|
|
34
|
+
# GDP Analysis
|
|
35
|
+
gdp_data = obb.economy.gdp(country="US")
|
|
36
|
+
print(f"GDP Growth: {gdp_data.growth_rate:.2f}%")
|
|
37
|
+
print(f"GDP per Capita: ${gdp_data.gdp_per_capita:,.0f}")
|
|
38
|
+
|
|
39
|
+
# Inflation Data
|
|
40
|
+
cpi = obb.economy.cpi(country="US")
|
|
41
|
+
print(f"CPI (YoY): {cpi.yoy_change:.2f}%")
|
|
42
|
+
print(f"Core CPI: {cpi.core_cpi:.2f}%")
|
|
43
|
+
|
|
44
|
+
# Interest Rates
|
|
45
|
+
rates = obb.economy.fed_rates()
|
|
46
|
+
print(f"Fed Funds Rate: {rates.current_rate:.2f}%")
|
|
47
|
+
print(f"10Y Treasury: {rates.treasury_10y:.2f}%")
|
|
48
|
+
|
|
49
|
+
# Employment
|
|
50
|
+
employment = obb.economy.employment()
|
|
51
|
+
print(f"Unemployment Rate: {employment.unemployment_rate:.1f}%")
|
|
52
|
+
print(f"NFP (last month): {employment.nfp_change:+,}")
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Market Impact Analysis
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
# Analyze impact on markets
|
|
59
|
+
print("\nš” Market Implications:")
|
|
60
|
+
|
|
61
|
+
if cpi.yoy_change > 3.0:
|
|
62
|
+
print("ā ļø High inflation - Fed likely to maintain hawkish stance")
|
|
63
|
+
print(" ā Negative for growth stocks, positive for commodities")
|
|
64
|
+
|
|
65
|
+
if employment.unemployment_rate < 4.0:
|
|
66
|
+
print("š„ Tight labor market - wage pressures building")
|
|
67
|
+
print(" ā Could sustain inflation, support consumer stocks")
|
|
68
|
+
|
|
69
|
+
if rates.current_rate > 5.0:
|
|
70
|
+
print("šø High interest rates - restrictive monetary policy")
|
|
71
|
+
print(" ā Headwind for equities, tailwind for bonds")
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Examples
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# US macro overview
|
|
78
|
+
/openbb-macro --country=US --indicators=all
|
|
79
|
+
|
|
80
|
+
# UK inflation focus
|
|
81
|
+
/openbb-macro --country=UK --indicators=inflation
|
|
82
|
+
|
|
83
|
+
# China GDP analysis
|
|
84
|
+
/openbb-macro --country=CN --indicators=gdp
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Integration
|
|
88
|
+
|
|
89
|
+
- Correlate with equity performance via `/openbb-equity`
|
|
90
|
+
- Impact crypto markets via `/openbb-crypto`
|
|
91
|
+
- Portfolio positioning via `/openbb-portfolio`
|