Infrastructure Economics Advisor: Measure Kyle's Lambda fairness gaps using Rust-accelerated calculations. Optimize trading strategy within broker latency constraints.
Project description
🐶 PnL Watchdog: Infrastructure Economics Advisor
Measure the hidden cost of your execution. Optimize your strategy within broker constraints.
Your broker shows you filled orders. But are you getting the same prices as institutions?
No. You're paying a latency tax. Every single trade.
pnl-watchdog measures Kyle's Lambda fairness gaps between retail and institutional execution using Rust-accelerated calculations—then shows you exactly how much that gap costs you and how to trade profitably within it.
Stop fighting latency. Start optimizing around it.
🚀 Key Features
- Kyle's Lambda Calculator: Measure price impact per signed volume (Rust-accelerated)
- Fairness Audit: Compare retail vs institutional execution costs
- AI Anomaly Detection: Catch unusual latency/slippage patterns
- Smart Order Routing: Get broker recommendations based on real-time performance
- Privacy First: No strategy exposure—only anonymous telemetry
⚡ Performance: Powered by Rust
| Operation | Rust | Python | Speedup |
|---|---|---|---|
| Kyle's Lambda (10k candles) | 0.1ms | 50ms | 500x faster |
| Fairness Audit (5 samples) | 100ms | 1-2s | 20x faster |
| Batch Processing (1000 symbols) | 100ms | 50s | 500x faster |
📦 Installation
pip install pnl-watchdog
🎯 Quick Start
from pnl_watchdog import PnLWatchdog
# Initialize with your broker credentials
dog = PnLWatchdog(
broker="alpaca",
api_key="YOUR_API_KEY",
api_secret="YOUR_SECRET_KEY"
)
# Verify a trade
result = dog.check_order("AAPL", "buy", 10)
print(f"Trade verified in {result['latency_ms']}ms")
# Calculate Kyle's Lambda for market analysis
from pnl_watchdog import calculate_whale_metrics
opens = [100.0, 101.0, 102.0, 101.5, 100.5]
closes = [101.0, 102.0, 101.5, 100.5, 101.0]
volumes = [1000.0, 2000.0, 1500.0, 500.0, 1200.0]
amihud, kyles_lambda = calculate_whale_metrics(opens, closes, volumes)
print(f"Kyle's Lambda: {kyles_lambda}")
📊 Advanced Analytics
# Get institutional order flow metrics
from pnl_watchdog import calculate_order_flow_metrics
prices = [100.0, 101.0, 102.0, 101.5, 100.5]
volumes = [1000.0, 2000.0, 1500.0, 500.0, 1200.0]
bids = [99.9, 100.9, 101.9, 101.4, 100.4]
asks = [100.1, 101.1, 102.1, 101.6, 100.6]
vwap_dev, tox, nof, obi, vwap = calculate_order_flow_metrics(prices, volumes, bids, asks)
print(f"Toxicity Score: {tox}")
print(f"VWAP: {vwap}")
🤝 Supported Brokers
- Alpaca
- Interactive Brokers
- Binance (and other CCXT-supported exchanges)
- Zerodha
- Angel One
📚 Documentation
📞 Support
For issues, feature requests, or questions, please open an issue on GitHub.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pnl_watchdog-0.6.1-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: pnl_watchdog-0.6.1-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 257.4 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f0b76456d297afd3ae380e3ab22e4a4944ff0421d80d596b4294b57f8130668
|
|
| MD5 |
d766fe25258013be40972d7bb3d66a92
|
|
| BLAKE2b-256 |
2ac430d0f90378b4944fe3f257f9b61328abecb0adf8786b8d60771674ccd59d
|