How skywalker0803r/vedanta works
Project type & purpose
• This is a domain-specific, Python-based trading platform (“Vedanta”) that provides
• Offline backtesting of crypto strategies
• Visualization of results
• Online (real-time) auto-trading via Binance’s API
• It’s not a traditional web app; it’s a library + CLI + Jupyter UI that integrates data ingestion, strategy plugins, execution engines, and notification services.
High-level architectural components
A. Entry-Point / UI Layer
• Jupyter Notebooks (backtest_usage.ipynb, online_usage.ipynb)
• CLI scripts (run.py, turtle_run.py, vegas_run.py, telegram_message_bot_*.py)
B. Strategy Layer (Plugin Pattern)
• Technicalindicatorstrategy/*.py – each file implements a generate_signals() interface
C. Data Ingestion Layer
• CCXT wrapper inside Backtest/backtest.py for historical K-lines
• CCXT wrapper inside online/auto_trade*.py for real-time K-lines & order execution
D. Core Engines
1. Backtesting Engine (Backtest/backtest.py)
2. Online Trading Engine (online/auto_trade.py for spot; auto_trade_future.py for futures)
E. Visualization Layer
• Plot/plot.py – renders equity curves, price charts with positions, P&L distributions
F. Notification / Messaging
• Telegram bots (telegram_message_bot_turtle.py, telegram_message_bot_vegas.py)
G. External Services
• Binance API (via CCXT)
• Telegram API
H. Configuration & Environment
• . env or python-dotenv (via requirements.txt)
• API keys & strategy parameters loaded in run.py or notebooks
Key interactions & data flows
1) User invokes a notebook or run.py
2) Entry-Point loads a specific strategy from Technicalindicatorstrategy
3) Engine (backtest or online) requests K-line data from Binance via CCXT
4) Data + Strategy → Signal generator → buy/sell signals
5a) (Backtest) Simulate trades, compute metrics → pass results to Plot module → rendered charts back to UI
5b) (Online) Submit real orders to Binance, track fills, risk control → send notifications to Telegram
Architectural patterns & principles
• Strategy Pattern: decouple “what” (signal logic) from “when/where” (engine)
• Layered Design: clear separation of Ingestion → Strategy → Engine → Output
• Reuse & DRY: same strategy modules under both backtest & online engines
• Single Responsibility: each package (Backtest, Plot, online, strategies) focuses on one concern