RL · NLP · TIME SERIES

News-Aware Portfolio
Optimization Agent

A reinforcement-learning trading agent that fuses numerical market signals with natural-language news sentiment, deployed via FastAPI with full model interpretability.

Portfolio agent home screen

Project Overview

Problem

Portfolio decisions are sequential and uncertain. Real systems must integrate structured time-series data with unstructured information such as news.

Solution

This project implements a reinforcement-learning agent that learns when to invest or stay in cash using return regimes and sentiment polarity.

Machine Learning System

State

  • Return regime (neg / neutral / pos)
  • Sentiment polarity (neg / neutral / pos)
  • Discrete state encoding

Actions

  • 0 — Stay in cash
  • 1 — Invest

Learning

  • Tabular Q-learning
  • Reward-based optimization
  • Greedy policy at inference

Demo Screenshots

Home page before input
Initial UI before user input
Developer insights open
Prediction with Developer Insights expanded

Run Locally

FastAPI Application

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pip install python-multipart
python train.py
uvicorn api.main:app --reload

Open http://127.0.0.1:8000

GitHub Pages Preview

python3 -m http.server 5500

Open http://127.0.0.1:5500/docs