Contributing¶
Thank you for your interest in contributing to PolyBot!
Getting Started¶
Development Setup¶
# Clone the repository
git clone https://github.com/cryptuon/polybot
cd polybot
# Install dependencies
uv sync --dev
# Install frontend dependencies
cd frontend && npm install && cd ..
# Run tests
uv run pytest
Code Quality¶
# Linting
uv run ruff check src/ tests/
# Format
uv run ruff format src/ tests/
# Type checking
uv run mypy src/polybot/
How to Contribute¶
Reporting Bugs¶
- Search existing issues
- Create a new issue with:
- Clear description
- Steps to reproduce
- Expected vs actual behavior
- Environment details
Suggesting Features¶
- Check the roadmap
- Open a discussion for major features
- Create an issue with use case and proposed solution
Pull Requests¶
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature - Make changes with tests
- Run checks:
uv run pytest && uv run ruff check - Commit:
git commit -m "Add feature: description" - Push:
git push origin feature/my-feature - Open a pull request
Code Guidelines¶
Python Style¶
- Type hints required
- Google-style docstrings
- 100 character line limit
- Use
rufffor formatting
async def process_signal(
signal: Signal,
executor: ExecutorService,
*,
validate: bool = True,
) -> OrderResult:
"""Process a trading signal.
Args:
signal: The trading signal.
executor: Executor service instance.
validate: Whether to validate first.
Returns:
Result of order execution.
"""
...
Testing¶
- Write tests for new features
- Maintain >80% coverage
- Use pytest fixtures
- Test edge cases
@pytest.fixture
def strategy():
return ArbitrageStrategy()
async def test_scan_finds_opportunity(strategy, price_update):
signals = await strategy.scan(price_update)
assert len(signals) == 1
Commits¶
- Clear, concise messages
- Reference issues:
Fixes #123 - One logical change per commit
Project Structure¶
polybot/
├── src/polybot/ # Main package
│ ├── api/ # FastAPI routes
│ ├── core/ # Core utilities
│ ├── db/ # Database stores
│ ├── models/ # Pydantic models
│ ├── plugins/ # AI plugins
│ ├── services/ # Background services
│ ├── strategies/ # Trading strategies
│ └── venues/ # Venue integrations
├── frontend/ # Vue.js dashboard
├── tests/ # Test suite
├── documentation/ # MkDocs
└── deploy/ # Deployment configs
Adding Features¶
New Strategy¶
- Create
src/polybot/strategies/my_strategy.py - Inherit from
BaseStrategy - Register in
strategies/__init__.py - Add tests
- Add documentation
New AI Plugin¶
- Create
src/polybot/plugins/my_plugin.py - Inherit from
AIModelPlugin - Register in plugin discovery
- Add tests and docs
New Venue¶
- Create
src/polybot/venues/my_venue.py - Inherit from
BaseVenue - Add configuration
- Register and test
Community¶
License¶
By contributing, you agree that your contributions will be licensed under the MIT License.