# aryansolanke/binance-trading-bot architecture

> Architecture diagram of the GitHub repository aryansolanke/binance-trading-bot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aryansolanke/binance-trading-bot
- Repository: https://github.com/aryansolanke/binance-trading-bot

## Overview

This repository is a Binance USDT-M Futures Testnet order-entry CLI. The main workflow is CLI input, request validation, order submission, optional MARKET fill polling, and terminal confirmation. The graph reflects the sampled CLI, manager, validator, and client code; README-documented capabilities are retained where their wiring is clear.

Main entry points: [`trading_bot/bot/client.py`](https://github.com/aryansolanke/binance-trading-bot/blob/main/trading_bot/bot/client.py) (Binance client), [`trading_bot/bot/orders.py`](https://github.com/aryansolanke/binance-trading-bot/blob/main/trading_bot/bot/orders.py) (Order manager), [`cli.py`](https://github.com/aryansolanke/binance-trading-bot/blob/main/cli.py) (Typer CLI), [`trading_bot/bot/logging_config.py`](https://github.com/aryansolanke/binance-trading-bot/blob/main/trading_bot/bot/logging_config.py) (Structured logging)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["CLI interface"]
  node_cli["Typer CLI<br/>[cli.py]"]
  node_terminal_result["Confirmation display<br/>[cli.py]"]
end

subgraph group_order_flow["Order workflow"]
  node_order_manager["Order manager<br/>[orders.py]"]
  node_order_request["Validated request<br/>[validators.py]"]
  node_order_result["Order response<br/>[client.py]"]
end

subgraph group_integration["API and logging"]
  node_binance_client["Binance client<br/>[client.py]"]
  node_logger["Structured logging<br/>[logging_config.py]"]
end

node_user(("Trader"))
node_credentials["API credentials"]
node_binance_testnet{{"Binance Futures Testnet"}}

node_user -->|"enters order"| node_cli
node_credentials -->|"provides keys"| node_cli
node_cli -->|"creates client"| node_binance_client
node_cli -->|"executes order"| node_order_manager
node_order_manager -->|"validates input"| node_order_request
node_order_manager -->|"submits order"| node_binance_client
node_binance_client -->|"sends API request"| node_binance_testnet
node_binance_testnet -->|"returns response"| node_binance_client
node_binance_client -->|"returns order data"| node_order_result
node_order_manager -->|"polls MARKET status"| node_binance_client
node_order_manager -->|"returns result"| node_cli
node_cli -->|"renders confirmation"| node_terminal_result
node_order_manager -->|"logs workflow"| node_logger
node_binance_client -->|"logs API activity"| node_logger

click node_cli "https://github.com/aryansolanke/binance-trading-bot/blob/main/cli.py"
click node_order_manager "https://github.com/aryansolanke/binance-trading-bot/blob/main/trading_bot/bot/orders.py"
click node_order_request "https://github.com/aryansolanke/binance-trading-bot/blob/main/trading_bot/bot/validators.py"
click node_binance_client "https://github.com/aryansolanke/binance-trading-bot/blob/main/trading_bot/bot/client.py"
click node_order_result "https://github.com/aryansolanke/binance-trading-bot/blob/main/trading_bot/bot/client.py"
click node_terminal_result "https://github.com/aryansolanke/binance-trading-bot/blob/main/cli.py"
click node_logger "https://github.com/aryansolanke/binance-trading-bot/blob/main/trading_bot/bot/logging_config.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_cli,node_terminal_result toneBlue
class node_order_manager,node_order_request,node_order_result toneAmber
class node_binance_client,node_logger,node_credentials toneMint
class node_user,node_binance_testnet toneIndigo
```

## Components

### CLI interface

- [Typer CLI](https://github.com/aryansolanke/binance-trading-bot/blob/main/cli.py): `cli.py`
- [Confirmation display](https://github.com/aryansolanke/binance-trading-bot/blob/main/cli.py): `cli.py`

### Order workflow

- [Order manager](https://github.com/aryansolanke/binance-trading-bot/blob/main/trading_bot/bot/orders.py): `trading_bot/bot/orders.py`
- [Validated request](https://github.com/aryansolanke/binance-trading-bot/blob/main/trading_bot/bot/validators.py): `trading_bot/bot/validators.py`
- [Order response](https://github.com/aryansolanke/binance-trading-bot/blob/main/trading_bot/bot/client.py): `trading_bot/bot/client.py`

### API and logging

- [Binance client](https://github.com/aryansolanke/binance-trading-bot/blob/main/trading_bot/bot/client.py): `trading_bot/bot/client.py`
- [Structured logging](https://github.com/aryansolanke/binance-trading-bot/blob/main/trading_bot/bot/logging_config.py): `trading_bot/bot/logging_config.py`

### Other components

- **Trader**
- **API credentials**
- **Binance Futures Testnet**

## Connections

- Trader → Typer CLI: enters order
- API credentials → Typer CLI: provides keys
- Typer CLI → Binance client: creates client
- Typer CLI → Order manager: executes order
- Order manager → Validated request: validates input
- Order manager → Binance client: submits order
- Binance client → Binance Futures Testnet: sends API request
- Binance Futures Testnet → Binance client: returns response
- Binance client → Order response: returns order data
- Order manager → Binance client: polls MARKET status
- Order manager → Typer CLI: returns result
- Typer CLI → Confirmation display: renders confirmation
- Order manager → Structured logging: logs workflow
- Binance client → Structured logging: logs API activity
