// quickstart
From pip install to a live-ready strategy.
Five steps take you from a fresh install to a backtested strategy staged on Bybit testnet. Because dgbit binds to one exchange, what you test is what you get in production.
- 1
Install dgbit
Install the Python package from PyPI, or pull the Docker image if you want the full multi-service stack.
pip install dgbit # or docker pull cryptuon/dgbit - 2
Fetch historical klines from Bybit
Use BybitDataFetcher to pull OHLCV candles directly from Bybit — no multi-exchange wrapper in the way.
from dgbit_core.data.data_fetcher import BybitDataFetcher fetcher = BybitDataFetcher() data = fetcher.get_kline_data("BTCUSDT", interval="15", limit=1000) - 3
Configure and run a backtest
Set your initial capital and transaction fee, pick a built-in strategy (or your own), and run the in-memory backtester.
from dgbit_core.backtesting import Backtester, BacktestConfig from dgbit_core.trading.strategy import WaveletReversalStrategy config = BacktestConfig(initial_capital=10000.0, transaction_fee=0.001) backtester = Backtester(config=config) backtester.strategy = WaveletReversalStrategy(min_signal_threshold=0.75) result = backtester.run(data) - 4
Read the metrics — and decide
The result object carries the numbers you need for an honest go/no-go: total return, win rate, and max drawdown.
print(f"Total Return: {result.metrics['total_return']:.2%}") print(f"Win Rate: {result.metrics['win_rate']:.2%}") print(f"Max Drawdown: {result.metrics['max_drawdown']:.2%}") - 5
Go live on testnet, then production
Set your Bybit keys in .env and stage against testnet before flipping to production. The same strategy interface used for backtests drives live execution.
# .env BYBIT_API_KEY=... BYBIT_API_SECRET=... BYBIT_TESTNET=true # flip to false for production
Want the full reference?
The docs cover strategy authoring, the service bus, and the execution API in depth.