Skip to main content

CroweLang - Quantitative Trading DSL

CroweLang Logo

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

# 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

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

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

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) ✅

  • Core language parser and AST
  • Basic backtest engine
  • VS Code extension with syntax highlighting
  • Example strategies (mean reversion, market making)
  • 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

# 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

🤝 Contributing

We welcome contributions! See our Contributing Guide 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 for upcoming features and timelines.

📄 License

CroweLang is open-source under the MIT License. Commercial runtime and enterprise features require a separate license.

🌐 Community

📞 Commercial Support

For enterprise support, training, or custom development:


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

Release files for crowelang 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for crowelang 1.0.0
File Size Uploaded
crowelang-1.0.0.tar.gz 28.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for crowelang 1.0.0
File Interpreter ABI Platform
crowelang-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 40.0 kB

Release files / crowelang-1.0.0.tar.gz

Download URL crowelang-1.0.0.tar.gz
Size 28.9 kB
Tags Source
SHA-256 checksum
How to use checksums
802ba61e32a4df0d29dc6d8e2e420ae84d73083cbcbbc4986651cb04c0687ece
BLAKE2b-256 checksum
How to use checksums
8b11b88e5a22c17f62816d3dda8c35de6cae4178a3ad7c358d7c939a979a853a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release files / crowelang-1.0.0-py3-none-any.whl

Download URL crowelang-1.0.0-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d17dd1defb15e1e7d0327540eac6865e2f9623193e6d67703a8f887321fa07bf
BLAKE2b-256 checksum
How to use checksums
35371141a49b6aef7dbf698c149c15ae0b50f8efc02db01d5db5cd8b6da87118
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page