autodegen


Nameautodegen JSON
Version 0.2.5 PyPI version JSON
download
home_pageNone
SummaryProduction-ready crypto trading analysis agent with LLM hardening
upload_time2025-09-05 22:22:23
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT
keywords agent analysis binance crypto defi llm trading
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # AutoDegen ๐Ÿš€

[![PyPI version](https://badge.fury.io/py/autodegen.svg)](https://badge.fury.io/py/autodegen)
[![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

**Production-ready cryptocurrency trading analysis agent with enterprise-grade LLM hardening.**

## ๐ŸŒŸ Features

### ๐Ÿ›ก๏ธ **Enterprise-Grade LLM Security**
- **Zero Meta Commentary**: Complete elimination of "I'll analyze..." and "The key will be..." responses
- **Structured Output Enforcement**: Guaranteed consistent report format with Pydantic validation
- **Production Hardening**: Circuit breaker, retry logic, timeout handling, and tool call firewall

### ๐Ÿ“Š **Comprehensive Market Analysis**
- **Multi-Expert AI Coordination**: Technical, market, and news sentiment analysis
- **Real-Time Data**: Integration with Binance, DeFiLlama, and crypto news sources
- **Advanced Technical Indicators**: RSI, MACD, moving averages, Smart Money Concepts
- **Multi-Timeframe Analysis**: 1h, 4h, daily perspectives with confluence signals

### โšก **High-Performance Architecture**
- **Async/Await**: Non-blocking operations for maximum throughput  
- **Resilience Patterns**: Circuit breaker prevents cascade failures
- **Comprehensive Testing**: 52+ test cases with 100% production readiness validation
- **Type Safety**: Full type hints with mypy compatibility

## ๐Ÿš€ Quick Start

### Installation

```bash
# Basic installation
pip install autodegen

# With CLI support  
pip install autodegen[cli]

# Development installation
pip install autodegen[dev]
```

### Environment Setup

Create a `.env` file or set environment variables:

```bash
FIREWORKS_API_KEY=your_fireworks_api_key      # Required
OPENAI_API_KEY=your_openai_key               # Optional  
BINANCE_API_KEY=your_binance_key             # Optional
BINANCE_API_SECRET=your_binance_secret       # Optional
```

### Python API Usage

```python
import asyncio
from autodegen import TradingAgent

async def main():
    # Initialize agent
    agent = TradingAgent()
    
    # Get structured analysis
    analysis = await agent.analyze("BTC", timeframe="4h")
    
    print(analysis.title)        # **COMPREHENSIVE TECHNICAL ANALYSIS: BTC**
    print(analysis.market_state) # Current market conditions...
    print(analysis.outlook)      # Bullish bias maintained above...
    
    # Get market overview
    overview = await agent.get_market_overview()
    print(overview)

# Run analysis
asyncio.run(main())
```

### CLI Usage

```bash
# Analyze a cryptocurrency
autodegen analyze BTC --timeframe 4h --format rich

# Get market overview  
autodegen market

# Check system health
autodegen health

# List supported symbols
autodegen symbols
```

## ๐Ÿ“– Advanced Usage

### Structured vs Unstructured Output

```python
# Structured output (recommended)
structured_analysis = await agent.analyze("ETH", structured=True)
print(f"Market State: {structured_analysis.market_state}")
print(f"Trading Levels: {structured_analysis.trading_levels}")

# Text output  
text_analysis = await agent.analyze("ETH", structured=False)
print(text_analysis)  # Raw markdown-formatted text
```

### Error Handling

```python
from autodegen import TradingAgent, APIError, ConfigurationError

try:
    agent = TradingAgent()
    result = await agent.analyze("BTC")
except ConfigurationError as e:
    print(f"Setup error: {e}")
except APIError as e:
    print(f"API error: {e} (status: {e.status_code})")
except Exception as e:
    print(f"Unexpected error: {e}")
```

### Health Monitoring

```python
# Check system health
health = await agent.health_check()

if health["status"] == "healthy":
    print("All systems operational")
else:
    print(f"System status: {health['status']}")
    for component, status in health["components"].items():
        print(f"  {component}: {status}")
```

## ๐Ÿ—๏ธ Architecture

```
AutoDegen
โ”œโ”€โ”€ ๐Ÿง  LLM Core (Production Hardened)
โ”‚   โ”œโ”€โ”€ Circuit Breaker Pattern
โ”‚   โ”œโ”€โ”€ Retry with Exponential Backoff  
โ”‚   โ”œโ”€โ”€ Tool Call Firewall
โ”‚   โ””โ”€โ”€ Structured Output Enforcement
โ”‚
โ”œโ”€โ”€ ๐Ÿ“Š Market Analysis Engine
โ”‚   โ”œโ”€โ”€ Technical Expert (Charts & Indicators)
โ”‚   โ”œโ”€โ”€ Market Expert (Liquidity & Volume)
โ”‚   โ””โ”€โ”€ News Expert (Sentiment Analysis)
โ”‚
โ”œโ”€โ”€ ๐Ÿ”Œ Data Sources
โ”‚   โ”œโ”€โ”€ Binance API (Price & Volume)
โ”‚   โ”œโ”€โ”€ DeFiLlama (DeFi Metrics)
โ”‚   โ””โ”€โ”€ News APIs (Market Sentiment)
โ”‚
โ””โ”€โ”€ ๐Ÿ›ก๏ธ Security & Reliability
    โ”œโ”€โ”€ Input Validation & Sanitization
    โ”œโ”€โ”€ Rate Limiting & Quotas
    โ””โ”€โ”€ Comprehensive Logging
```

## ๐Ÿ“ˆ Supported Cryptocurrencies

**Major Coins**: BTC, ETH, BNB, SOL, ADA, XRP, DOT, AVAX

**DeFi Tokens**: UNI, COMP, CRV, LINK, AAVE

**Layer 1s**: ATOM, NEAR, ALGO, FTM, ICP

**And more**: MATIC, VET, FLOW, SAND, MANA

*Use `autodegen symbols` to see the full list*

## ๐Ÿ”ง Configuration

### API Keys Priority

1. Constructor parameters
2. Environment variables  
3. `.env` file (if python-dotenv installed)

### Timeout & Retry Settings

```python
agent = TradingAgent()

# Custom timeout and structured output
analysis = await agent.analyze(
    symbol="BTC",
    timeout=60.0,        # 60 second timeout
    structured=True      # Enforce schema validation
)
```

## ๐Ÿงช Production Hardening

This agent includes **enterprise-grade production hardening** tested with 52+ comprehensive test cases:

### ๐Ÿ›ก๏ธ **LLM Response Security**
- **Meta Commentary Elimination**: Zero tolerance for "I'll analyze...", "The key will be..." responses
- **Structured Schema Enforcement**: Guaranteed report format with required sections
- **Content Validation**: Multi-layer filtering of banned tokens and meta statements

### ๐Ÿ”’ **Security Features** 
- **Tool Call Firewall**: Blocks dangerous function calls (execute_code, run_shell)
- **Input Sanitization**: Automatic cleanup of potentially harmful content
- **Circuit Breaker**: Prevents cascade failures with automatic recovery

### โšก **Reliability Patterns**
- **Retry Logic**: Exponential backoff with jitter (3 attempts default)
- **Timeout Handling**: Graceful degradation on slow responses  
- **Health Monitoring**: Real-time component status checking

## ๐Ÿงช Testing & Quality

```bash
# Install development dependencies
pip install autodegen[dev]

# Run the production quality test battery  
python -m pytest tests/run_quality_battery.py

# Test specific components
python -m pytest tests/ -v
```

**Quality Metrics:**
- โœ… 52/52 tests passing (100% success rate)
- โœ… Zero meta commentary leakage
- โœ… 100% structured output compliance  
- โœ… Enterprise resilience patterns validated

## ๐Ÿค Contributing

We welcome contributions! Please see our [Contributing Guide](https://github.com/taygundogan/cryptotrading-agent/blob/main/CONTRIBUTING.md).

### Development Setup

```bash
git clone https://github.com/taygundogan/cryptotrading-agent
cd cryptotrading-agent
pip install -e .[dev]

# Run tests
python tests/run_quality_battery.py
```

## ๐Ÿ“„ License

This project is licensed under the MIT License - see the [LICENSE](https://github.com/taygundogan/cryptotrading-agent/blob/main/LICENSE) file for details.

## ๐Ÿ™ Acknowledgments

- Built with production-grade LLM hardening techniques
- Inspired by enterprise trading system architectures  
- Powered by Fireworks AI, OpenAI, and crypto data providers

## ๐Ÿ“ž Support

- **Documentation**: [GitHub README](https://github.com/taygundogan/cryptotrading-agent)
- **Issues**: [GitHub Issues](https://github.com/taygundogan/cryptotrading-agent/issues)  
- **Discussions**: [GitHub Discussions](https://github.com/taygundogan/cryptotrading-agent/discussions)

---

**โš ๏ธ Disclaimer**: This tool is for educational and informational purposes only. Cryptocurrency trading involves significant risk. Always do your own research and consider your risk tolerance before making trading decisions.
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "autodegen",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "agent, analysis, binance, crypto, defi, llm, trading",
    "author": null,
    "author_email": "Taygun Dogan <taygundogan@example.com>",
    "download_url": "https://files.pythonhosted.org/packages/53/e6/6e65be183e52cbc90743c45e04e261122c06e8c8431ab5501ea1ad5ec134/autodegen-0.2.5.tar.gz",
    "platform": null,
    "description": "# AutoDegen \ud83d\ude80\n\n[![PyPI version](https://badge.fury.io/py/autodegen.svg)](https://badge.fury.io/py/autodegen)\n[![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n**Production-ready cryptocurrency trading analysis agent with enterprise-grade LLM hardening.**\n\n## \ud83c\udf1f Features\n\n### \ud83d\udee1\ufe0f **Enterprise-Grade LLM Security**\n- **Zero Meta Commentary**: Complete elimination of \"I'll analyze...\" and \"The key will be...\" responses\n- **Structured Output Enforcement**: Guaranteed consistent report format with Pydantic validation\n- **Production Hardening**: Circuit breaker, retry logic, timeout handling, and tool call firewall\n\n### \ud83d\udcca **Comprehensive Market Analysis**\n- **Multi-Expert AI Coordination**: Technical, market, and news sentiment analysis\n- **Real-Time Data**: Integration with Binance, DeFiLlama, and crypto news sources\n- **Advanced Technical Indicators**: RSI, MACD, moving averages, Smart Money Concepts\n- **Multi-Timeframe Analysis**: 1h, 4h, daily perspectives with confluence signals\n\n### \u26a1 **High-Performance Architecture**\n- **Async/Await**: Non-blocking operations for maximum throughput  \n- **Resilience Patterns**: Circuit breaker prevents cascade failures\n- **Comprehensive Testing**: 52+ test cases with 100% production readiness validation\n- **Type Safety**: Full type hints with mypy compatibility\n\n## \ud83d\ude80 Quick Start\n\n### Installation\n\n```bash\n# Basic installation\npip install autodegen\n\n# With CLI support  \npip install autodegen[cli]\n\n# Development installation\npip install autodegen[dev]\n```\n\n### Environment Setup\n\nCreate a `.env` file or set environment variables:\n\n```bash\nFIREWORKS_API_KEY=your_fireworks_api_key      # Required\nOPENAI_API_KEY=your_openai_key               # Optional  \nBINANCE_API_KEY=your_binance_key             # Optional\nBINANCE_API_SECRET=your_binance_secret       # Optional\n```\n\n### Python API Usage\n\n```python\nimport asyncio\nfrom autodegen import TradingAgent\n\nasync def main():\n    # Initialize agent\n    agent = TradingAgent()\n    \n    # Get structured analysis\n    analysis = await agent.analyze(\"BTC\", timeframe=\"4h\")\n    \n    print(analysis.title)        # **COMPREHENSIVE TECHNICAL ANALYSIS: BTC**\n    print(analysis.market_state) # Current market conditions...\n    print(analysis.outlook)      # Bullish bias maintained above...\n    \n    # Get market overview\n    overview = await agent.get_market_overview()\n    print(overview)\n\n# Run analysis\nasyncio.run(main())\n```\n\n### CLI Usage\n\n```bash\n# Analyze a cryptocurrency\nautodegen analyze BTC --timeframe 4h --format rich\n\n# Get market overview  \nautodegen market\n\n# Check system health\nautodegen health\n\n# List supported symbols\nautodegen symbols\n```\n\n## \ud83d\udcd6 Advanced Usage\n\n### Structured vs Unstructured Output\n\n```python\n# Structured output (recommended)\nstructured_analysis = await agent.analyze(\"ETH\", structured=True)\nprint(f\"Market State: {structured_analysis.market_state}\")\nprint(f\"Trading Levels: {structured_analysis.trading_levels}\")\n\n# Text output  \ntext_analysis = await agent.analyze(\"ETH\", structured=False)\nprint(text_analysis)  # Raw markdown-formatted text\n```\n\n### Error Handling\n\n```python\nfrom autodegen import TradingAgent, APIError, ConfigurationError\n\ntry:\n    agent = TradingAgent()\n    result = await agent.analyze(\"BTC\")\nexcept ConfigurationError as e:\n    print(f\"Setup error: {e}\")\nexcept APIError as e:\n    print(f\"API error: {e} (status: {e.status_code})\")\nexcept Exception as e:\n    print(f\"Unexpected error: {e}\")\n```\n\n### Health Monitoring\n\n```python\n# Check system health\nhealth = await agent.health_check()\n\nif health[\"status\"] == \"healthy\":\n    print(\"All systems operational\")\nelse:\n    print(f\"System status: {health['status']}\")\n    for component, status in health[\"components\"].items():\n        print(f\"  {component}: {status}\")\n```\n\n## \ud83c\udfd7\ufe0f Architecture\n\n```\nAutoDegen\n\u251c\u2500\u2500 \ud83e\udde0 LLM Core (Production Hardened)\n\u2502   \u251c\u2500\u2500 Circuit Breaker Pattern\n\u2502   \u251c\u2500\u2500 Retry with Exponential Backoff  \n\u2502   \u251c\u2500\u2500 Tool Call Firewall\n\u2502   \u2514\u2500\u2500 Structured Output Enforcement\n\u2502\n\u251c\u2500\u2500 \ud83d\udcca Market Analysis Engine\n\u2502   \u251c\u2500\u2500 Technical Expert (Charts & Indicators)\n\u2502   \u251c\u2500\u2500 Market Expert (Liquidity & Volume)\n\u2502   \u2514\u2500\u2500 News Expert (Sentiment Analysis)\n\u2502\n\u251c\u2500\u2500 \ud83d\udd0c Data Sources\n\u2502   \u251c\u2500\u2500 Binance API (Price & Volume)\n\u2502   \u251c\u2500\u2500 DeFiLlama (DeFi Metrics)\n\u2502   \u2514\u2500\u2500 News APIs (Market Sentiment)\n\u2502\n\u2514\u2500\u2500 \ud83d\udee1\ufe0f Security & Reliability\n    \u251c\u2500\u2500 Input Validation & Sanitization\n    \u251c\u2500\u2500 Rate Limiting & Quotas\n    \u2514\u2500\u2500 Comprehensive Logging\n```\n\n## \ud83d\udcc8 Supported Cryptocurrencies\n\n**Major Coins**: BTC, ETH, BNB, SOL, ADA, XRP, DOT, AVAX\n\n**DeFi Tokens**: UNI, COMP, CRV, LINK, AAVE\n\n**Layer 1s**: ATOM, NEAR, ALGO, FTM, ICP\n\n**And more**: MATIC, VET, FLOW, SAND, MANA\n\n*Use `autodegen symbols` to see the full list*\n\n## \ud83d\udd27 Configuration\n\n### API Keys Priority\n\n1. Constructor parameters\n2. Environment variables  \n3. `.env` file (if python-dotenv installed)\n\n### Timeout & Retry Settings\n\n```python\nagent = TradingAgent()\n\n# Custom timeout and structured output\nanalysis = await agent.analyze(\n    symbol=\"BTC\",\n    timeout=60.0,        # 60 second timeout\n    structured=True      # Enforce schema validation\n)\n```\n\n## \ud83e\uddea Production Hardening\n\nThis agent includes **enterprise-grade production hardening** tested with 52+ comprehensive test cases:\n\n### \ud83d\udee1\ufe0f **LLM Response Security**\n- **Meta Commentary Elimination**: Zero tolerance for \"I'll analyze...\", \"The key will be...\" responses\n- **Structured Schema Enforcement**: Guaranteed report format with required sections\n- **Content Validation**: Multi-layer filtering of banned tokens and meta statements\n\n### \ud83d\udd12 **Security Features** \n- **Tool Call Firewall**: Blocks dangerous function calls (execute_code, run_shell)\n- **Input Sanitization**: Automatic cleanup of potentially harmful content\n- **Circuit Breaker**: Prevents cascade failures with automatic recovery\n\n### \u26a1 **Reliability Patterns**\n- **Retry Logic**: Exponential backoff with jitter (3 attempts default)\n- **Timeout Handling**: Graceful degradation on slow responses  \n- **Health Monitoring**: Real-time component status checking\n\n## \ud83e\uddea Testing & Quality\n\n```bash\n# Install development dependencies\npip install autodegen[dev]\n\n# Run the production quality test battery  \npython -m pytest tests/run_quality_battery.py\n\n# Test specific components\npython -m pytest tests/ -v\n```\n\n**Quality Metrics:**\n- \u2705 52/52 tests passing (100% success rate)\n- \u2705 Zero meta commentary leakage\n- \u2705 100% structured output compliance  \n- \u2705 Enterprise resilience patterns validated\n\n## \ud83e\udd1d Contributing\n\nWe welcome contributions! Please see our [Contributing Guide](https://github.com/taygundogan/cryptotrading-agent/blob/main/CONTRIBUTING.md).\n\n### Development Setup\n\n```bash\ngit clone https://github.com/taygundogan/cryptotrading-agent\ncd cryptotrading-agent\npip install -e .[dev]\n\n# Run tests\npython tests/run_quality_battery.py\n```\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the MIT License - see the [LICENSE](https://github.com/taygundogan/cryptotrading-agent/blob/main/LICENSE) file for details.\n\n## \ud83d\ude4f Acknowledgments\n\n- Built with production-grade LLM hardening techniques\n- Inspired by enterprise trading system architectures  \n- Powered by Fireworks AI, OpenAI, and crypto data providers\n\n## \ud83d\udcde Support\n\n- **Documentation**: [GitHub README](https://github.com/taygundogan/cryptotrading-agent)\n- **Issues**: [GitHub Issues](https://github.com/taygundogan/cryptotrading-agent/issues)  \n- **Discussions**: [GitHub Discussions](https://github.com/taygundogan/cryptotrading-agent/discussions)\n\n---\n\n**\u26a0\ufe0f Disclaimer**: This tool is for educational and informational purposes only. Cryptocurrency trading involves significant risk. Always do your own research and consider your risk tolerance before making trading decisions.",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Production-ready crypto trading analysis agent with LLM hardening",
    "version": "0.2.5",
    "project_urls": {
        "Documentation": "https://github.com/taygundogan/cryptotrading-agent#readme",
        "Homepage": "https://github.com/taygundogan/cryptotrading-agent",
        "Issues": "https://github.com/taygundogan/cryptotrading-agent/issues",
        "Repository": "https://github.com/taygundogan/cryptotrading-agent"
    },
    "split_keywords": [
        "agent",
        " analysis",
        " binance",
        " crypto",
        " defi",
        " llm",
        " trading"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "06cac1f889bcf417a41256757acbc44c2501fcafd334e4631a7c964b2107944d",
                "md5": "5146822afba15473aed6e0c385604620",
                "sha256": "e7edd821ac766630cbac83c8c8ed58ff312917aa5de4926c526419fca115b39b"
            },
            "downloads": -1,
            "filename": "autodegen-0.2.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5146822afba15473aed6e0c385604620",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 38476,
            "upload_time": "2025-09-05T22:22:22",
            "upload_time_iso_8601": "2025-09-05T22:22:22.390717Z",
            "url": "https://files.pythonhosted.org/packages/06/ca/c1f889bcf417a41256757acbc44c2501fcafd334e4631a7c964b2107944d/autodegen-0.2.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "53e66e65be183e52cbc90743c45e04e261122c06e8c8431ab5501ea1ad5ec134",
                "md5": "ae0ec7b4839360bcbcd6aee0b09e6f53",
                "sha256": "0ba96f99143eb2b0a0758184d49c08a6c71896577c4fb0d237e79da717c199e3"
            },
            "downloads": -1,
            "filename": "autodegen-0.2.5.tar.gz",
            "has_sig": false,
            "md5_digest": "ae0ec7b4839360bcbcd6aee0b09e6f53",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 34549,
            "upload_time": "2025-09-05T22:22:23",
            "upload_time_iso_8601": "2025-09-05T22:22:23.519882Z",
            "url": "https://files.pythonhosted.org/packages/53/e6/6e65be183e52cbc90743c45e04e261122c06e8c8431ab5501ea1ad5ec134/autodegen-0.2.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-05 22:22:23",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "taygundogan",
    "github_project": "cryptotrading-agent#readme",
    "github_not_found": true,
    "lcname": "autodegen"
}
        
Elapsed time: 0.52601s