Spaces:
Sleeping
Sleeping
| title: Trading Analysis Platform | |
| emoji: π | |
| colorFrom: blue | |
| colorTo: green | |
| sdk: gradio | |
| sdk_version: "6.3.0" | |
| app_file: deployment/huggingface/app.py | |
| pinned: false | |
| license: mit | |
| # π Trading Analysis Platform | |
| AI-powered multi-agent trading analysis platform with **HuggingFace Inference Providers** support for cost-effective LLM access. | |
| ## π Features | |
| - **Multi-Agent Analysis**: 10 specialized AI agents for comprehensive market analysis | |
| - Technical: Indicator, Pattern, Trend, Decision | |
| - Fundamental: Fundamentals, Sentiment, News | |
| - Management: Technical Analyst, Risk Manager, Portfolio Manager | |
| - **HuggingFace Inference Providers**: Access 22+ LLM providers through a single API | |
| - **Cost Optimization**: Use `:cheapest` routing for 90%+ cost savings | |
| - **Performance**: Use `:fastest` routing for best quality | |
| - **Free Tier**: Many providers offer free inference | |
| - **Multi-Provider Support**: | |
| - HuggingFace Inference Providers (recommended) | |
| - OpenAI (GPT-4, GPT-3.5) | |
| - Anthropic (Claude) | |
| - **Cost Tracking**: Real-time API cost monitoring and budget alerts | |
| - **Phase-Based Analysis**: Customize analysis workflow (Technical, Fundamental, Sentiment, Research, Risk, Decision) | |
| - **Investment Styles**: Long-term investing vs Swing trading presets | |
| ## π Setup Instructions | |
| ### Required Secrets | |
| Add these in your Space's **Settings β Repository secrets**: | |
| 1. **HF_TOKEN** (Required) | |
| - Your HuggingFace API token | |
| - Get it from: https://huggingface.co/settings/tokens | |
| - Needed for Inference Providers access | |
| 2. **OPENAI_API_KEY** (Optional) | |
| - Only needed if using OpenAI provider | |
| - Get it from: https://platform.openai.com/api-keys | |
| 3. **ANTHROPIC_API_KEY** (Optional) | |
| - Only needed if using Anthropic/Claude | |
| - Get it from: https://console.anthropic.com/ | |
| π‘ **For public Spaces**: Use only `HF_TOKEN` with `:cheapest` routing to avoid API costs | |
| ### Routing Policy Examples | |
| The platform supports flexible routing policies for cost/performance optimization: | |
| #### Cost-Optimized (Recommended for Public Spaces) | |
| ``` | |
| Provider: HuggingFace | |
| Routing Policy: :cheapest | |
| ``` | |
| - Uses free-tier models when available | |
| - Automatically selects lowest-cost provider | |
| - 90%+ cost savings vs. OpenAI | |
| #### Performance-Optimized | |
| ``` | |
| Provider: HuggingFace | |
| Routing Policy: :fastest | |
| ``` | |
| - Uses highest-quality models | |
| - Best for critical decisions | |
| - Higher cost but better accuracy | |
| #### Specific Provider | |
| ``` | |
| Provider: HuggingFace | |
| Routing Policy: groq | |
| ``` | |
| - Route to specific provider (groq, together, replicate, etc.) | |
| - Consistent performance | |
| - Provider-specific pricing | |
| #### Specific Model | |
| ``` | |
| Provider: HuggingFace | |
| Routing Policy: meta-llama/Llama-3.3-70B-Instruct | |
| ``` | |
| - Use exact model | |
| - Predictable results | |
| - Model-specific pricing | |
| ### Budget Management | |
| Set budget limits to control costs: | |
| 1. Open **Settings** tab | |
| 2. Expand **Budget Management** | |
| 3. Set budget limit (e.g., $5.00) | |
| 4. Configure alert thresholds (75%, 90%, 100%) | |
| 5. Enable "Require confirmation at limit" | |
| The system will alert you as you approach your budget and provide cost-reduction tips. | |
| ## π Usage | |
| 1. **Enter Ticker**: Type a stock symbol (e.g., AAPL, MSFT, BTC-USD) | |
| 2. **Select Style**: Choose Long-term or Swing trading | |
| 3. **Configure Phases**: Enable desired analysis phases | |
| 4. **Run Analysis**: Click "π Analyze" and wait for results | |
| 5. **Review Reports**: Check Decision, Technical, Pattern, and Trend analysis tabs | |
| 6. **Monitor Costs**: View cost summary at bottom of page | |
| ## π― Supported Assets | |
| - **Stocks**: AAPL, MSFT, GOOGL, TSLA, etc. | |
| - **Crypto**: BTC-USD, ETH-USD, etc. | |
| - **Indices**: ^GSPC (S&P 500), ^DJI (Dow Jones) | |
| - **Commodities**: GC=F (Gold), CL=F (Oil) | |
| ## π Privacy & Security | |
| - **Private Spaces**: Set Space to "Private" to restrict access | |
| - **Public Spaces**: Use HuggingFace Inference Providers with `:cheapest` routing | |
| - Avoid adding OpenAI/Anthropic keys to public Spaces | |
| - Free-tier models prevent unexpected costs | |
| ## π οΈ Advanced Configuration | |
| ### Per-Agent Routing | |
| Configure different routing policies for each agent: | |
| 1. Open **Settings** β **Per-Agent Routing Configuration** | |
| 2. Set policies per agent: | |
| - Fast agents (Indicator, Pattern) β `:cheapest` | |
| - Decision agents (Decision, Portfolio) β `:fastest` | |
| 3. Apply presets: | |
| - **Cost Optimized**: All agents use `:cheapest` | |
| - **Performance Optimized**: All agents use `:fastest` | |
| - **Balanced**: Smart mix of cheap and premium | |
| ### Export/Import Configuration | |
| Save and share your configuration: | |
| 1. **Export**: Click "Export Config" to get JSON | |
| 2. **Import**: Paste JSON and click "Import Config" | |
| 3. **Share**: Send JSON to team members | |
| ## π Cost Comparison | |
| | Provider | Model | Cost per 1M tokens | Free Tier | | |
| |----------|-------|-------------------|-----------| | |
| | HF Inference (:cheapest) | Various | $0.00 - $0.20 | β Yes | | |
| | HF Inference (groq) | Llama 3.3 70B | $0.05 - $0.10 | β Yes | | |
| | OpenAI | GPT-4 | $30.00 | β No | | |
| | OpenAI | GPT-3.5-turbo | $1.50 | β No | | |
| | Anthropic | Claude 3.5 Sonnet | $3.00 | β No | | |
| π‘ **Recommendation**: Use `:cheapest` routing for 90%+ cost savings | |
| ## π€ Contributing | |
| This platform is part of the trading-tools project. For issues or contributions, visit the GitHub repository. | |
| ## π License | |
| MIT License - See LICENSE file for details | |
| ## π Credits | |
| Built with: | |
| - **LangGraph** & **LangChain**: Multi-agent orchestration | |
| - **HuggingFace Inference Providers**: Multi-provider LLM access | |
| - **Gradio**: Web interface framework | |
| - **yfinance**: Market data | |
| - **TA-Lib/pandas-ta**: Technical indicators | |
| --- | |
| **Note**: This is an AI-powered analysis tool. Always perform your own due diligence before making investment decisions. | |