Metadata-Version: 2.4
Name: pycprarser
Version: 0.1.3
Summary: Cryptocurrency snapshot parser — real-time prices, volume & alerts from CoinGecko and Binance
Project-URL: Homepage, https://pypi.org/project/pycprarser/
License-Expression: MIT
Keywords: alert,binance,bitcoin,coingecko,crypto,cryptocurrency,ethereum,price,snapshot
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Office/Business :: Financial :: Investment
Classifier: Topic :: Utilities
Requires-Python: >=3.8
Requires-Dist: click>=8.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: requests>=2.28
Description-Content-Type: text/markdown

<div align="center">

# 🔍 pycprarser

**Cryptocurrency Snapshot Parser**

*Real-time crypto prices, volume & alerts from CoinGecko & Binance — right in your terminal.*

[![PyPI](https://img.shields.io/pypi/v/pycprarser?color=blue&label=PyPI)](https://pypi.org/project/pycprarser/)
[![Python](https://img.shields.io/pypi/pyversions/pycprarser.svg)](https://pypi.org/project/pycprarser/)
[![License](https://img.shields.io/pypi/l/pycprarser.svg)](https://pypi.org/project/pycprarser/)

</div>

---

## ✨ Features

- **Snapshot** — one-shot price table for all configured coins
- **Watch** — continuous monitoring with configurable interval
- **Alerts** — instant notification when price moves beyond threshold
- **History** — stored in SQLite, query stats (min/max/avg/trend)
- **Export** — dump history to CSV or JSON
- **Zero API keys** — CoinGecko + Binance public endpoints
- **Configurable** — YAML config for coins, intervals, thresholds

## 📦 Install

```bash
pip install pycprarser
```

## 🚀 Usage

### Snapshot — instant price table

```bash
pycprarser snapshot
```

```
Coin            Price USD        24h Vol        Mkt Cap        Bid        Ask
------------------------------------------------------------------------
bitcoin        $61,814.00 $33,817,704,863 $1,239,483,984,389 $61,913.99 $61,914.00
ethereum        $1,737.72 $12,979,993,603 $209,722,410,112  $1,741.25  $1,741.26
solana             $81.46 $3,126,349,866 $47,340,239,965     $81.48     $81.49
ripple              $1.11 $1,672,088,890 $68,993,905,122      $1.11      $1.11
dogecoin            $0.08   $662,485,261 $11,670,478,038      $0.08      $0.08
```

### Watch — continuous monitoring + alerts

```bash
pycprarser watch
```

```
Watching 5 coins every 60s, alert >3.0%
  ALERT bitcoin ↓ -3.42%  $63,980.00 → $61,814.00
Coin            Price USD        24h Vol        Mkt Cap        Bid        Ask
------------------------------------------------------------------------
...
--- next in 60s ---
```

Press `Ctrl+C` to stop.

### History — stats & trend

```bash
pycprarser history bitcoin
```

```
=== bitcoin (142 records) ===
  Min:  $58,200.00
  Max:  $64,500.00
  Avg:  $61,340.50
  First: $63,100.00  Last: $61,814.00
  Trend: down -2.18%
```

### Export — CSV or JSON

```bash
pycprarser export bitcoin --format csv > btc.csv
pycprarser export ethereum --format json > eth.json
```

## ⚙️ Configuration

Create `config.yaml` in the working directory or set `PYCPRARSER_CONFIG` env var:

```yaml
coins:
  - bitcoin
  - ethereum
  - solana
  - ripple
  - dogecoin

interval_sec: 60          # fetch frequency (min 30 recommended)
alert_threshold_pct: 3.0   # alert when price moves >3%
db_path: ./crypto.db       # SQLite database path
```

Or pass explicitly:

```bash
pycprarser --config /path/to/config.yaml snapshot
```

## 🏗️ Architecture

```
pycprarser/
├── __init__.py     # version
├── cli.py          # click CLI (snapshot, watch, history, export)
├── config.py       # YAML config loader with defaults
├── fetcher.py      # CoinGecko + Binance API clients
├── db.py           # SQLite storage (ticks table)
└── analytics.py    # stats (min/max/avg) & trend detection
```

**Data sources:**
| Source | Data | Rate limit |
|--------|------|------------|
| [CoinGecko](https://www.coingecko.com/en/api) | price, market cap, 24h volume | ~30 req/min |
| [Binance](https://www.binance.com/en/binance-api) | bid/ask spread | ~1200 req/min |

## 📋 Requirements

- Python 3.8+
- `requests`, `click`, `pyyaml`

## 📄 License

MIT
