How vruxak21/tradeflow works
Project type and purpose
• TradeFlow is a full‑stack, cross‑platform mobile (and desktop/web) financial application.
• Frontend: Flutter app (Android/iOS/Linux/Mac/Windows/Web).
• Backend: Two Flask‑based Python microservices for API handling and recommendation logic.
• Purpose: Authenticate users, fetch real‑time market data, serve AI chatbot, generate personalized stock recommendations, display analytics and educational content.
File structure
• Top‑level “my_app” directory: contains a standard Flutter project (“android/”, “ios/”, “linux/”, “macos/”, “windows/”, “web/”), Dart source under lib/, tests, plus a python_server folder.
• “python_server/”: two entry points (app.py and stock_api.py) plus modules for data ingestion, recommendation, symbol lookups, user input handling.
• Configuration and build files show this is a multi‑platform Flutter project using CMake for desktop targets.
• .yaml files (pubspec.yaml, analysis_options.yaml) declare Flutter/Dart dependencies.
README for architectural insights
• Frontend communicates with:
• Firebase (Authentication, Database)
• Flask servers (REST API endpoints)
• Backend communicates with external services:
• yfinance, Alpha Vantage, GNews for market data
• Gemini API for AI chatbot
• Two separate Flask servers are started (app.py, stock_api.py), indicating a microservice approach.
Main components
a. Frontend (Flutter app)
– UI Layer: pages, components, widgets.
– Service Layer: Dart services (api_service.dart, stock_service.dart).
b. Authentication & Data Store (Firebase)
– Firebase Auth
– Firestore / Realtime Database
c. Backend Microservices
– Main Flask Server (app.py): handles user requests, AI chatbot, orchestrates recommendation workflow.
– Stock API Server (stock_api.py): dedicated to fetching/processing real‑time stock data.
d. External APIs & Data Sources
– yfinance, Alpha Vantage, GNews for market data and news.
– Gemini API for FinAI Chatbot.
e. User Devices
– Android, iOS, Linux, Mac, Windows, Web browsers.
Relationships and interactions
• The Flutter app UI calls Dart service classes which:
• Perform Firebase Auth operations directly.
• Send HTTP(S) requests to the Flask microservices.
• Main Flask Service:
• Validates tokens (Firebase Auth), fetches user profile data from Firebase DB.
• Routes AI chatbot queries to Gemini API.
• Calls Stock API Server or directly uses modules for recommendation logic.
• Persists recommendation history or user inputs back to Firebase DB.
• Stock API Service:
• Receives HTTP requests from Main Flask Service or directly from app.
• Fetches market data from yfinance/Alpha Vantage/GNews.
• Returns cleaned JSON to callers.
• All external services (APIs & Firebase) are over secure HTTPS.
Architectural patterns & design principles
• Microservices: Two Flask servers each with a single responsibility.
• Layered Frontend: UI layer separated from networking/services.
• RESTful APIs: JSON over HTTP between Flutter and Flask.
• Cloud‑native: offloading auth and persistence to Firebase.
• Dependency Injection in Dart (service classes) for testability.
• Modular Python code for data, recommendation, and API wrappers.
Essential elements
• Clear component labels and groupings.
• Notes on key technologies (Flutter, Dart, Flask, Firebase, yfinance, Alpha Vantage, GNews, Gemini API).