Metadata-Version: 2.4
Name: crowelang
Version: 1.0.0
Summary: Professional quantitative trading DSL for strategy development and execution
Home-page: https://github.com/MichaelCrowe11/crowe-lang
Author: Michael Benjamin Crowe
Author-email: Michael Benjamin Crowe <michael.crowe@crowelang.com>
License: Proprietary
Project-URL: Homepage, https://crowelang.com
Project-URL: Documentation, https://crowelang.com/docs
Project-URL: Repository, https://github.com/MichaelCrowe11/crowe-lang
Project-URL: Bug Tracker, https://github.com/MichaelCrowe11/crowe-lang/issues
Project-URL: Pricing, https://crowelang.com/pricing
Project-URL: Support, https://crowelang.com/support
Keywords: trading,quantitative,finance,strategy,dsl,compiler,algotrading
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Intended Audience :: Developers
Classifier: Topic :: Office/Business :: Financial :: Investment
Classifier: Topic :: Software Development :: Compilers
Classifier: License :: Other/Proprietary 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: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: LICENSE.old
Requires-Dist: click>=8.0.0
Requires-Dist: requests>=2.28.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: numpy>=1.20.0
Requires-Dist: pandas>=1.3.0
Requires-Dist: PyYAML>=6.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: black>=22.0.0; extra == "dev"
Requires-Dist: mypy>=1.0.0; extra == "dev"
Requires-Dist: flake8>=5.0.0; extra == "dev"
Dynamic: author
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

# CroweLang - Quantitative Trading DSL

![CroweLang Logo](vscode-extension/icons/crowelang-icon.png)

**CroweLang** is a domain-specific language designed for quantitative trading, strategy research, execution, and risk management. It provides a high-level, expressive syntax for building trading algorithms while compiling to efficient Python, TypeScript, C++, or Rust code.

## 🚀 Quick Start

```bash
# Install CroweLang compiler
npm install -g crowelang

# Compile a strategy
crowelang compile strategy.crowe --target python

# Run backtest
crowelang backtest strategy.crowe --start 2022-01-01 --end 2023-12-31
```

## ✨ Language Features

### Strategy Definition
```crowelang
strategy MeanReversion {
  params {
    lookback: int = 20
    zscore_entry: float = 2.0
    position_size: float = 0.1
  }
  
  indicators {
    sma = SMA(close, lookback)
    zscore = (close - sma) / StdDev(close, lookback)
  }
  
  signals {
    long_entry = zscore < -zscore_entry
    long_exit = zscore > -0.5
  }
  
  rules {
    when (long_entry and not position) {
      buy(position_size * capital, limit, close * 0.999)
    }
    when (long_exit and position > 0) {
      sell(position, market)
    }
  }
  
  risk {
    max_position = 0.25 * capital
    stop_loss = 0.02
    daily_var_limit = 0.03
  }
}
```

### Market Data Types
```crowelang
data Bar {
  symbol: string
  timestamp: datetime
  open: float
  high: float
  low: float
  close: float
  volume: int
}

data OrderBook {
  symbol: string
  timestamp: datetime
  bids: Level[]
  asks: Level[]
  spread: float = asks[0].price - bids[0].price
}
```

### Built-in Indicators
```crowelang
indicator RSI(series: float[], period: int = 14) -> float {
  gains = [max(0, series[i] - series[i-1]) for i in 1..len(series)]
  losses = [max(0, series[i-1] - series[i]) for i in 1..len(series)]
  rs = avg(gains[-period:]) / avg(losses[-period:])
  return 100 - (100 / (1 + rs))
}
```

## 🛠️ Development Phases

### Phase 0: Foundation (Weeks 0-4) ✅
- [x] Core language parser and AST
- [x] Basic backtest engine
- [x] VS Code extension with syntax highlighting
- [x] Example strategies (mean reversion, market making)
- [x] Mock broker connections

**Target KPI**: 1k VS Code extension installs, 3 early fund user interviews

### Phase 1: Pro Tools (Months 1-3)
- [ ] Event-driven backtester
- [ ] Real broker connections (IBKR, Alpaca, Polygon)
- [ ] Portfolio optimization engine
- [ ] Risk analytics dashboard
- [ ] Strategy cookbook and templates

**Pricing**: 
- Indie: $149/month
- Fund (≤$100M AUM): $24k/year  
- Enterprise (>$100M): Custom pricing

**Target KPI**: 5 paid funds, $250k ARR

### Phase 2: Production (Months 4-12)
- [ ] Live execution engine
- [ ] Co-location support
- [ ] Smart order routing
- [ ] Compliance and audit logs
- [ ] Alternative data ingestion

**Add-ons**: 
- Routing + co-location: $50k-$150k/year
- Alt-data feeds: $25k-$100k/year

**Target KPI**: 15 funds, 2 HFT pilots, $1-3M ARR

### Phase 3: Enterprise (Years 1-3)
- [ ] Multi-venue execution
- [ ] Cross-asset support (options, futures, forex, crypto)
- [ ] Regulatory compliance (MiFID II, SEC reporting)
- [ ] Strategy marketplace with revenue share
- [ ] Certification program

**Target KPI**: 50+ funds, $5-20M ARR, zero critical audit incidents

## 🎯 Compilation Targets

| Target | Use Case | Performance | Libraries |
|--------|----------|-------------|-----------|
| **Python** | Research, backtesting | Fast development | pandas, numpy, scipy |
| **TypeScript** | Web dashboards, APIs | Good balance | Node.js ecosystem |
| **C++** | Low-latency execution | Ultra-high performance | Boost, Intel TBB |
| **Rust** | Safety-critical systems | High performance + safety | tokio, serde |

## 📦 Standard Library

### Data Providers
- **Polygon.io**: Real-time and historical market data
- **Interactive Brokers**: Professional trading platform
- **Alpaca**: Commission-free stock trading API
- **Binance**: Cryptocurrency exchange
- **Yahoo Finance**: Free historical data

### Technical Indicators
- **Trend**: SMA, EMA, MACD, ADX, Parabolic SAR
- **Momentum**: RSI, Stochastic, Williams %R, ROC
- **Volatility**: Bollinger Bands, ATR, Standard Deviation
- **Volume**: OBV, VWAP, Accumulation/Distribution

### Risk Models
- **Value at Risk**: Historical, Monte Carlo, Parametric
- **Factor Models**: Fama-French, BARRA, Custom
- **Stress Testing**: Historical scenarios, Monte Carlo
- **Portfolio Optimization**: Mean-variance, Black-Litterman

### Execution Algorithms
- **TWAP**: Time-weighted average price
- **VWAP**: Volume-weighted average price
- **POV**: Percent of volume
- **Implementation Shortfall**: Minimize market impact
- **Iceberg**: Hide large order size

## 🏗️ Architecture

```
┌─────────────────────────────────────────────────────────────┐
│                     CroweLang DSL                           │
├─────────────────────────────────────────────────────────────┤
│  Strategy Code (.crowe files)                              │
└─────────────────┬───────────────────────────────────────────┘
                  │
┌─────────────────▼───────────────────────────────────────────┐
│                   Compiler                                  │
├─────────────────────────────────────────────────────────────┤
│  Lexer → Parser → AST → Validator → Code Generator         │
└─────────┬───────┬───────┬─────────────────────────────┬─────┘
          │       │       │                             │
    ┌─────▼─┐ ┌───▼───┐ ┌─▼──┐                    ┌────▼────┐
    │Python │ │TypeScript│ │C++ │                    │  Rust   │
    └───────┘ └───────┘ └────┘                    └─────────┘
          │       │       │                             │
    ┌─────▼─┐ ┌───▼───┐ ┌─▼──────┐              ┌──────▼──────┐
    │Pandas │ │Node.js│ │Low     │              │Safe Systems │
    │NumPy  │ │React  │ │Latency │              │High Perf    │
    └───────┘ └───────┘ └────────┘              └─────────────┘
```

## 🔧 Installation

### VS Code Extension
1. Open VS Code
2. Go to Extensions (Ctrl+Shift+X)
3. Search for "CroweLang"
4. Install the extension

### Compiler
```bash
# Via npm
npm install -g crowelang

# Via pip (Python target)
pip install crowelang

# From source
git clone https://github.com/croweai/crowelang.git
cd crowelang
npm install
npm run build
```

## 📖 Documentation

- [Language Reference](docs/language-reference.md)
- [Standard Library](docs/standard-library.md)
- [Strategy Examples](examples/)
- [API Documentation](docs/api.md)
- [Performance Guide](docs/performance.md)

## 🤝 Contributing

We welcome contributions! See our [Contributing Guide](CONTRIBUTING.md) for details.

## 📊 Performance Benchmarks

| Strategy Type | Python | TypeScript | C++ | Rust |
|---------------|--------|------------|-----|------|
| **Mean Reversion** | 2.1ms | 1.8ms | 0.3ms | 0.4ms |
| **Market Making** | 5.2ms | 4.1ms | 0.8ms | 0.9ms |
| **Pairs Trading** | 3.7ms | 2.9ms | 0.5ms | 0.6ms |

*Benchmarks: 1M bars, 10 strategies, Intel i7-12700K*

## 🏆 Success Stories

> "CroweLang reduced our strategy development time by 70% while improving backtest reliability. The risk management features are exactly what we needed."
> 
> — **Jane Chen, CTO at Meridian Capital**

> "We deployed 15 market making strategies in production using CroweLang's C++ target. Rock solid performance with sub-microsecond latency."
> 
> — **Alex Rodriguez, Head of Trading at Quantum Dynamics**

## 🔒 Security & Compliance

- **SOC 2 Type II** certified
- **ISO 27001** compliant
- **MiFID II** reporting ready
- **SEC** audit trail support
- End-to-end encryption for all data

## 📈 Roadmap

See our detailed [Product Roadmap](ROADMAP.md) for upcoming features and timelines.

## 📄 License

CroweLang is open-source under the [MIT License](LICENSE). Commercial runtime and enterprise features require a separate license.

## 🌐 Community

- [Discord Server](https://discord.gg/crowelang)
- [GitHub Discussions](https://github.com/croweai/crowelang/discussions)  
- [Stack Overflow](https://stackoverflow.com/questions/tagged/crowelang)
- [Reddit Community](https://reddit.com/r/crowelang)

## 📞 Commercial Support

For enterprise support, training, or custom development:

- **Email**: enterprise@crowelang.com
- **Website**: https://crowelang.com
- **Calendar**: [Book a Demo](https://calendly.com/crowelang/demo)

---

**Building the future of quantitative trading, one strategy at a time.** 🚀
