A sophisticated multi-strategy crypto analysis bot for trading signals
Project description
Tokenometry
A sophisticated, multi-strategy crypto analysis bot for generating trading signals based on technical analysis, market sentiment, and on-chain data.
🚀 Features
- Multi-Strategy Support: Day trading, swing trading, and long-term investment strategies
- Multi-Timeframe Analysis: Combines higher timeframe trends with lower timeframe signals
- Technical Indicators: EMA/SMA crossovers, RSI, MACD, ATR for comprehensive analysis
- Volume Filter: Optional volume spike confirmation for improved signal quality
- Signal Strength Analysis: Advanced scoring system rating signals as "Low", "Medium", or "Strong"
- Risk Management: Automatic stop-loss calculation and position sizing
- Professional Logging: Comprehensive audit trail and monitoring
- API Integration: Coinbase Advanced Trade API for real-time data
- Configurable: Easy strategy customization through configuration dictionaries
📦 Installation
pip install tokenometry
🎯 Quick Start
from tokenometry import Tokenometry
import logging
# Configure your strategy
config = {
"STRATEGY_NAME": "Day Trader",
"PRODUCT_IDS": ["BTC-USD", "ETH-USD"],
"GRANULARITY_SIGNAL": "FIVE_MINUTE",
"GRANULARITY_TREND": "ONE_HOUR",
"SHORT_PERIOD": 9,
"LONG_PERIOD": 21,
"RISK_PER_TRADE_PERCENTAGE": 0.5,
"ATR_STOP_LOSS_MULTIPLIER": 2.0,
# ... more configuration options
}
# Initialize the bot
logger = logging.getLogger("MyBot")
bot = Tokenometry(config=config, logger=logger)
# Run analysis
signals = bot.scan()
for signal in signals:
print(f"Signal: {signal}")
print(f"Strength: {signal.get('strength', 'Unknown')}")
🔍 Signal Strength Analysis
When a valid BUY or SELL signal is found, the bot performs a secondary analysis to score its strength based on three key factors:
RSI Extremity
How deep into "oversold" or "overbought" territory is the RSI? A signal that occurs when the RSI is below 30 (for a buy) is stronger than one that occurs when it's at 50.
MACD Momentum
What is the momentum behind the crossover? This is measured by the MACD Histogram (the distance between the MACD line and its signal line). A large, expanding histogram indicates powerful momentum and a stronger signal.
Volume Conviction
How significant was the volume spike? A crossover that occurs on a volume spike 3x the recent average is a much stronger signal than one that occurs on a 1.5x spike.
These factors are combined into a "strength score," which is then translated into a simple "Low," "Medium," or "Strong" rating that is included with the signal notification. This allows you to prioritize and have more confidence in the high-strength signals.
🎲 Strategy Configurations
Day Trader (High-Frequency)
- Timeframe: 5-minute signals, 1-hour trend
- Best for: Active day traders, scalping
- Risk: 0.5% per trade
Swing Trader (Medium-Term)
- Timeframe: 4-hour signals, daily trend
- Best for: Part-time traders, swing trading
- Risk: 1.0% per trade
Long-Term Investor
- Timeframe: Daily signals, weekly trend
- Best for: Position traders, long-term investors
- Risk: 1.0% per trade
🔧 Configuration Options
config = {
"STRATEGY_NAME": "Custom Strategy",
"PRODUCT_IDS": ["BTC-USD", "ETH-USD", "SOL-USD"],
"GRANULARITY_SIGNAL": "FIVE_MINUTE", # Signal timeframe
"GRANULARITY_TREND": "ONE_HOUR", # Trend timeframe
"SHORT_PERIOD": 9, # Fast EMA/SMA period
"LONG_PERIOD": 21, # Slow EMA/SMA period
"RSI_PERIOD": 14, # RSI calculation period
"RSI_OVERBOUGHT": 70, # RSI overbought threshold
"RSI_OVERSOLD": 30, # RSI oversold threshold
"MACD_FAST": 12, # MACD fast period
"MACD_SLOW": 26, # MACD slow period
"MACD_SIGNAL": 9, # MACD signal period
"ATR_PERIOD": 14, # ATR calculation period
"VOLUME_FILTER_ENABLED": True, # Enable volume filter (optional)
"VOLUME_MA_PERIOD": 20, # Volume moving average period
"VOLUME_SPIKE_MULTIPLIER": 2.0, # Volume spike multiplier
"HYPOTHETICAL_PORTFOLIO_SIZE": 100000.0, # Portfolio size for calculations
"RISK_PER_TRADE_PERCENTAGE": 1.0, # Risk per trade percentage
"ATR_STOP_LOSS_MULTIPLIER": 2.5, # ATR multiplier for stop-loss
}
📊 Signal Types
- BUY: Golden cross + bullish trend + RSI not overbought + MACD bullish + volume spike (if enabled)
- SELL: Death cross + bearish trend + RSI not oversold + MACD bearish + volume spike (if enabled)
- HOLD: No clear signal or conflicting indicators
Each signal includes a strength rating ("Low", "Medium", or "Strong") based on:
- RSI extremity (how deep into oversold/overbought territory)
- MACD momentum (histogram size and expansion)
- Volume conviction (spike magnitude relative to average)
🔧 Volume Filter
The volume filter improves signal quality by requiring significant volume spikes to confirm technical crossovers:
# Enable volume filter
config["VOLUME_FILTER_ENABLED"] = True
config["VOLUME_MA_PERIOD"] = 20 # Volume moving average period
config["VOLUME_SPIKE_MULTIPLIER"] = 2.0 # Current volume must be 2x the average
# Disable volume filter (default)
config["VOLUME_FILTER_ENABLED"] = False
Benefits:
- Reduces false signals by requiring volume confirmation
- Only trades with significant volume spikes
- Configurable sensitivity via multiplier
- Optional feature - can be disabled for more signals
🛡️ Risk Management
- Automatic Stop-Loss: Calculated using ATR for volatility-adjusted stops
- Position Sizing: Based on your risk percentage and stop-loss distance
- Portfolio Protection: Each trade risks only the specified percentage
📝 Logging & Monitoring
import logging
# Set up logging
logger = logging.getLogger("MyBot")
logger.setLevel(logging.INFO)
# Console output
console_handler = logging.StreamHandler()
logger.addHandler(console_handler)
# File logging
file_handler = logging.FileHandler("trading_bot.log")
logger.addHandler(file_handler)
🔌 API Requirements
- Coinbase Advanced Trade API: Required for price data
- NewsAPI (optional): For sentiment analysis
- Glassnode API (optional): For on-chain data
📚 Examples
Check out the examples/ directory for complete working examples:
example_usage.py: Basic usage with all three strategies- Custom strategy configurations
- Risk management examples
🧪 Testing
# Install development dependencies
pip install tokenometry[dev]
# Run tests
pytest tests/
📈 Performance
- Analysis Speed: Optimized for real-time trading
- Memory Usage: Efficient data handling with pandas
- API Efficiency: Smart pagination and rate limiting
- Scalability: Configurable for multiple assets and timeframes
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
⚠️ Disclaimer
This tool is for analytical and educational purposes only. It is not financial advice. The signals generated are based on algorithmic analysis and do not guarantee any specific outcome. Always conduct your own research and consult with a qualified financial advisor before making investment decisions.
🔗 Links
- Documentation: GitHub README
- Source Code: GitHub Repository
- Issues: GitHub Issues
- Changelog: CHANGELOG.md
Made with ❤️ for the crypto trading community
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tokenometry-1.0.7.tar.gz.
File metadata
- Download URL: tokenometry-1.0.7.tar.gz
- Upload date:
- Size: 22.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47ce52c32085c369e6055eb5e2c7c1899c441f45ca3e7590d8567b6ef36437f9
|
|
| MD5 |
4d77363695639c1744cdd9263407da49
|
|
| BLAKE2b-256 |
425398f8b1ae3282a51a54eac2df71f2700c097ea4e74593c83f926d23a6eb0c
|
File details
Details for the file tokenometry-1.0.7-py3-none-any.whl.
File metadata
- Download URL: tokenometry-1.0.7-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0332b6657e389546c066dd2a42829d6803767179a62963be55c39f8f72dd84ef
|
|
| MD5 |
1fac6da7c5801d431750c0409d6e818b
|
|
| BLAKE2b-256 |
1349c4d605e9a4991a2391527e36be0a6540b8495a2d00b07c0ca4ebb598e741
|