CoolFace
Apppublic

zyonpackers/zyon-traders-backend

sourceHugging Facemitupdated 1y agoView on Hugging Face
0likes
App README

Zyon Traders Backend API

AI-powered trading platform backend built with FastAPI. This backend provides:

  • —Real-time Market Data: Integration with Dhan API for live stock prices
  • —AI Trading Signals: Machine learning powered trading recommendations using multiple AI services
  • —Portfolio Analytics: Advanced risk analysis and performance metrics
  • —WebSocket Support: Real-time data streaming to frontend clients
  • —Authentication: Supabase integration for user management

Features

🤖 AI Services Integration

  • —Google Gemini: Market analysis and signal generation
  • —Together AI: Alternative ML models for trading insights
  • —Fireworks AI: High-performance inference
  • —HuggingFace: Open-source ML models

📊 Trading Features

  • —Real-time market data from Dhan API
  • —Portfolio tracking and management
  • —Risk analysis (VaR, Sharpe ratio, etc.)
  • —Stock screening with technical indicators
  • —Order management (buy/sell/cancel)

🔐 Security

  • —JWT token authentication
  • —CORS protection
  • —Rate limiting
  • —Environment variable security

API Endpoints

  • —GET /api/health - Health check
  • —POST /api/auth/login - User authentication
  • —GET /api/dhan/quotes - Real-time stock quotes
  • —GET /api/signals/generate - AI trading signals
  • —GET /api/portfolio/analytics - Portfolio analysis
  • —GET /api/screener/stocks - Stock screening
  • —WebSocket /ws - Real-time data streaming

Environment Variables Required

Set these in your HuggingFace Space settings:

SECRET_KEY=your-secret-key
SUPABASE_PROJECT_URL=your-supabase-url
SUPABASE_ANON_KEY=your-supabase-key
DHAN_API_KEY=your-dhan-api-key
GEMINI_API_KEY=your-gemini-key
TOGETHER_API_KEY=your-together-key
FIREWORKS_API_KEY=your-fireworks-key
HUGGINGFACE_API_KEY=your-hf-key
ALLOWED_ORIGINS=https://your-frontend-domain.com

Usage

Once deployed, your API will be available at:

  • —Main endpoint: https://your-username-zyon-traders-backend.hf.space
  • —Health check: https://your-username-zyon-traders-backend.hf.space/api/health
  • —API docs: https://your-username-zyon-traders-backend.hf.space/docs

Local Development

bash
cd backend
pip install -r requirements.txt
uvicorn main:app --reload --port 8000

Architecture

Built with:

  • —FastAPI: High-performance Python web framework
  • —WebSockets: Real-time communication
  • —Pydantic: Data validation and settings management
  • —Asyncio: Asynchronous programming for high concurrency
  • —Docker: Containerized deployment

License

MIT License - see LICENSE file for details.