Contributors

Let's democratize algorithmic trading, together!

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. Frontend Development

  10. Documentation

  11. Best Practices

  12. Getting Help


Technology Stack

OpenAlgo uses a Python Flask backend with a React 19 single-page application frontend.

Backend Technologies

  • Python 3.12+ - Core programming language

  • uv - Fast Python package manager (replaces pip/venv)

  • Flask 3.1+ - Lightweight web framework

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

  • SQLAlchemy 2.0+ - Database ORM for data persistence

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

  • Flask-Login - User session management and authentication

  • Flask-WTF - Form validation and CSRF protection

  • Ruff - Fast Python linter and formatter

Frontend Technologies

  • React 19 - Component-based UI library

  • TypeScript 5.9+ - Type-safe JavaScript

  • Vite 7+ - Fast build tool and dev server

  • TailwindCSS 4 - Utility-first CSS framework

  • shadcn/ui (Radix UI) - Accessible component primitives

  • TanStack Query 5 - Server state management

  • Zustand 5 - Client state management

  • React Router 7 - Client-side routing

  • Plotly.js / Lightweight Charts - Data visualization

  • Socket.IO Client - Real-time communication

  • Biome.js - Fast linter and formatter

  • Vitest - Unit testing framework

  • Playwright - End-to-end testing

Trading & Data Libraries

  • pandas 2.3+ - Data manipulation and analysis

  • numpy 2.0+ - Numerical computing

  • DuckDB - Historical market data storage

  • httpx - Modern HTTP client with HTTP/2 support

  • websockets 15.0+ - WebSocket client and server

  • pyzmq - ZeroMQ for high-performance message queue

  • APScheduler - Background task scheduling

  • scipy / py_vollib / numba - Options analytics and Greeks

Security & Performance

  • argon2-cffi - Secure password hashing

  • cryptography - Token encryption

  • Flask-Limiter - Rate limiting

  • Flask-CORS - CORS protection

[!IMPORTANT] You will need Python 3.12+, Node.js 20/22/24, and the uv package manager.


Development Setup

Prerequisites

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

Install Dependencies

[!IMPORTANT] Always use uv run to run Python commands. Never use global Python or manually manage virtual environments. The uv tool automatically creates and manages a .venv for the project.

Configure Environment

[!NOTE] Static IP whitelisting: Many Indian brokers require you to whitelist a static IP address when generating API keys and secrets. If you are developing locally, you may need to whitelist your public IP. For cloud/VPS deployments, use the server's static IP. Check your broker's API documentation for specific requirements.


Local Development

Run the Application

Development Workflow with Multiple Terminals

For the best development experience when working on the frontend, use two terminals:

Terminal 1 - React Dev Server (hot reload):

Terminal 2 - Flask Backend:

Note: The React dev server proxies API requests to the Flask backend. For production testing, build the frontend with npm run build and access everything through Flask at port 5000.

Production Mode (Linux only)

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 and set up your broker

Access Points

  • Main app: http://127.0.0.1:5000

  • React frontend: http://127.0.0.1:5000/react

  • Swagger API docs: http://127.0.0.1:5000/api/docs

  • API Analyzer: http://127.0.0.1:5000/analyzer


Project Structure

Understanding the codebase structure will help you contribute effectively:

Key Directories

  • frontend/: React 19 SPA with TypeScript, built with Vite and served by Flask via blueprints/react_app.py

  • broker/: Each subdirectory contains a complete broker integration with api/, database/, mapping/, streaming/, and plugin.json

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

  • blueprints/: Flask route handlers for UI pages and webhooks

  • services/: Business logic separated from route handlers

  • websocket_proxy/: Real-time market data streaming via unified WebSocket proxy

  • database/: 5 separate databases for isolation (main, logs, latency, sandbox, historify)


Development Workflow

1. Fork and Clone

Important: Disable GitHub Actions on Your Fork

After forking, go to your fork's Settings → Actions → General (https://github.com/YOUR_USERNAME/openalgo/settings/actions) and select "Disable actions" under Actions permissions. This prevents CI workflows (frontend builds, Docker pushes) from running on your fork unnecessarily — those workflows are only meant to run on the upstream repository.

2. Frontend Build Assets (Auto-Built by CI)

The /frontend/dist directory is gitignored and not tracked in the repository. CI automatically builds the frontend when changes are merged to main.

How it works:

  • PRs are tested with a fresh frontend build (but not committed)

  • When merged to main, CI automatically:

    1. Builds the frontend (cd frontend && npm run build)

    2. Pushes Docker image to Docker Hub

For Contributors:

  • Build locally for development: cd frontend && npm install && npm run build

  • Do NOT commit frontend/dist/ — it is gitignored

  • Focus on source code changes — CI handles production builds

3. Create a Feature Branch

4. Make Your Changes

Follow these guidelines while developing:

Python Code Style

  • Follow PEP 8 style guide

  • Use 4 spaces for indentation

  • Maximum 100 characters line length (configured in Ruff)

  • Imports: Standard library → Third-party → Local

  • Use Google-style docstrings

Run the linter:

React/TypeScript Code Style

  • Follow Biome.js rules (configured in frontend/biome.json)

  • Use functional components with hooks

  • Component files use PascalCase: MyComponent.tsx

  • Use TanStack Query for server state, Zustand for client state

Run the linter:

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:

5. Test Your Changes

Testing Checklist

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


Contributing Guidelines

Contribution Policy: One Feature or One Fix at a Time

OpenAlgo follows a strict incremental contribution standard. We require all contributions to be submitted as:

  • One feature per pull request, OR

  • One fix per pull request

Why this matters:

OpenAlgo supports a growing list of brokers, and every change must be validated across this broad surface area. Large integrations submitted in a single PR require extensive manual testing and verification that is not practical for the maintainers to review all at once.

Additionally, many contributions today are developed with AI assistance, which can accelerate development substantially but also increases the need for careful human review, testing, and incremental verification before acceptance into a shared upstream project.

What this means in practice:

  • Break large features into small, self-contained pull requests

  • Each PR should be independently reviewable and testable

  • Submit them sequentially — wait for one to be reviewed before sending the next

  • Large monolithic PRs or full-project integrations will not be accepted in their current form

  • Exception — New broker integrations may be submitted as a single PR since they are self-contained within their own broker/ directory and don't modify core platform code

If you have a large integration or project built on OpenAlgo:

We appreciate and encourage projects built on top of OpenAlgo (it's why we're open-source!). However, we cannot merge large codebases as a single contribution. Instead, extract individual improvements, fixes, or self-contained features and submit them separately. This gives each contribution a much better chance of being reviewed and accepted.


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

  2. Bug Fixes

  3. UI Improvements

    • Enhance React components

    • 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. React Frontend Features

    • Build new pages or components

    • Add data visualizations with Plotly/Lightweight Charts

    • Improve real-time updates via Socket.IO

  4. Performance Optimization

    • Optimize database queries

    • Improve caching strategies

    • Reduce API latency

  5. WebSocket Features

    • Add new streaming capabilities

    • Improve real-time performance

    • Add broker WebSocket adapters

  6. Testing

    • Write Vitest unit tests for React components

    • Write Playwright end-to-end tests

    • Write pytest tests for backend services

    • Improve test coverage

  7. Security Enhancements

    • Audit security vulnerabilities

    • Improve authentication

    • Enhance encryption


Testing

Python Backend Tests

React Frontend Tests

Writing Python Tests

Writing React Tests

Writing E2E Tests


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 in .env

  3. Test authentication flow

  4. Test each API endpoint via Swagger UI at /api/docs

  5. Test WebSocket streaming (if supported)

  6. Validate error handling

4. Reference Implementations

Study existing broker implementations:

  • /broker/zerodha/ - Most complete implementation

  • /broker/dhan/ - Modern API design

  • /broker/angel/ - WebSocket streaming


Frontend Development

React + shadcn/ui Architecture

The frontend is a React 19 SPA located in /frontend/. It is built with Vite and served by Flask in production via blueprints/react_app.py.

Development Server

Component Library

OpenAlgo uses shadcn/uiarrow-up-right built on Radix UI primitives with Tailwind CSS:

Server State with TanStack Query

Client State with Zustand

Styling with Tailwind CSS 4

Use Tailwind utility classes directly. Always use responsive and theme-aware patterns:

Linting and Formatting


Documentation

Code Documentation

  1. Python Docstrings - Use Google-style:

  2. TypeScript - Use JSDoc where types alone aren't sufficient:

  3. API Documentation - Use Flask-RESTX decorators:


Best Practices

Security

  1. Never commit sensitive data

  2. Validate all inputs at system boundaries

  3. Use parameterized queries (SQLAlchemy ORM)

  4. Follow OWASP guidelines

    • Enable CSRF protection (already configured)

    • Use HTTPS in production

    • Rate limiting is configured per endpoint

    • Sanitize user inputs

Performance

  1. Optimize database queries

  2. Use caching

  3. Minimize API calls — use batch endpoints

Code Quality

  1. Write self-documenting code

  2. Keep functions small and focused

  3. Return consistent JSON responses from API endpoints


Troubleshooting

Common Issues

Frontend Build Errors

Python Dependency Issues

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, Node 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)

    • Node.js version (node --version)

    • OpenAlgo version

    • Broker being used


Code Review Process

After submitting your pull request:

  1. Automated Checks

    • CI will build the frontend and run linting

    • Ensure all checks pass 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

  4. Approval & Merge

    • Once approved, maintainers will merge

    • CI will automatically build the frontend for production

  5. Be Patient

    • Reviews may take a few days

    • Maintainers are volunteers

    • Ping politely if no response after a week


Recognition & Community

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

Community Guidelines

  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