Skip to content

Contributing to RustyBT

We welcome contributions to RustyBT! This guide will help you get started.

Code of Conduct

By participating in this project, you agree to maintain a respectful and inclusive environment for all contributors.

How to Contribute

Reporting Bugs

  1. Check if the bug has already been reported in GitHub Issues
  2. If not, create a new issue with:
  3. Clear title and description
  4. Steps to reproduce
  5. Expected vs. actual behavior
  6. Environment details (OS, Python version, RustyBT version)

Suggesting Enhancements

  1. Check GitHub Discussions for similar ideas
  2. Create a new discussion or issue describing:
  3. The problem you're trying to solve
  4. Your proposed solution
  5. Any alternative approaches considered

Contributing Code

Development Setup

  1. Fork and Clone

    git clone https://github.com/YOUR_USERNAME/rustybt.git
    cd rustybt
    

  2. Install Development Dependencies

    # Using uv (recommended)
    uv sync --all-extras
    
    # Or using pip
    pip install -e ".[dev,test]"
    

  3. Install Pre-commit Hooks

    pre-commit install
    

Development Workflow

  1. Create a Branch

    git checkout -b feature/your-feature-name
    

  2. Make Changes

  3. Follow PEP 8 and project conventions
  4. Write tests for new functionality
  5. Update documentation as needed

  6. Run Tests

    # Run full test suite
    pytest tests/ -v
    
    # Run with coverage
    pytest tests/ --cov=rustybt --cov-report=html
    
    # Run specific tests
    pytest tests/finance/test_decimal_ledger.py
    

  7. Code Quality Checks

    # Format code
    black rustybt/ tests/
    
    # Lint code
    ruff check rustybt/ tests/
    
    # Type check
    mypy rustybt/ --strict
    

  8. Commit Changes

    git add .
    git commit -m "feat: add your feature description"
    

Follow Conventional Commits: - feat: - New feature - fix: - Bug fix - docs: - Documentation changes - test: - Test changes - refactor: - Code refactoring - perf: - Performance improvements

  1. Push and Create Pull Request
    git push origin feature/your-feature-name
    

Then create a pull request on GitHub with: - Clear description of changes - Related issue numbers - Test results

Development Guidelines

Testing Standards

  • Zero-Mock Policy: We prefer integration tests over mocks whenever possible
  • Property-Based Testing: Use Hypothesis for financial calculations
  • Coverage Target: Aim for 90%+ test coverage

Code Style

  • Follow PEP 8
  • Use type hints (Python 3.12+)
  • Write docstrings in Google style
  • Keep functions focused and small

Documentation

  • Update user guides for user-facing changes
  • Update architecture docs for design changes
  • Add code examples for new features
  • Keep API documentation current

Project Structure

rustybt/
├── rustybt/          # Source code
│   ├── finance/      # Financial calculations
│   ├── data/         # Data management
│   ├── live/         # Live trading
│   └── ...
├── tests/            # Test suite
├── docs/             # Documentation
├── examples/         # Example strategies
└── benchmarks/       # Performance benchmarks

Areas for Contribution

High Priority

  • Broker adapter implementations
  • Data source adapters
  • Performance optimizations
  • Documentation improvements
  • Bug fixes

Medium Priority

  • New order types
  • Additional metrics
  • UI/visualization improvements
  • Example strategies

Research/Experimental

  • Rust module implementations
  • Machine learning integrations
  • Alternative data sources
  • Advanced analytics

Questions?

  • GitHub Discussions: For general questions and ideas
  • GitHub Issues: For bugs and feature requests
  • Documentation: Check the User Guides and Examples

License

By contributing, you agree that your contributions will be licensed under the Apache License 2.0. See License for details.

Acknowledgments

Thank you for contributing to RustyBT! Every contribution helps make algorithmic trading more accessible and robust.