- Python 3.8+ installed on your system
- Kraken account with API access enabled
- Git (optional, for cloning the repository)
git clone <repository-url>
cd TradingBotOn Windows (PowerShell):
python -m venv venv
.\venv\Scripts\Activate.ps1On macOS/Linux:
python3 -m venv venv
source venv/bin/activatepip install -r requirements.txtCopy the .env.example file to .env:
On Windows (PowerShell):
Copy-Item .env.example .envOn macOS/Linux:
cp .env.example .envOpen the .env file and add your Kraken API credentials:
KRAKEN_API_KEY=your_actual_api_key_here
KRAKEN_API_SECRET=your_actual_api_secret_here
✅ Security: The .env file is automatically ignored by git (see .gitignore), so your credentials will never be accidentally committed.
If you prefer not to use a .env file:
On Windows (PowerShell):
$env:KRAKEN_API_KEY = "your_api_key_here"
$env:KRAKEN_API_SECRET = "your_api_secret_here"On macOS/Linux:
export KRAKEN_API_KEY="your_api_key_here"
export KRAKEN_API_SECRET="your_api_secret_here"- Log in to your Kraken account
- Go to Settings → API
- Click "Generate New Key"
- Configure permissions:
- ✓ Query Funds
- ✓ Query Open Orders & Trades
- ✓ Query Closed Orders & Trades
- ✓ Create & Modify Orders
- ✓ Cancel/Close Orders
- Copy your API Key and Private Key
python main.py --testThis will verify your API credentials and connectivity.
python main.py --backtestThis mode analyzes historical data without placing real trades. Requires historical price data in data/historical_prices.csv.
python main.pyEdit config.toml to customize:
- Trading Pair:
trade_pair(default: "XBTEUR" — EUR pairs recommended; checkconfig.tomlfor exact symbols) - Trade Volume:
trade_volume(amount per trade) - Risk Settings: Stop-loss and drawdown limits
- Logging: Log level and output path
TradingBot/
├── main.py # Entry point
├── trading_bot.py # Core trading logic
├── kraken_interface.py # Kraken API wrapper
├── analysis.py # Technical analysis indicators
├── utils.py # Helper functions
├── config.toml # Configuration file
├── requirements.txt # Python dependencies
├── logs/ # Log files directory
├── data/ # Historical data directory
└── reports/ # Trade reports directory
The bot uses the following technical analysis indicators:
-
RSI (Relative Strength Index): Identifies overbought/oversold conditions
- BUY when RSI < 30 (oversold)
- SELL when RSI > 70 (overbought)
-
SMA (Simple Moving Average): Identifies trend direction
- Short-term SMA (20 periods)
- Long-term SMA (50 periods)
ModuleNotFoundError: No module named 'krakenex'
Solution: Run pip install -r requirements.txt
ERROR:kraken_interface:Error fetching account balance: Either key or secret is not set!
Solution: Check your API credentials in environment variables or config.toml
API Error: EAPI:Invalid key
Solution: Verify API key has required permissions enabled on Kraken
EAPI:EAPI:Rate limit exceeded
Solution: Wait a few seconds. The bot has built-in rate limiting (0.5s between calls).
- ✓ Always use environment variables for API credentials
- ✓ Never commit credentials to version control
- ✓ Use API keys with minimal required permissions
- ✓ Enable IP whitelisting on your Kraken API key
- ✓ Monitor your account regularly
- ✓ Start with small trade volumes for testing
- ✓ Use stop-loss orders to limit potential losses
Logs are saved to logs/bot_activity.log. Monitor this file for:
- Trading signals and orders
- API errors and warnings
- Performance metrics
View logs in real-time:
# On Windows (PowerShell)
Get-Content logs/bot_activity.log -Tail 20 -Wait
# On macOS/Linux
tail -f logs/bot_activity.log- Implement Backtesting: Add historical data to
data/folder - Add More Indicators: Extend the
analysis.pymodule with MACD, Bollinger Bands, etc. - Risk Management: Implement position sizing and portfolio rebalancing
- Reporting: Generate trade performance reports
- Deployment: Set up on a VPS for 24/7 operation
Trading cryptocurrencies involves significant risk. This bot is provided as-is for educational purposes. The developers are not responsible for financial losses. Always:
- Test thoroughly before using real funds
- Use appropriate risk management
- Comply with local regulations
- Never invest more than you can afford to lose
Last Updated: February 19, 2026