Other Projects

Other interesting projects

Scroll to explore
AI · Reinforcement Learning

BuzzaMaker

BuzzaMaker encodes a stock's price history, its own news and broad macro news with a dual-stream Transformer, then lets a PPO agent decide how much of each stock — and cash — to hold every step, optimising log return after trading costs. Built on a real data pipeline that scrapes prices, crawls news and embeds it end to end.

Role
Solo — design, data pipeline, model & training
Focus
Deep RL · multi-modal Transformer
Stack
PyTorch · Stable-Baselines3 PPO · Gymnasium · Gemini embeddings
Overview

The market is unpredictable — so let a model learn to act in it

Markets carry too many variables and too many unforeseeable shocks to script a strategy by hand. BuzzaMaker reframes the problem as one a model can learn: understand the recent past as a time series, then take an action, observe the outcome, and improve.

A Transformer reads each stock's price window together with the news that surrounds it — both the stock's own headlines and the macro backdrop — and a PPO agent turns that understanding into portfolio weights. The reward is the realised log return net of trading cost, so the policy is pushed toward risk-adjusted gains rather than raw bets.

Core — Model Architecture

A dual-stream Transformer that learns how much to trust the news

01

Dual-stream Transformer

Each StockNewsTransformerLayer runs self-attention over the price series and self-attention over the news embeddings separately, then a stock→news cross-attention lets price queries attend to the surrounding headlines. Stock and news each get their own 4× GELU feed-forward block.

02

Learnable news gate

Cross-attention is scaled by a learnable gate initialised to zero, so the model starts ignoring news and gradually learns how much to trust it during training — a built-in curriculum that keeps early training stable.

03

Portfolio-level aggregation

PortfolioMaker runs a StockNewsAgent per stock, then builds a macro token from global news and runs self-attention over [macro, stock₁ … stockₙ] so cross-asset and macro context shape every weight before the policy head reads them.

04

No future leakage

Causal masking on the price attention and learnable positional embeddings over a 60-day window keep the encoder strictly backward-looking — the model can only ever attend to information it would actually have had.

Reinforcement Learning

A PPO agent that allocates capital every step

A dual-stream Transformer (d_model 256 · 4 heads · 2 layers) reads each stock's price window beside its news, fuses cross-asset and macro context, and a PPO head turns the result into portfolio weights — built per stock, then aggregated.
Stock seriesN × 60 × FOHLCV window · Linear→256
Per-stock newsN × 60 × 768Gemini emb · Linear·ReLU·Linear
Macro news60 × 768global headlines · Linear·ReLU·Linear
× 2 layers
Stock self-attn
causal · MHA
News self-attn
causal · MHA
cross-attn · stock ← news · gate → 0
Stock FFN
256 → 1024 → 256 · GELU
News FFN
256 → 1024 → 256 · GELU
Last-step token
per stock · 256-D
Portfolio attention
concat [ macro, stock₁ … stockₙ ] · MHA → drop macro
PPO policy
logits N+1 → softmax weights (+ cash) · reward log(1 + net − cost)
Data Pipeline

Real prices and real news, scraped and embedded from scratch

Stock prices

OHLCV history pulled from Yahoo Finance via yfinance — 2017–2024 for training and early 2025 held out for testing (AAPL, given the cost of broader collection).

Stock-specific news

GDELT DOC 2.0 queried in 7-day rolling windows, articles fetched with the newspaper library, deduplicated by URL and parsed to text.

Macro news

Five themed keyword sets (politics, economy, technology, society, environment) scraped concurrently through a ThreadPoolExecutor with retry/backoff and resumable date logging.

Embeddings

Every article title embedded with Google Gemini (gemini-embedding-001) into 768-d vectors, batched and resumable so a stopped run picks up where it left off.

Stack

What it's built on

Modeling
PyTorchMulti-head attentionGated cross-attentionLearnable positional embedding
Reinforcement learning
Stable-Baselines3 PPOGymnasiumMultiInputPolicyCustom feature extractor
Data
yfinanceGDELT DOC 2.0newspaperpandas / numpy
Embeddings
Google Gemini (genai)768-d vectorsBatched & resumable
Infra
Python 3.12python-dotenvThreadPoolExecutor

Designed and built end to end — the scraping and embedding pipeline, the multi-modal Transformer encoder, and the reinforcement-learning portfolio policy.