Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📈 Crypto ETF Fund Manager

A full-stack, AI-powered crypto investment platform that lets users invest in curated ETF strategies backed by real trades executed via the Uphold API.

🚀 What It Does

Users authenticate via their Uphold account and can invest in one of three AI-managed ETF strategies. The platform automatically rebalances portfolios every 6 hours, fetches real-time market data, and uses AI-driven news sentiment analysis to adjust allocations.

🧠 ETF Strategies

Strategy Risk Description
The Fortress Low (2/10) Top coins weighted proportionally by market cap
Meme Kings High (9/10) Top meme coins with equal weight allocation
News AI Aggressive Medium-High (7/10) AI-selected coins based on real-time news sentiment

🛠️ Tech Stack

Layer Technology
Backend FastAPI (async)
Database PostgreSQL + SQLAlchemy (async)
Broker Uphold API (OAuth2 + REST)
Market Data CoinMarketCap API
News & Sentiment CryptoPanic API + Groq AI (Llama 3.3)
Scheduler APScheduler (rebalance every 6h)
Infrastructure Docker + Docker Compose

🏗️ Architecture

app/
├── main.py               # FastAPI app, lifespan, scheduler
├── models.py             # SQLAlchemy ORM models
├── schemas.py            # Pydantic request/response schemas
├── database.py           # Async DB engine & session
├── dependencies.py       # Auth dependency injection
├── routers/
│   ├── auth.py           # Uphold OAuth2 login & callback
│   ├── info.py           # Dashboard, portfolio, ETF listings
│   └── transactions.py   # ETF buy execution
└── services/
    ├── uphold.py         # Uphold API client (trades, cards, tokens)
    ├── etfs_manager.py   # ETF rebalancing logic + CoinMarketCap
    ├── investments.py    # Investment execution service
    └── sentiment.py      # CryptoPanic + Groq AI sentiment engine

⚙️ How It Works

  1. Auth: User logs in via Uphold OAuth2 → access token stored in DB
  2. Rebalancing: Every 6 hours, the scheduler fetches all Uphold-supported tokens, queries CoinMarketCap for market data, and rebuilds each ETF's composition
  3. Sentiment Engine: CryptoPanic news is fetched in batches, filtered to the last 48 hours, and sent to Groq's Llama 3.3 for bullish/bearish scoring
  4. Trade Execution: When a user buys an ETF, the platform splits the USD amount across each component and executes individual trades on Uphold with retry logic on failures

🚀 Getting Started

Prerequisites

  • Docker & Docker Compose
  • Uphold developer account (sandbox)
  • CoinMarketCap API key
  • CryptoPanic API key
  • Groq API key

Setup

  1. Clone the repository:

    git clone https://github.com/barros-11/crypto_etf
    cd crypto_etf
  2. Create your .env file:

    UPHOLD_CLIENTE_ID=your_uphold_client_id
    UPHOLD_CLIENTE_SECRET=your_uphold_client_secret
    UPHOLD_BASE_URL=https://api-sandbox.uphold.com
    CMC_API_KEYS=your_coinmarketcap_key
    CRYPTO_PANIC_API_KEYS=your_cryptopanic_key
    GROQ_API_KEYS=your_groq_key
    RANDOM_KEY_MIDDLEWARE=your_random_secret
  3. Run with Docker:

    docker-compose up --build
  4. Access the API docs:

    http://localhost:8000/docs
    

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages