How dizixxx/cryptomirror works
CryptoMirror is a Telegram bot for simulated crypto trading, live Binance prices, balances, and trade history. Users issue bot commands; the registered handlers guide buy/sell confirmation flows, fetch market prices when needed, and update simulated holdings and trade records. Other handlers provide price monitoring, portfolio, balance/history, start, and help functions. SQLite-backed SQLAlchemy models and CRUD operations support the trading state. The graph follows shown imports and calls plus README-described capabilities; unsampled handler internals are not inferred.
Main entry points: __init__.py Router registry · buy.py Buy flow · sell.py Sell flow · init_engine.py DB engine
Components 16
Bot runtime
- Bot startup
app/main.py - Router registry
app/handlers/__init__.py
User workflows
- Start handler
app/handlers/start.py - Help handler
app/handlers/help.py - Buy flow
app/handlers/buy.py - Sell flow
app/handlers/sell.py - Balance history
app/handlers/balance.py - Portfolio view
app/handlers/portfolio.py
Market data
- Price monitor
app/handlers/prices.py - Monitor state
app/services/prices_updater.py - Price client
app/services/binance.py
Trading persistence
- DB engine
app/database/init_engine.py - Trading CRUD
app/database/crud.py - Trading records
app/database/models.py
Other components
- Telegram user
- Binance API
Connections 32
- Bot startup → DB engine: initializes DB
app/main.py - Bot startup → Router registry: loads routers
app/main.py - Bot startup → Monitor state: configures bot
app/main.py - Router registry → Start handler: registers
app/handlers/__init__.py - Router registry → Help handler: registers
app/handlers/__init__.py - Router registry → Buy flow: registers
app/handlers/__init__.py - Router registry → Sell flow: registers
app/handlers/__init__.py - Router registry → Balance history: registers
app/handlers/__init__.py - Router registry → Portfolio view: registers
app/handlers/__init__.py - Router registry → Price monitor: registers
app/handlers/__init__.py - Telegram user → Buy flow: requests trade
app/handlers/buy.py - Telegram user → Sell flow: requests trade
app/handlers/sell.py - Telegram user → Price monitor: requests prices
app/handlers/prices.py - Telegram user → Balance history: requests history
app/handlers/balance.py - Telegram user → Start handler: starts bot use
README.md - Telegram user → Help handler: requests help
README.md - Telegram user → Portfolio view: requests portfolio
README.md - Buy flow → Price client: gets quote
app/handlers/buy.py - Sell flow → Price client: gets quote
app/handlers/sell.py - Price monitor → Price client: gets prices
app/handlers/prices.py - Price client → Binance API: requests prices
app/services/binance.py - Price monitor → Monitor state: tracks updates
app/handlers/prices.py - Buy flow → DB engine: opens session
app/handlers/buy.py - Sell flow → DB engine: opens session
app/handlers/sell.py - Balance history → DB engine: queries history
app/handlers/balance.py - Buy flow → Trading CRUD: reads and updates
app/handlers/buy.py - Sell flow → Trading CRUD: reads and updates
app/handlers/sell.py - Portfolio view → Trading CRUD: reads holdings
app/handlers/portfolio.py - Start handler → Trading CRUD: creates user
app/handlers/start.py - Trading CRUD → Trading records: queries records
app/database/crud.py - DB engine → Trading records: creates schema
app/database/init_engine.py - Balance history → Trading records: reads trades
app/handlers/balance.py