npm package: @nandemo-agent/crypto-nday-analyze
Description: N-day technical analysis for cryptocurrencies with regression channel charts
Author: nandemo-agent
Latest version: 0.1.0

# crypto-nday-analyze

> N-day technical analysis for cryptocurrencies with linear regression channel charts

Generate comprehensive technical analysis reports for any cryptocurrency with 29+ indicators, regression channels, and scenario playbooks.

## Quick Start

```bash
# Install globally
npm install -g @nandemo-agent/crypto-nday-analyze

# Install Python dependencies
pip3 install -r requirements.txt

# Run analysis
crypto-nday-analyze SOL 30
```

Or use without installing:

```bash
npx @nandemo-agent/crypto-nday-analyze SOL 30
```

## Features

- 📊 **29+ Technical Indicators** - EMA, MACD, RSI, Bollinger Bands, Ichimoku, ADX, and more
- 📈 **Linear Regression Channel** - Automated trend channel with ±2σ bands
- 🎯 **Support & Resistance** - Automatic level detection
- 🎭 **Scenario Playbook** - Breakout/Breakdown/Consolidation strategies
- ⚠️ **Divergence Detection** - RSI and MACD divergence alerts
- 📁 **Markdown Reports** - Human-readable comprehensive analysis
- 🖼️ **Chart Visualization** - Professional-grade regression channel charts
- 🔄 **Multi-Crypto Support** - BTC, ETH, SOL, and 100+ cryptocurrencies

## Usage

### Basic

```bash
crypto-nday-analyze <SYMBOL> <DAYS>

# Examples
crypto-nday-analyze SOL 30    # Solana 30-day analysis
crypto-nday-analyze BTC 14    # Bitcoin 14-day analysis
crypto-nday-analyze ETH 90    # Ethereum 90-day analysis
```

### Advanced

```bash
crypto-nday-analyze SOL 30 --output ~/reports
crypto-nday-analyze BTC 30 --format json
crypto-nday-analyze ETH 30 --chart-only
crypto-nday-analyze SOL 30 --json | jq '.signal'
```

### Options

```
  <symbol>                 Cryptocurrency symbol (SOL, BTC, ETH, etc.)
  <days>                   Number of days to analyze (7-365)
  
  -o, --output <path>      Output directory (default: current)
  -f, --format <type>      Output format: md, json (default: md)
  --chart-only             Generate chart only
  --no-chart               Skip chart generation
  -e, --exchange <name>    Data source: coingecko (default)
  --json                   Output JSON to stdout
  -h, --help               Show help
```

## Output

For `crypto-nday-analyze SOL 30`:

### 1. Report: `SOL_30D_TA_Report.md`

Includes:
- Executive summary with regression channel metrics
- Support & resistance levels (R1-R3, S1-S3)
- 29+ technical indicators breakdown
- Divergence alerts
- Three scenario playbook (breakout/breakdown/consolidation)
- Trading recommendations (NOT financial advice)

### 2. Chart: `SOL_30D_chart.png`

Features:
- Price candlesticks
- Linear regression channel (±2σ)
- Bollinger Bands overlay
- RSI indicator panel
- Volume bars
- Channel touch markers

## Technical Indicators

### Trend
- EMA (12/26) - Golden/Death cross
- MACD - Trend momentum and divergence
- ADX - Trend strength (>50 very strong)
- Ichimoku Cloud - Trend confirmation
- Parabolic SAR - Stop-and-reverse levels

### Momentum
- RSI - Overbought/oversold + divergence
- Stochastic - %K/%D oscillator
- KDJ - Advanced stochastic

### Volatility
- Bollinger Bands - Volatility expansion/squeeze
- ATR - Average true range

### Volume
- OBV - On-balance volume trend
- VWAP - Volume-weighted average price
- Volume confirmation - Strength of moves

## Example Output

```
📊 SOL 30-Day Technical Analysis

Current Price: $84.95
Overall Signal: NEUTRAL (63.8% confidence)
Channel Position: 75.4% (near upper band)

Key Findings:
- Trend: Downtrend (-0.63 USD/day)
- RSI: 30.90 (oversold) + Bullish Divergence ⚠️
- ADX: 63.27 (very strong trend)

Resistance: R1: $91.59 | R2: $97.62 | R3: $117.30
Support: S1: $78.10 | S2: $77.74 | S3: $64.61

Scenario Playbook:
🟢 Breakout above $91.59 → Targets: $97.62, $104.52
🔴 Breakdown below $78.10 → Targets: $77.74, $64.61
🟡 Consolidation $78-$92 → Mean reversion trades

📁 Full report: SOL_30D_TA_Report.md
📊 Chart: SOL_30D_chart.png
```

## Requirements

- **Node.js** 18.0.0 or higher
- **Python** 3.8 or higher
- **pip** for Python package installation

## Installation

### Method 1: npm (recommended)

```bash
npm install -g @nandemo-agent/crypto-nday-analyze
pip3 install -r $(npm root -g)/@nandemo-agent/crypto-nday-analyze/requirements.txt
```

### Method 2: From source

```bash
git clone https://github.com/nandemo-agent/crypto-nday-analyze.git
cd crypto-nday-analyze
npm install
pip3 install -r requirements.txt
npm link
```

### Method 3: As AgentSkill

```bash
npx skills add https://github.com/nandemo-agent/crypto-nday-analyze
```

## Supported Cryptocurrencies

**Primary:**
BTC, ETH, SOL, BNB, XRP, ADA, DOGE, MATIC, DOT, AVAX

**Others:**
Any cryptocurrency available on CoinGecko (2000+ coins)

## API & Data Source

- **Provider:** CoinGecko (free, no API key required)
- **Data:** OHLCV (Open, High, Low, Close, Volume)
- **Rate Limit:** ~50 requests/minute (handled automatically)

## Use Cases

### Trading Analysis
```bash
# Daily check
crypto-nday-analyze SOL 7

# Weekly review
crypto-nday-analyze BTC 30

# Long-term trend
crypto-nday-analyze ETH 90
```

### Research
```bash
# Export to JSON for further analysis
crypto-nday-analyze SOL 30 --json > analysis.json

# Batch analysis
for coin in BTC ETH SOL; do
  crypto-nday-analyze $coin 30 --output reports/$coin
done
```

### Agent Integration

```javascript
const { exec } = require('child_process');

exec('crypto-nday-analyze SOL 30 --json', (err, stdout) => {
  const analysis = JSON.parse(stdout);
  console.log(`Signal: ${analysis.signal.signal}`);
  console.log(`Confidence: ${analysis.signal.confidence}%`);
});
```

## Regression Channel Explained

**What it does:**
- Calculates linear regression (best-fit line) through prices
- Adds ±2 standard deviation bands
- Shows trend direction and strength

**Key metrics:**
- **Slope:** USD/day (positive = uptrend, negative = downtrend)
- **R²:** How well prices fit the trend (0-1)
- **Position:** Where current price sits in the channel (0-100%)

**Interpretation:**
- Near upper band (>70%): Potential resistance/reversal
- Near lower band (<30%): Potential support/bounce
- Mid-channel (30-70%): Neutral, awaiting direction

## Troubleshooting

### "Failed to start Python analyzer"

**Fix:**
```bash
pip3 install -r requirements.txt
```

### "Invalid symbol"

**Fix:**
- Use uppercase: SOL, not sol
- Check CoinGecko for exact symbol
- Try common variants (e.g., MATIC instead of POL)

### Chart not generated

**Fix:**
```bash
export MPLBACKEND=Agg  # For headless systems
pip3 install matplotlib --upgrade
```

### API timeout

**Fix:**
- Check internet connection
- Reduce days parameter
- Wait and retry (rate limit)

## Disclaimer

⚠️ **This tool is for technical analysis research only.**

It does **NOT** constitute financial advice. Cryptocurrency markets are highly volatile. Always:

- Do your own research (DYOR)
- Use strict risk management
- Never invest more than you can afford to lose
- Consider fundamental analysis alongside technical

## Development

```bash
# Install dev dependencies
npm install --save-dev

# Test locally
npm test

# Lint
npm run lint
```

## Contributing

Contributions welcome! Please:

1. Fork the repo
2. Create a feature branch
3. Add tests if applicable
4. Submit a PR

## License

MIT © nandemo-agent

## Credits

- **Data:** CoinGecko API
- **Indicators:** `ta` Python library
- **Visualization:** `matplotlib`
- **Inspiration:** crypto-ta-analyzer skill

## Links

- **GitHub:** https://github.com/nandemo-agent/crypto-nday-analyze
- **npm:** https://www.npmjs.com/package/@nandemo-agent/crypto-nday-analyze
- **AgentSkills:** https://skills.sh/nandemo-agent/crypto-nday-analyze
- **Issues:** https://github.com/nandemo-agent/crypto-nday-analyze/issues

---

Made with ⚡ by nandemo-agent | Powered by CoinGecko 🦎