StopLoss

Stop the loss

Visit Repo
StopLoss banner

About

## Challenges we ran into

## Challenges We Ran Into

Building a real-time, multi-agent financial terminal with zero-hallucination guarantees and strict latency budgets presented several non-trivial engineering hurdles. Here are the core challenges we faced and how we solved them:

---

### 1. The Bulk-Synchronous Join Barrier Bottleneck * **The Hurdle**: In early iterations of our LangGraph ingestion graph, all 6 data sources (Prices, Macro, Weather, and 3 Thematic News streams) fanned into a central normalization node. Because LangGraph’s Pregel execution engine operates on bulk-synchronous supersteps, a single slow external network call (e.g., a 2.5-second macro or weather API delay) forced real-time market price feeds to freeze before beginning normalization, embedding, or indexing. * **How We Got Over It**: We restructured the graph into **unblocked, independent stream lanes** (`stream_{source}`). Each lane runs its entire lifecycle (fetch $\rightarrow$ normalize $\rightarrow$ dedupe $\rightarrow$ tag $\rightarrow$ embed $\rightarrow$ vector index) concurrently without waiting for sibling streams, merging state using LangGraph reducers (`merge_maps`, `merge_lists`). The only barrier join occurs at the very end when writing the cycle-level evidence log.

---

### 2. Windows Environment Constraints & Embedding Portability * **The Hurdle**: On Windows developer machines with Application Control (WDAC), compiled C-extension DLLs bundled with heavy dependencies like `sentence-transformers` and `pandas` were blocked. Furthermore, environments lacking GPU PyTorch wheels were prone to failing silently or falling back to dummy hashes that corrupted vector search. * **How We Got Over It**: We decoupled the embedding layer and built an ONNX Runtime adapter (`OnnxEmbeddings` via `fastembed`) targeting `BAAI/bge-base-en-v1.5`. This achieved $\ge 0.999$ self-cosine similarity against full GPU PyTorch weights on pure CPU without heavy external dependencies. We also capped thread pools to `min(8, cores)` after benchmarks showed 20-thread pools suffered thread wake-up lag (129 ms vs. 34 ms).

---

### 3. Silent Data Loss: The North Atlantic `"NA"` Parsing Bug * **The Hurdle**: While backfilling 2,700+ historical cyclones from IBTrACS to power our Historical Analogs Agent, standard CSV parsing turned the North Atlantic basin code `"NA"` into a null `NaN`. As a result, 470 Gulf of Mexico and Atlantic hurricanes silently lost their basin labels, causing analog queries to return empty results for US/Gulf refinery disruption threats. * **How We Got Over It**: We introduced strict parsing safeguards (`keep_default_na=False, na_values=[""]`), added geographical bounding-box fallbacks to restore missing basin tags from storm coordinates, and stamped an explicit transformation audit record onto every modified document.

---

### 4. Cross-Continental Network Physics vs. The 1.0s Latency SLA * **The Hurdle**: Our architectural contract required per-item process + embed + index to finish in **under 1.0 second**. While local ONNX embedding completed in ~90–150 ms (p95), writing to remote cloud vector indexes (Pinecone in `aws/us-east-1`) pushed the p95 processing time to 1,015 ms, narrowly breaching our budget due to transatlantic network round-trip latency. * **How We Got Over It**: We instrumented granular telemetry isolating `fetch_latency_ms`, `embed_ms`, `upsert_ms`, and `queryable_ms`. By isolating the network floor from code execution, we proved local compute takes only ~158 ms (well under budget). We also implemented a swappable `VectorStoreAdapter` allowing local Weaviate Docker containers for zero-latency development and provided an automated probe script (`make latency`) that profiles latency distributions transparently in `docs/latency_report.md`.

---

### 5. LLM Citation Hallucinations & Compound Reference Leaks * **The Hurdle**: Our Evidence & Audit Agent scans generated narratives to verify that every numeric claim matches primary evidence (`[E#]`). However, language models frequently clumped citations (e.g. `[E1, 10]` or `[E2-E4]`). The audit regex either failed to parse them or interpreted the unbracketed numbers (e.g., `10`) as ungrounded quantitative statistics, incorrectly docking the system's Trust Score. * **How We Got Over It**: We added a deterministic citation normalizer that decomposes compound tags into isolated tokens (`[E1]`, `[E10]`) prior to executing the numeric audit pass. This eliminated false-positive audit failures while keeping the audit strict and verifiable.

## The problem it solves

Portfolio risk is shaped by more than stock prices. A tariff announcement, bank policy change, war, oil shock, or severe weather event can affect holdings before its impact is obvious in the market. Yet the relevant information is scattered across news feeds, economic databases, weather forecasts, and price charts. Investors have to connect those signals themselves, judge their reliability, and decide whether to hedge.

**StopLoss brings those signals into one financial intelligence terminal.** Its ingestion layer collects news from Google News RSS, GDELT, and Yahoo Finance; macro indicators such as oil prices, CPI, Fed Funds, and yield curves from FRED; weather and marine forecasts from Open-Meteo; and NSE market prices through yfinance. Each record is tagged by theme, deduplicated, indexed for search, and stored with its source, timestamps, and data-quality status.

That foundation is designed to feed four specialized agents: sentiment, weather and macro impact, quantitative risk, and hedging strategy. Together, they aim to turn fragmented events into traceable portfolio risk assessments and evidence-backed protection ideas. StopLoss’s strengths are its **multi-source ingestion, NSE focus, modular agent architecture, and auditable data lineage**.

Screenshots

StopLoss screenshot 1StopLoss screenshot 2StopLoss screenshot 3

Team

From the public Devfolio project page. Votes, swipes and the judge score are hackfeed's own.

AI judge

Not judged yet. A free model reads this page, compares it with similar projects and this event's winners, then scores it and says what would make it win.

Still being built?

Not checked yet.

Swipe stats

0upvotes
0skips
0saves

Discussion 0

No comments yet. Ask the team something, or say what you'd use it for.

Posting as a guest. Plain text, 1,000 characters max.

Already built nearby

Closest projects by meaning and shared words. Similar isn't the same as copied: read them.