Metadata-Version: 2.4
Name: pnl-core
Version: 0.7.1
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
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 :: Rust
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Office/Business :: Financial :: Investment
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Intended Audience :: Developers
Requires-Dist: requests>=2.25.0
Requires-Dist: ccxt>=3.0.0
Requires-Dist: smartapi-python>=1.3.4
Requires-Dist: logzero
Requires-Dist: pyotp
Requires-Dist: websocket-client
Requires-Dist: numpy
Requires-Dist: scikit-learn
Requires-Dist: python-dateutil
Requires-Dist: aiohttp
Requires-Dist: alpaca-py
Summary: Infrastructure Economics Advisor: Measure Kyle's Lambda fairness gaps using Rust-accelerated calculations. Optimize trading strategy within broker latency constraints.
Keywords: trading,execution,fairness,kyle-lambda,market-microstructure,infrastructure-economics,rust,quantitative-finance
Author-email: Soham Mirajkar <b25bs1197@iitj.ac.in>
Requires-Python: >=3.7
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: ArXiv Paper, https://arxiv.org/abs/coming-soon
Project-URL: Bug Tracker, https://github.com/sohammirajkar/pnl_watchdog/issues
Project-URL: Documentation, https://github.com/sohammirajkar/pnl_watchdog#readme
Project-URL: Homepage, https://github.com/sohammirajkar/pnl_watchdog
Project-URL: Repository, https://github.com/sohammirajkar/pnl_watchdog
Project-URL: Research, https://github.com/sohammirajkar/pnl_watchdog/tree/main/research

# PnL Watchdog for Crypto Market Makers

PnL Watchdog is a read-only execution intelligence layer for market makers on crypto venues like Bybit.

It helps you answer one question fast: `is my edge being eaten by microstructure friction?`

## Why it is useful

- Measures execution friction (impact, slippage, toxicity proxies, order-flow quality)
- Flags anomaly windows where fills degrade (latency/slippage outliers)
- Gives user-scoped import + analytics from your own account history
- Works with read-only exchange credentials (no trade/withdraw permissions required)

## 5-minute setup

1. Start API:

```bash
uvicorn pnl_watchdog_lib.api.main:app --host 0.0.0.0 --port 8000
```

2. Register your PnL Watchdog API key:

```bash
curl -X POST http://localhost:8000/v1/auth/register \
  -H "Content-Type: application/json" \
  -d '{"email":"you@example.com"}'
```

3. Import Bybit read-only trade history:

```bash
curl -X POST http://localhost:8000/import/bybit \
  -H "Content-Type: application/json" \
  -H "X-API-Key: pnlw_your_key" \
  -d '{"api_key":"BYBIT_READ_KEY","api_secret":"BYBIT_READ_SECRET","market_type":"swap","lookback_days":7}'
```

4. Get your execution stats:

```bash
curl -X GET http://localhost:8000/stats/pnl \
  -H "X-API-Key: pnlw_your_key"
```

## Security model

- Use exchange keys with `read-only` scope only.
- PnL Watchdog API keys are stored hashed at rest.
- Data is scoped per authenticated user.

