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.
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.
| 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 |
| 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 |
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
- Auth: User logs in via Uphold OAuth2 → access token stored in DB
- Rebalancing: Every 6 hours, the scheduler fetches all Uphold-supported tokens, queries CoinMarketCap for market data, and rebuilds each ETF's composition
- 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
- 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
- Docker & Docker Compose
- Uphold developer account (sandbox)
- CoinMarketCap API key
- CryptoPanic API key
- Groq API key
-
Clone the repository:
git clone https://github.com/barros-11/crypto_etf cd crypto_etf -
Create your
.envfile: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
-
Run with Docker:
docker-compose up --build
-
Access the API docs:
http://localhost:8000/docs