Sponsored by Deepsite.site

Bull Vision Agent

Created By
Cognitive-Stack7 months ago
A FastAPI application that integrates with Telegram using webhooks and OpenAI Agents SDK for AI-powered stock trading assistance, utilizing MCPHub for multiple MCP server management.
Content

Bull Vision Agent

A FastAPI application that integrates with Telegram using webhooks and OpenAI Agents SDK for AI-powered stock trading assistance, utilizing MCPHub for multiple MCP server management.

Features

  • Telegram bot integration with webhook support
  • AI-powered stock analysis using OpenAI Agents SDK
  • Multiple MCP server integration via MCPHub:
    • Stock news analysis
    • Volume wall detection
  • Real-time stock data analysis
  • Market news integration
  • Conversation history tracking
  • Trading context management
  • MongoDB integration for data persistence

Project Structure

├── app/
│   ├── __init__.py
│   ├── main.py           # FastAPI app with MCPHub initialization
│   ├── api/
│   │   ├── __init__.py
│   │   └── telegram_webhook.py  # Telegram webhook endpoint
│   ├── bot/
│   │   ├── __init__.py
│   │   ├── bot.py            # Bot instance and context management
│   │   ├── agent.py          # AI agent implementation with MCP servers
│   │   ├── context.py        # Conversation context and history
│   │   └── telegram_handler.py  # Process incoming messages
│   ├── core/
│   │   ├── __init__.py
│   │   └── settings.py   # Application settings
│   ├── models/
│   │   ├── __init__.py
│   │   └── news.py           # News data models
│   ├── services/
│   │   ├── __init__.py
│   │   └── mongodb_service.py # MongoDB operations
│   └── startup.py        # Startup events

Setup

  1. Clone the repository

  2. Install dependencies:

    poetry install
    
  3. Copy .env.example to .env and fill in the required values:

    cp .env.example .env
    
  4. Edit .env with your actual values:

    • TELEGRAM_BOT_TOKEN: Your Telegram bot token from @BotFather
    • TELEGRAM_WEBHOOK_URL: The public URL where your bot will receive updates
    • HOST and PORT: Server configuration
    • AZURE_OPENAI_API_KEY: Your Azure OpenAI API key
    • AZURE_OPENAI_ENDPOINT: Your Azure OpenAI endpoint
    • AZURE_OPENAI_DEPLOYMENT: Your Azure OpenAI deployment name
    • AZURE_OPENAI_API_VERSION: Azure OpenAI API version
    • MONGO_URI: MongoDB connection string
    • MONGO_DB: MongoDB database name

Running the Application

Start the server:

make run

Webhook Setup

  1. Make sure your server is publicly accessible
  2. The webhook URL should be in the format: https://your-domain.com/api/telegram/webhook
  3. The webhook will be automatically registered when the application starts

Available Commands

  • /start - Start the bot
  • /help - Show help message

Example Queries

You can ask the bot about:

  • Stock analysis (e.g., "Analyze AAPL")
  • Market news (e.g., "What's the latest news about Tesla?")
  • Trading strategies (e.g., "What's your view on the current market?")
  • Volume analysis (e.g., "Check volume patterns for MSFT")

Development Commands

make install    # Install dependencies
make run       # Run the application
make test      # Run tests
make lint      # Run linters
make format    # Format the code
make clean     # Clean up generated files
make setup     # Setup development environment
make check     # Run all checks

Documentation

For detailed instructions on:

  1. Setting up the AI Chatbot with Telegram and OpenAI Agents SDK, see init_telegram_openai_agent.md
  2. Using MCPHub with multiple MCP servers, see create_telegram_chatbot_multi_mcp_server.md
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Tavily Mcp
DeepChatYour AI Partner on Desktop
ChatWiseThe second fastest AI chatbot™
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
WindsurfThe new purpose-built IDE to harness magic
CursorThe AI Code Editor
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Playwright McpPlaywright MCP server
Serper MCP ServerA Serper MCP Server
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Amap Maps高德地图官方 MCP Server