Contributors

We're thrilled that you're interested in contributing to OpenAlgo! This guide will help you get started, whether you're fixing a bug, adding a new broker, improving documentation, or building new features.

Below you'll find everything you need to set up OpenAlgo on your computer and start contributing.


Our Mission

OpenAlgo is built by traders, for traders. We believe in democratizing algorithmic trading by providing a broker-agnostic, open-source platform that puts control back in the hands of traders. Every contribution, no matter how small, helps us achieve this mission.


Table of Contents

  1. Technology Stack

  2. Development Setup

  3. Local Development

  4. Project Structure

  5. Development Workflow

  6. Contributing Guidelines

  7. Testing

  8. Adding a New Broker

  9. UI Development

  10. Documentation

  11. Best Practices

  12. Getting Help


Technology Stack

OpenAlgo is built using Python Flask for the backend and TailwindCSS + DaisyUI for the frontend.

Backend Technologies

  • Python 3.12+ - Core programming language (requires Python 3.10 or higher, 3.12+ recommended)

  • Flask 3.0+ - Lightweight web framework

  • Flask-RESTX - RESTful API with auto-generated Swagger documentation

  • SQLAlchemy 2.0+ - Database ORM for data persistence

  • Flask-SocketIO 5.3+ - Real-time WebSocket connections for live updates

  • Flask-Login - User session management and authentication

  • Flask-WTF - Form validation and CSRF protection

Frontend Technologies

  • Jinja2 - Server-side templating engine

  • TailwindCSS 4.1+ - Utility-first CSS framework

  • DaisyUI 5.1+ - Beautiful component library for Tailwind

  • PostCSS - CSS processing and compilation

  • Chart.js - Data visualization and charting

Trading & Data Libraries

  • pandas 2.2+ - Data manipulation and analysis

  • numpy 2.2+ - Numerical computing

  • httpx - Modern HTTP client with HTTP/2 support

  • websockets 15.0+ - WebSocket client and server

  • pyzmq 26.3+ - ZeroMQ for high-performance message queue

  • APScheduler - Background task scheduling

Security & Performance

  • argon2-cffi - Secure password hashing

  • cryptography - Token encryption

  • Flask-Limiter - Rate limiting

  • Flask-CORS - CORS protection

[!IMPORTANT] You will need Node.js v16+ and Python 3.12 or the latest Python version.


Development Setup

Prerequisites

Before you begin, make sure you have the following installed:

  • Python 3.10 or higher (3.12+ recommended) - Download Python

  • Node.js v16 or higher - Download Node.js

  • Code Editor - VS Code recommended with extensions:

    • Python

    • Pylance

    • Jupyter

  • Basic Knowledge of Flask and REST APIs

Install Dependencies

Configure Environment

Important Security Note: Generate secure random keys:


Local Development

Build Packages

OpenAlgo requires CSS compilation before running. You have two options:

Option 1: Manual Build

Option 2: Automated Development

Run the Application

Option 1: Flask Development Server

Option 2: Production with Gunicorn (Linux only)

Development Workflow with Multiple Terminals

For the best development experience, use two terminals:

Terminal 1 - CSS Watch Mode:

Terminal 2 - Flask Server:

First Time Setup

  1. Access the application: Navigate to http://127.0.0.1:5000

  2. Setup account: Go to http://127.0.0.1:5000/setup

  3. Create admin user: Fill in the setup form

  4. Login: Use your credentials to access the dashboard

  5. Configure broker: Navigate to Settings → Broker Setup


Project Structure

Understanding the codebase structure will help you contribute effectively:

Key Directories

  • broker/: Each subdirectory contains a complete broker integration with authentication, order APIs, data APIs, and symbol mapping

  • restx_api/: RESTful API endpoints with automatic Swagger documentation at /api/docs

  • blueprints/: Web routes and views for the UI

  • templates/: HTML templates using Jinja2 and Tailwind/DaisyUI classes

  • websocket_proxy/: Real-time market data streaming infrastructure

  • services/: Business logic separated from route handlers

  • utils/: Shared utility functions used across the application


Development Workflow

1. Fork and Clone

2. Create a Feature Branch

3. Make Your Changes

Follow these guidelines while developing:

Code Style

  • Python: Follow PEP 8 style guide

  • Formatting: Use 4 spaces for indentation

  • Line Length: Maximum 100 characters recommended

  • Imports: Group by standard library, third-party, local

  • Docstrings: Use Google-style docstrings

Example:

Commit Messages

We follow Conventional Commits specification:

  • feat: - New features

  • fix: - Bug fixes

  • docs: - Documentation changes

  • style: - Code style changes (formatting, no logic change)

  • refactor: - Code refactoring

  • test: - Adding or updating tests

  • chore: - Maintenance tasks

Examples:

4. Test Your Changes

Testing Checklist

5. CSS Compilation (for UI changes)

If you modified any HTML templates or Tailwind classes:

6. Push to Your Fork

7. Create a Pull Request

  1. Go to your fork on GitHub

  2. Click "Compare & pull request"

  3. Fill out the PR template:

    • Title: Clear, descriptive title

    • Description: What does this PR do?

    • Related Issues: Link related issues (e.g., "Closes #123")

    • Screenshots: For UI changes, include before/after screenshots

    • Testing: Describe how you tested the changes

    • Checklist: Complete the PR checklist

Example PR Description:


Contributing Guidelines

What Can You Contribute?

For First-Time Contributors 🌱

Great ways to get started:

  1. Documentation

    • Fix typos in README or docs

    • Improve installation instructions

    • Add examples and tutorials

    • Translate documentation to other languages

  2. Bug Fixes

  3. UI Improvements

    • Enhance styling with Tailwind/DaisyUI

    • Improve mobile responsiveness

    • Add loading states and animations

    • Fix layout issues

  4. Examples

    • Add strategy examples in /strategies

    • Create tutorial notebooks

    • Document common use cases

For Experienced Contributors 🚀

More advanced contributions:

  1. New Broker Integration

    • Add support for new brokers

    • Complete implementation guide in next section

    • Requires understanding of broker APIs

  2. API Endpoints

    • Implement new trading features

    • Enhance existing endpoints

    • Add new data sources

  3. Performance Optimization

    • Optimize database queries

    • Improve caching strategies

    • Reduce API latency

    • Profile and optimize bottlenecks

  4. WebSocket Features

    • Add new streaming capabilities

    • Improve real-time performance

    • Add broker adapters

  5. Testing Infrastructure

    • Write unit tests

    • Add integration tests

    • Set up CI/CD pipelines

    • Create test fixtures

  6. Security Enhancements

    • Audit security vulnerabilities

    • Improve authentication

    • Enhance encryption

    • Add security features


Testing

Manual Testing

OpenAlgo primarily uses manual testing currently:

  1. Application Testing

  2. API Testing

    • Use the built-in Swagger UI at http://127.0.0.1:5000/api/docs

    • Test API endpoints with Postman or curl

    • Verify request/response formats

  3. Cross-Browser Testing

    • Test in Chrome, Firefox, Safari, Edge

    • Verify mobile responsiveness

    • Check for console errors

  4. Error Handling

    • Test with invalid inputs

    • Verify proper error messages

    • Ensure graceful degradation

Automated Testing

Some test files are available in the /test directory:

Writing Tests

When adding tests, follow this structure:


Adding a New Broker

One of the most valuable contributions is adding support for new brokers. Here's a comprehensive guide:

1. Broker Integration Structure

Create a new directory under /broker/your_broker_name/:

2. Implement Required Modules

2.1 Authentication API (api/auth_api.py)

2.2 Order API (api/order_api.py)

2.3 Data API (api/data.py)

2.4 Plugin Configuration (plugin.json)

3. Testing Your Broker Integration

  1. Add broker to VALID_BROKERS in .env

  2. Configure broker credentials

  3. Test authentication flow

  4. Test each API endpoint via Swagger UI

  5. Test WebSocket streaming (if supported)

  6. Validate error handling

4. Documentation

Create a setup guide in /docs/broker_brokername.md:

5. Reference Implementation

Study existing broker implementations as reference:

  • /broker/zerodha/ - Most complete implementation

  • /broker/dhan/ - Modern API design

  • /broker/angel/ - WebSocket streaming


UI Development

Working with Tailwind & DaisyUI

CSS Workflow

  1. NEVER edit /static/css/main.css directly (it's auto-generated!)

  2. Edit source files:

    • Custom CSS: /src/css/styles.css

    • Tailwind classes: Directly in HTML templates (/templates/)

  3. Compile CSS:

  4. Before committing: Always run production build

Using DaisyUI Components

OpenAlgo uses DaisyUI component library:

Theme System

OpenAlgo uses three themes:

  1. Light - Default theme

  2. Dark - Dark mode

  3. Garden - Analyzer/testing mode

Use theme-aware classes:

Responsive Design

Always use responsive Tailwind classes:

Tailwind Configuration

The Tailwind config is in tailwind.config.mjs:


Documentation

Good documentation is crucial for open-source projects.

Code Documentation

  1. Python Docstrings - Use Google-style:

  2. Inline Comments - Explain complex logic:

  3. Type Hints - Use for better IDE support:

User Documentation

  1. README Updates - For new features, update main README.md

  2. API Documentation - Use Flask-RESTX decorators:

  3. Feature Guides - Create detailed guides in /docs:

    • /docs/websocket_usage.md

    • /docs/broker_integration_guide.md

    • /docs/security_best_practices.md


Best Practices

Security

  1. Never commit sensitive data

  2. Validate all inputs

  3. Use parameterized queries

  4. Follow OWASP guidelines

    • Enable CSRF protection (already configured)

    • Use HTTPS in production

    • Implement rate limiting (already configured)

    • Sanitize user inputs

Performance

  1. Optimize database queries

  2. Use caching

  3. Minimize API calls

Code Quality

  1. Write self-documenting code

  2. Keep functions small and focused

  3. Handle errors gracefully


Troubleshooting

Common Issues

CSS Not Updating

Python Dependencies

WebSocket Connection Issues

Database Locked Errors


Getting Help

Support Channels

Before Asking for Help

  1. Search existing issues - Your question might already be answered

  2. Check documentation - Review docs at docs.openalgo.in

  3. Review error logs - Include error messages when asking for help

  4. Provide context - Share your environment (OS, Python version, broker)

Asking Good Questions

When asking for help, include:

  1. Clear description of the problem

  2. Steps to reproduce the issue

  3. Expected behavior vs actual behavior

  4. Error messages (full stack trace)

  5. Environment details:

    • OS and version

    • Python version (python --version)

    • OpenAlgo version

    • Broker being used

Example:


Code Review Process

After submitting your pull request:

  1. Automated Checks

    • Ensure all checks pass

    • Fix any failing checks before requesting review

  2. Review Feedback

    • Address reviewer comments promptly

    • Ask questions if feedback is unclear

    • Make requested changes in new commits

  3. Updates

    • Push additional commits to your branch

    • No need to create a new PR

    • Use git push origin feature/your-feature-name

  4. Approval & Merge

    • Once approved, maintainers will merge

    • Your contribution will be in the next release!

  5. Be Patient

    • Reviews may take a few days

    • Maintainers are volunteers

    • Ping politely if no response after a week


Recognition & Community

Contributors

We value all contributions! Contributors will be:

  • Listed in contributors section on GitHub

  • Mentioned in release notes for significant contributions

  • Part of the OpenAlgo community on Discord

  • Eligible for contributor benefits (coming soon)

Community Guidelines

Be respectful and follow these principles:

  1. Be Respectful - Treat everyone with respect

  2. Be Constructive - Provide helpful feedback

  3. Be Patient - Remember everyone is learning

  4. Be Inclusive - Welcome contributors of all skill levels

  5. Be Professional - Keep discussions focused on code



License

OpenAlgo is released under the AGPL v3.0 License. See the LICENSE file for details.

By contributing to OpenAlgo, you agree that your contributions will be licensed under the AGPL v3.0 License.


Thank You!

Thank you for contributing to OpenAlgo! Your efforts help democratize algorithmic trading and empower traders worldwide. Every line of code, documentation improvement, and bug report makes a difference.

Happy coding, and welcome to the OpenAlgo community!


Built by traders, for traders - making algo trading accessible to everyone.

Last updated

Was this helpful?