Documentation
HomeGithubDiscordBlog
  • What is OpenAlgo?
  • OpenAlgo Architecture
  • Mini FOSS Universe
  • Community Support
  • OpenAlgo GPT
  • New Features
    • Fast Scalper
    • API Analyzer
    • Traffic/Latency Monitor
    • Chartink Integration
  • Monetization
  • Connect Brokers
    • Brokers
      • 5Paisa
      • 5paisa (XTS)
      • AliceBlue
      • AngelOne
      • Compositedge
      • Dhan
      • Dhan(Sandbox)
      • Firstock
      • FlatTrade
      • Fyers
      • Groww
      • IIFL (XTS)
      • Jainam Retail (XTS)
      • Jainam Dealer (XTS)
      • Kotak Securities
      • Paytm
      • Pocketful
      • Shoonya
      • Tradejini
      • Upstox
      • Wisdom Capital
      • Zebu
      • Zerodha
  • Installation Guidelines
  • Getting Started
    • Windows Installation
      • Pre-Requesites
      • Setup
      • Install Dependencies
      • Ngrok Config
      • Environmental Variables
      • Start OpenAlgo
      • SSL Verification Failed
      • Accessing OpenAlgo
    • Windows Server Installation
    • Mac OS Installation
      • Pre-Requesties
      • Setup
      • Install Dependencies
      • Ngrok Config
      • Environmental Variables
      • Start OpenAlgo
      • Install certifi
      • Accessing OpenAlgo
    • Amazon Elastic Beanstalk
    • Ubuntu Server Installation
    • Docker Development
    • Testing OpenAlgo in Cloud
    • Upgrade
  • Latency
  • API Documentation
    • V1
      • Accounts API
        • Funds
        • Orderbook
        • Tradebook
        • PositionBook
        • Holdings
      • Orders API
        • Placeorder
        • PlaceSmartOrder
        • BasketOrder
        • SplitOrder
        • ModifyOrder
        • CancelOrder
        • CancelAllOrder
        • ClosePosition
        • OrderStatus
        • OpenPosition
      • Data API
        • Quotes
        • Depth
        • History
        • Intervals
        • Symbol
        • Ticker
      • Websockets
      • Order Constants
      • HTTP Status Codes
      • Rate Limiting
      • API Collections
  • Symbol Format
  • MCP
  • Trading Platform
    • Amibroker
      • AmiQuotes
      • Button Trading Module
      • Button Trading with Split Orders
      • Button Trading with Stoploss
      • SmartOrder Chart Module
      • Trailing Stoploss Execution Module
      • Line Trading Module
      • Equity Exploration Module
      • CSV Exploration Module
      • Options Button Trading Module
      • Spot/Futures to Options Module (Single Leg)
      • Spot/Futures to Options Module (Two Leg)
      • Time Based Execution
    • Tradingview
      • Futures to Options Module
    • ChartInk
    • Python
      • Strategy Management
      • EMA Crossover Strategy
      • EMA Crossover Strategy with Stoploss and Target
      • Supertrend Strategy
      • Supertrend Strategy with yfinance data
      • Voice Based Orders
    • NodeJS
    • Metatrader 5
      • Download & Install Library
      • OpenAlgo MQL5 Functions
      • Include the Header File
      • Sample Expert Advisor
    • Excel
    • Google Spreadsheets
    • N8N
    • Chrome Extension
  • Strategy Management
  • Developers
    • Design Documentation
      • Architecture
      • API Layer
      • Broker Integerations
      • Database Layer
      • Authentication Platforms
      • Configuration
      • Utilities
      • Broker Integration Checklist
  • Change Log
    • Version 1.0.0.25 Launched
    • Version 1.0.0.24 Launched
    • Version 1.0.0.23 Launched
    • Version 1.0.0.22 Launched
    • Version 1.0.0.21 Launched
    • Version 1.0.0.20 Launched
    • Version 1.0.0.19 Launched
    • Version 1.0.0.18 Launched
    • Version 1.0.0.17 Launched
    • Version 1.0.0.16 Launched
    • Version 1.0.0.15 Launched
    • Version 1.0.0.14 Launched
    • Version 1.0.0.13 Launched
    • Version 1.0.0.12 Launched
    • Version 1.0.0.11 Launched
    • Version 1.0.0.10 Launched
    • Version 1.0.0.9 Launched
    • Version 1.0.0.8 Launched
    • Version 1.0.0.7 Launched
    • Version 1.0.0.6 Launched
    • Version 1.0.0.5 Launched
    • Version 1.0.0.4 Launched
    • Version 1.0.0.3 Launched
    • Version 1.0.0.2 Launched
    • Version 1.0.0.1 Launched
    • Version 1.0.0.0 Launched
Powered by GitBook
On this page
  • System Architecture
  • Architectural Style
  • Technology Stack
  • Directory Structure Overview
  • Component Diagram (Mermaid)
  1. Developers
  2. Design Documentation

Architecture

System Architecture

Architectural Style

OpenAlgo employs a Monolithic Application Architecture with a RESTful API interface. The core logic, broker interactions, database management, and API endpoints are contained within a single Flask application process.

Key characteristics:

  • Centralized Codebase: All components reside within the same project structure.

  • Flask Framework: Utilizes the Flask microframework for web application structure and request handling.

  • Flask-RESTX: Leverages Flask-RESTX for building structured REST APIs with Swagger documentation.

  • Blueprints/Namespaces: Organizes API endpoints and application logic into modular blueprints (Flask) and namespaces (Flask-RESTX).

  • SQLAlchemy: Uses SQLAlchemy as the Object-Relational Mapper (ORM) for database interactions.

Technology Stack

  • Programming Language: Python 3

  • Web Framework: Flask

  • API Framework: Flask-RESTX

  • Database ORM: SQLAlchemy

  • Real-time Communication: Flask-SocketIO

  • Rate Limiting: Flask-Limiter

  • Cross-Origin Resource Sharing: Flask-CORS

  • Authentication: Flask-Login, Flask-Bcrypt, PyJWT (likely for API keys/tokens)

  • Web Server Gateway Interface (WSGI): Werkzeug (Flask's default), Gunicorn for production.

  • Database: (Defined by DATABASE_URL environment variable, Sqlite3 based on common usage with SQLAlchemy)

  • Environment Management: python-dotenv

  • Deployment: Docker (Dockerfile, docker-compose.yaml), AWS Elastic Beanstalk (.ebextensions)

  • Frontend (UI Templates): Jinja2, DaisyUI with Tailwind CSS (based on tailwind.config.js)

Directory Structure Overview

  • .ebextensions/: Configuration files for AWS Elastic Beanstalk deployment.

  • blueprints/: Contains Flask Blueprints, organizing application features and web routes (e.g., auth, dashboard, orders).

  • broker/: Core logic for interacting with different stock brokers. Contains subdirectories for each supported broker (e.g., jainampro).

  • database/: SQLAlchemy models, database initialization scripts, and data access logic (e.g., auth_db.py, user_db.py).

  • design/: Location for this design documentation.

  • docs/: Likely contains user-facing documentation or generated docs.

  • restx_api/: Defines the Flask-RESTX API structure, namespaces, and models.

  • static/: Static assets for the web UI (CSS, JavaScript, images).

  • strategies/: Implementation of trading strategies.

  • templates/: Jinja2 HTML templates for the web UI.

  • utils/: Common utility functions and classes used across the application (e.g., env_check.py, latency_monitor.py, plugin_loader.py).

  • app.py: Main Flask application entry point, initializes the app, extensions, and blueprints.

  • requirements.txt: Lists Python package dependencies.

  • Dockerfile, docker-compose.yaml: Configuration for building and running the application with Docker.

  • .env, .sample.env: Environment variable configuration.

Component Diagram (Mermaid)

PreviousDesign DocumentationNextAPI Layer

Last updated 1 month ago