How j-sravani15/crypto-trading-system works
CTP·BOT is a React dashboard backed by a FastAPI crypto-trading service for Binance Spot Testnet. A user authenticates, views market data and EMA/RSI signals, then can place or automate test orders; resulting trades are stored in SQLite. Separate capabilities cover account/order management, background polling, multi-symbol scanning, risk checks, Gemini chat and AI analysis, and per-user settings. The graph uses README-described flows where route implementations were not excerpted; those relationships are cited to the README rather than treated as source inspection.
Main entry points: main.py FastAPI app · App.jsx App shell · api.js API client · trader_service.py Order execution
Components 25
Dashboard UI
- App shell
ui/src/App.jsx - Auth context
ui/src/context/AuthContext.jsx - API client
ui/src/api.js - Dashboard
ui/src/components/Dashboard.jsx - Trading view
ui/src/components/Trading.jsx - Automation view
ui/src/components/Automation.jsx - AI assistant
ui/src/components/Assistant.jsx - Settings
ui/src/components/Settings.jsx
HTTP API
- FastAPI app
backend/main.py - Auth routes
backend/api/auth.py - Market routes
backend/api/market.py - Trading routes
backend/api/trading.py - Account routes
backend/api/account.py - Automation routes
backend/api/automation.py - Poller routes
backend/api/poller.py - Chat routes
backend/api/chat.py
Trading services
- Exchange client
backend/services/exchange_client.py - EMA RSI strategy
backend/services/strategy_service.py - Order execution
backend/services/trader_service.py - Background poller
backend/services/poller.py
Identity and state
- Auth service
backend/services/auth_service.py - SQLite database
backend/models/db.py
Other components
- User browser
- Binance Testnet
- Google Gemini
Connections 41
- User browser → App shell: uses
- App shell → Dashboard: renders
ui/src/App.jsx - App shell → Trading view: renders
ui/src/App.jsx - App shell → Automation view: renders
ui/src/App.jsx - App shell → AI assistant: renders
ui/src/App.jsx - App shell → Settings: renders
ui/src/App.jsx - App shell → Auth context: reads session
ui/src/App.jsx - Auth context → API client: calls auth
ui/src/context/AuthContext.jsx - Dashboard → API client: requests data
ui/src/components/Dashboard.jsx - Trading view → API client: requests trades
ui/src/components/Trading.jsx - Automation view → API client: requests automation
ui/src/components/Automation.jsx - AI assistant → API client: sends questions
ui/src/components/Assistant.jsx - Settings → API client: manages settings
ui/src/components/Settings.jsx - API client → FastAPI app: HTTP requests
- FastAPI app → Auth routes: routes to
backend/main.py - FastAPI app → Market routes: routes to
backend/main.py - FastAPI app → Trading routes: routes to
backend/main.py - FastAPI app → Account routes: routes to
backend/main.py - FastAPI app → Automation routes: routes to
backend/main.py - FastAPI app → Poller routes: routes to
backend/main.py - FastAPI app → Chat routes: routes to
backend/main.py - FastAPI app → SQLite database: initializes
backend/main.py - Auth routes → Auth service: uses
backend/api/auth.py - Auth routes → SQLite database: reads and writes
backend/api/auth.py - Auth service → SQLite database: queries users
backend/services/auth_service.py - Market routes → Exchange client: fetches market data
- Market routes → EMA RSI strategy: gets signal
backend/api/market.py - Trading routes → Order execution: runs trades
backend/api/trading.py - Trading routes → EMA RSI strategy: gets signal
backend/api/trading.py - Order execution → Exchange client: fetches and orders
backend/services/trader_service.py - Order execution → EMA RSI strategy: calculates signal
backend/services/trader_service.py - Order execution → SQLite database: saves trades
backend/services/trader_service.py - Account routes → Exchange client: manages account
- Automation routes → EMA RSI strategy: scans signals
backend/api/automation.py - Automation routes → Order execution: executes automation
backend/api/automation.py - Poller routes → Background poller: controls
- Background poller → Exchange client: fetches klines
- Background poller → EMA RSI strategy: checks signals
backend/services/poller.py - Chat routes → Google Gemini: generates answers
- Automation routes → Google Gemini: requests AI analysis
- Exchange client → Binance Testnet: calls API