# Contributing to nanobook
Thank you for your interest in contributing to nanobook!
## Getting Started
1. Fork the repository
2. Clone your fork: `git clone https://github.com/YOUR_USERNAME/nanobook.git`
3. Create a branch: `git checkout -b feature/your-feature`
4. Make your changes
5. Run tests: `cargo test --all-features`
6. Run lints: `cargo fmt && cargo clippy -- -D warnings`
7. Commit and push
8. Open a pull request
## Development Setup
```bash
# Install Rust (if needed)
# Clone and build
git clone https://github.com/ricardofrantz/nanobook.git
cd nanobook
cargo build
# Run tests
cargo test --all-features
# Run benchmarks
cargo bench
# Try the CLI
cargo run --bin lob
```
## Code Style
- Follow standard Rust conventions
- Run `cargo fmt` before committing
- All code must pass `cargo clippy -- -D warnings`
- Add tests for new functionality
- Update documentation for API changes
## Pull Request Guidelines
- Keep PRs focused on a single change
- Include tests for bug fixes and new features
- Update CHANGELOG.md for user-facing changes
- Ensure CI passes before requesting review
## Testing
```bash
# Run all tests
cargo test --all-features
# Run with no default features (no event logging)
cargo test --no-default-features
# Run benchmarks
cargo bench
```
## Architecture
See [DOC.md](DOC.md) for the developer reference. Key crates:
| `nanobook` | Core LOB engine, portfolio simulator, backtest bridge |
| `nanobook-broker` | Broker trait + IBKR/Binance implementations + mock |
| `nanobook-risk` | Pre-trade risk engine (position limits, leverage, drawdown) |
| `nanobook-rebalancer` | Target-weight portfolio rebalancer with audit trail |
| `python/` | PyO3 bindings for all of the above |
## Reporting Issues
- Search existing issues first
- Include Rust version (`rustc --version`)
- Provide minimal reproduction steps
- Include expected vs actual behavior
## License
By contributing, you agree that your contributions will be licensed under the MIT License.