# pradeepxvi/tradesimbackend architecture

> Architecture diagram of the GitHub repository pradeepxvi/tradesimbackend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pradeepxvi/tradesimbackend
- Repository: https://github.com/pradeepxvi/tradesimbackend

## Overview

This Django REST API supports user accounts and profiles, market data browsing, watchlists, and simulated stock trading. Users authenticate and manage their profiles; market endpoints retrieve and normalize ShareHub data; watchlist endpoints combine saved symbols with market information; trading services check market status and prices before updating virtual wallets, holdings, orders, and trades. The graph includes the API and persistence layers. Some subsystems are represented from the source index rather than inspected excerpts, so their internal details and undocumented links are omitted.

Main entry points: [`config/urls.py`](https://github.com/pradeepxvi/tradesimbackend/blob/main/config/urls.py) (API Routes), [`apps/users/views.py`](https://github.com/pradeepxvi/tradesimbackend/blob/main/apps/users/views.py) (Account and Profile API), [`apps/watchlist/views.py`](https://github.com/pradeepxvi/tradesimbackend/blob/main/apps/watchlist/views.py) (Watchlist API), [`apps/trading/services.py`](https://github.com/pradeepxvi/tradesimbackend/blob/main/apps/trading/services.py) (Trading Services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_accounts["Accounts and Profiles"]
  node_user[("Users and OTPs<br/>[models.py]")]
  node_account_api["Account and Profile API<br/>[views.py]"]
  node_account_serializers["Account Serializers<br/>[serializers.py]"]
end

subgraph group_market["Market Data"]
  node_market_api["Market API<br/>[views.py]"]
  node_market_serializers["Market Serializers<br/>[serializers.py]"]
  node_sharehub["ShareHub Client<br/>[sharehub.py]"]
end

subgraph group_watch["Watchlists"]
  node_watch_api["Watchlist API<br/>[views.py]"]
  node_watch_serializers["Watchlist Serializers<br/>[serializers.py]"]
  node_watch_items[("Watchlist Items<br/>[models.py]")]
end

subgraph group_trading["Simulated Trading"]
  node_trading_api["Trading API<br/>[views.py]"]
  node_trading_services["Trading Services<br/>[services.py]"]
  node_trading_serializers["Trading Serializers<br/>[serializers.py]"]
  node_trading_models[("Wallets and Trades<br/>[models.py]")]
  node_trading_signals["Trading Signals<br/>[signals.py]"]
end

subgraph group_api["API and Persistence"]
  node_api_routes["API Routes<br/>[urls.py]"]
  node_database[("Relational Database")]
end

node_sharehub_service{{"ShareHub"}}
node_client(("API Client"))

node_client -.->|"sends requests"| node_api_routes
node_api_routes -->|"routes to"| node_account_api
node_api_routes -->|"routes to"| node_market_api
node_api_routes -.->|"routes to"| node_watch_api
node_api_routes -.->|"routes to"| node_trading_api
node_account_api -->|"validates with"| node_account_serializers
node_account_api -->|"reads and updates"| node_user
node_account_api -->|"persists account data"| node_database
node_market_api -->|"requests data"| node_sharehub
node_market_api -->|"serializes responses"| node_market_serializers
node_sharehub -->|"fetches quotes"| node_sharehub_service
node_watch_api -->|"reads and writes"| node_watch_items
node_watch_api -->|"serializes responses"| node_watch_serializers
node_watch_api -->|"requests market data"| node_sharehub
node_trading_api -->|"executes trades"| node_trading_services
node_trading_api -->|"serializes requests"| node_trading_serializers
node_trading_services -->|"checks prices"| node_sharehub
node_trading_services -->|"updates records"| node_trading_models
node_trading_services -->|"persists trades"| node_database
node_trading_signals -->|"uses models"| node_trading_models
node_trading_signals -->|"uses user model"| node_user

click node_user "https://github.com/pradeepxvi/tradesimbackend/blob/main/apps/users/models.py"
click node_account_api "https://github.com/pradeepxvi/tradesimbackend/blob/main/apps/users/views.py"
click node_account_serializers "https://github.com/pradeepxvi/tradesimbackend/blob/main/apps/users/serializers.py"
click node_market_api "https://github.com/pradeepxvi/tradesimbackend/blob/main/apps/market/views.py"
click node_market_serializers "https://github.com/pradeepxvi/tradesimbackend/blob/main/apps/market/serializers.py"
click node_sharehub "https://github.com/pradeepxvi/tradesimbackend/blob/main/apps/market/clients/sharehub.py"
click node_watch_api "https://github.com/pradeepxvi/tradesimbackend/blob/main/apps/watchlist/views.py"
click node_watch_serializers "https://github.com/pradeepxvi/tradesimbackend/blob/main/apps/watchlist/serializers.py"
click node_watch_items "https://github.com/pradeepxvi/tradesimbackend/blob/main/apps/watchlist/models.py"
click node_trading_api "https://github.com/pradeepxvi/tradesimbackend/blob/main/apps/trading/views.py"
click node_trading_services "https://github.com/pradeepxvi/tradesimbackend/blob/main/apps/trading/services.py"
click node_trading_serializers "https://github.com/pradeepxvi/tradesimbackend/blob/main/apps/trading/serializers.py"
click node_trading_models "https://github.com/pradeepxvi/tradesimbackend/blob/main/apps/trading/models.py"
click node_trading_signals "https://github.com/pradeepxvi/tradesimbackend/blob/main/apps/trading/signals.py"
click node_api_routes "https://github.com/pradeepxvi/tradesimbackend/blob/main/config/urls.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_user,node_account_api,node_account_serializers,node_client toneBlue
class node_market_api,node_market_serializers,node_sharehub toneAmber
class node_watch_api,node_watch_serializers,node_watch_items toneMint
class node_trading_api,node_trading_services,node_trading_serializers,node_trading_models,node_trading_signals toneRose
class node_api_routes,node_database,node_sharehub_service toneIndigo
```

## Components

### Accounts and Profiles

- [Users and OTPs](https://github.com/pradeepxvi/tradesimbackend/blob/main/apps/users/models.py): `apps/users/models.py`
- [Account and Profile API](https://github.com/pradeepxvi/tradesimbackend/blob/main/apps/users/views.py): `apps/users/views.py`
- [Account Serializers](https://github.com/pradeepxvi/tradesimbackend/blob/main/apps/users/serializers.py): `apps/users/serializers.py`

### Market Data

- [Market API](https://github.com/pradeepxvi/tradesimbackend/blob/main/apps/market/views.py): `apps/market/views.py`
- [Market Serializers](https://github.com/pradeepxvi/tradesimbackend/blob/main/apps/market/serializers.py): `apps/market/serializers.py`
- [ShareHub Client](https://github.com/pradeepxvi/tradesimbackend/blob/main/apps/market/clients/sharehub.py): `apps/market/clients/sharehub.py`

### Watchlists

- [Watchlist API](https://github.com/pradeepxvi/tradesimbackend/blob/main/apps/watchlist/views.py): `apps/watchlist/views.py`
- [Watchlist Serializers](https://github.com/pradeepxvi/tradesimbackend/blob/main/apps/watchlist/serializers.py): `apps/watchlist/serializers.py`
- [Watchlist Items](https://github.com/pradeepxvi/tradesimbackend/blob/main/apps/watchlist/models.py): `apps/watchlist/models.py`

### Simulated Trading

- [Trading API](https://github.com/pradeepxvi/tradesimbackend/blob/main/apps/trading/views.py): `apps/trading/views.py`
- [Trading Services](https://github.com/pradeepxvi/tradesimbackend/blob/main/apps/trading/services.py): `apps/trading/services.py`
- [Trading Serializers](https://github.com/pradeepxvi/tradesimbackend/blob/main/apps/trading/serializers.py): `apps/trading/serializers.py`
- [Wallets and Trades](https://github.com/pradeepxvi/tradesimbackend/blob/main/apps/trading/models.py): `apps/trading/models.py`
- [Trading Signals](https://github.com/pradeepxvi/tradesimbackend/blob/main/apps/trading/signals.py): `apps/trading/signals.py`

### API and Persistence

- [API Routes](https://github.com/pradeepxvi/tradesimbackend/blob/main/config/urls.py): `config/urls.py`
- **Relational Database**

### Other components

- **ShareHub**
- **API Client**

## Connections

- API Client → API Routes: sends requests
- API Routes → Account and Profile API: routes to
- API Routes → Market API: routes to
- API Routes → Watchlist API: routes to
- API Routes → Trading API: routes to
- Account and Profile API → Account Serializers: validates with (evidence: `apps/users/views.py`)
- Account and Profile API → Users and OTPs: reads and updates (evidence: `apps/users/views.py`)
- Account and Profile API → Relational Database: persists account data (evidence: `apps/users/views.py`)
- Market API → ShareHub Client: requests data (evidence: `apps/market/views.py`)
- Market API → Market Serializers: serializes responses (evidence: `apps/market/views.py`)
- ShareHub Client → ShareHub: fetches quotes (evidence: `apps/market/clients/sharehub.py`)
- Watchlist API → Watchlist Items: reads and writes (evidence: `apps/watchlist/views.py`)
- Watchlist API → Watchlist Serializers: serializes responses (evidence: `apps/watchlist/views.py`)
- Watchlist API → ShareHub Client: requests market data (evidence: `apps/watchlist/views.py`)
- Trading API → Trading Services: executes trades (evidence: `apps/trading/views.py`)
- Trading API → Trading Serializers: serializes requests (evidence: `apps/trading/views.py`)
- Trading Services → ShareHub Client: checks prices (evidence: `apps/trading/services.py`)
- Trading Services → Wallets and Trades: updates records (evidence: `apps/trading/services.py`)
- Trading Services → Relational Database: persists trades (evidence: `apps/trading/services.py`)
- Trading Signals → Wallets and Trades: uses models (evidence: `apps/trading/signals.py`)
- Trading Signals → Users and OTPs: uses user model (evidence: `apps/trading/signals.py`)
