Skip to content

chanakyavasantha/macromind-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿฆ MacroMind

A real-time macroeconomic analytics platform with AI-powered insights and alerts.

๐ŸŽฏ Overview

MacroMind is a FastAPI-based application that provides real-time economic data analysis and AI-generated insights. The platform fetches economic indicators from the Federal Reserve, analyzes market conditions, and delivers intelligent alerts to help users understand macroeconomic trends.

โœจ Features

  • ๐Ÿ“Š Real-time Economic Data : Automatic fetching and updating of key economic indicators from FRED API
  • ๐Ÿค– AI-Powered Insights : Intelligent analysis of economic conditions using advanced algorithms
  • ๐Ÿšจ Alert System : Automated alerts for significant economic events and trends
  • ๐Ÿ”Œ RESTful API : Clean, well-documented API endpoints for easy integration
  • ๐Ÿ’š Health Monitoring : Built-in health checks and system status monitoring
  • ๐Ÿ“ˆ Trading Signals : Basic trading recommendations based on economic conditions

๐Ÿ“ Project Structure

macromind/
โ”œโ”€โ”€ macromind-backend/          # Backend API server
โ”‚   โ”œโ”€โ”€ api/                    # API endpoints
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ health.py          # Health check endpoints
โ”‚   โ”‚   โ”œโ”€โ”€ indicators.py      # Economic indicators API
โ”‚   โ”‚   โ””โ”€โ”€ insights.py        # AI insights and alerts API
โ”‚   โ”œโ”€โ”€ app/                    # Core application logic
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ agent.py           # Economic Intelligence Agent
โ”‚   โ”‚   โ”œโ”€โ”€ config.py          # Configuration settings
โ”‚   โ”‚   โ”œโ”€โ”€ data_fetcher.py    # FRED API data fetching
โ”‚   โ”‚   โ”œโ”€โ”€ models.py          # Pydantic data models
โ”‚   โ”‚   โ””โ”€โ”€ utils.py           # Helper functions
โ”‚   โ”œโ”€โ”€ tests/                  # Test suite
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ test_api.py
โ”‚   โ”‚   โ””โ”€โ”€ test_agent.py
โ”‚   โ”œโ”€โ”€ .env.example           # Environment variables template
โ”‚   โ”œโ”€โ”€ .gitignore            # Git ignore rules
โ”‚   โ”œโ”€โ”€ main.py               # Application entry point
โ”‚   โ”œโ”€โ”€ requirements.txt      # Python dependencies
โ”‚   โ””โ”€โ”€ README.md             # This file
โ””โ”€โ”€ macromind-frontend/        # Frontend application (planned)

๐Ÿ”Œ API Endpoints

๐Ÿ“Š Economic Indicators

  • GET /api/indicators - Get all economic indicators
  • GET /api/indicators/{indicator_name} - Get specific indicator (GDP, UNEMPLOYMENT, INFLATION, FED_FUNDS, CONSUMER_SENTIMENT)

๐Ÿค– AI Insights

  • GET /api/insights - Get AI-generated economic insights and analysis
  • GET /api/alerts - Get current economic alerts and warnings

๐Ÿ’š Health

  • GET /api/health - System health check and status
  • GET / - API information and available endpoints

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.8+
  • pip or conda
  • FRED API key (free from St. Louis Fed)

Installation

  1. Clone the repository:
git clone <repository-url>
cd macromind/macromind-backend
  1. Install dependencies:
pip install -r requirements.txt
  1. Configure environment:
cp .env.example .env
# Edit .env and add your FRED API key
  1. Run the application:
python main.py

The API will be available at http://localhost:8000

๐Ÿ”‘ Getting FRED API Key

  1. Visit FRED API Key Registration
  2. Sign up for a free account
  3. Request an API key
  4. Add it to your .env file:
FRED_API_KEY=your_actual_api_key_here

๐Ÿ“š API Documentation

Once the server is running, you can access:

  • Interactive API docs : http://localhost:8000/docs
  • ReDoc documentation : http://localhost:8000/redoc
  • API endpoints : http://localhost:8000/api/

๐Ÿ’ก Usage Examples

Get All Economic Indicators

curl http://localhost:8000/api/indicators

Get AI Economic Insights

curl http://localhost:8000/api/insights

Get Current Alerts

curl http://localhost:8000/api/alerts

Check System Health

curl http://localhost:8000/api/health

๐Ÿ› ๏ธ Development

Running Tests

cd macromind-backend
pytest tests/

Environment Configuration

Create a .env file with the following variables:

# Required
FRED_API_KEY=your_fred_api_key_here

# Optional
API_HOST=0.0.0.0
API_PORT=8000
DEBUG=true
LOG_LEVEL=INFO

Code Structure

  • main.py : FastAPI application entry point
  • app/config.py : Configuration and settings management
  • app/models.py : Pydantic data models for API responses
  • app/agent.py : Economic Intelligence Agent with analysis logic
  • app/data_fetcher.py : FRED API integration and data fetching
  • api/ : API endpoint definitions organized by functionality

๐Ÿง  Economic Intelligence Agent

The AI agent provides:

  • Economic Health Assessment : Scores overall economic conditions (strong/moderate/weak)
  • Multi-factor Analysis : Evaluates employment, inflation, growth, sentiment, and monetary policy
  • Automated Insights : Generates natural language summaries of economic conditions
  • Risk Detection : Identifies economic concerns and opportunities
  • Alert Generation : Creates warnings for significant economic changes
  • Trading Signals : Basic recommendations for bonds, equities, and USD

๐Ÿ“Š Supported Economic Indicators

Indicator FRED Series ID Description
GDP GDP Gross Domestic Product
UNEMPLOYMENT UNRATE Unemployment Rate
INFLATION CPIAUCSL Consumer Price Index
FED_FUNDS FEDFUNDS Federal Funds Rate
CONSUMER_SENTIMENT UMCSENT University of Michigan Consumer Sentiment

๐Ÿ”ฎ Technology Stack

  • Backend : FastAPI, Python 3.8+
  • Data Processing : Pandas, NumPy
  • HTTP Client : HTTPX for async API calls
  • Data Models : Pydantic for validation
  • Server : Uvicorn ASGI server
  • Testing : Pytest
  • Environment : python-dotenv

๐Ÿšง Features in Development

  • Frontend web application (React.js)
  • Enhanced AI models with ML forecasting
  • Additional economic indicators (10Y Treasury, VIX, etc.)
  • Real-time WebSocket notifications
  • Historical data analysis and backtesting
  • Custom alert configuration
  • Data visualization charts
  • Multi-country economic analysis

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Add tests for new functionality
  5. Ensure tests pass (pytest tests/)
  6. Commit your changes (git commit -m 'Add amazing feature')
  7. Push to the branch (git push origin feature/amazing-feature)
  8. Open a Pull Request

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

๐Ÿ“ง Contact

  • Author : Chanakya Vasantha
  • Email : [[email protected]]
  • LinkedIn : [your-linkedin-profile]
  • GitHub : [your-github-username]

โญ Star this repository if you found it helpful!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages