<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Krasimir Petkov</title>
    <description>The latest articles on DEV Community by Krasimir Petkov (@krasimir_petkov_c14f3b461).</description>
    <link>https://dev.to/krasimir_petkov_c14f3b461</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3726717%2Ff8a42df4-583d-4628-b9af-b668c90b6f41.png</url>
      <title>DEV Community: Krasimir Petkov</title>
      <link>https://dev.to/krasimir_petkov_c14f3b461</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/krasimir_petkov_c14f3b461"/>
    <language>en</language>
    <item>
      <title>Building a Real-Time Stock Scanner with Redis, WebSockets, and Postgres</title>
      <dc:creator>Krasimir Petkov</dc:creator>
      <pubDate>Thu, 22 Jan 2026 17:32:33 +0000</pubDate>
      <link>https://dev.to/krasimir_petkov_c14f3b461/building-a-real-time-stock-scanner-with-redis-websockets-and-postgres-2ig2</link>
      <guid>https://dev.to/krasimir_petkov_c14f3b461/building-a-real-time-stock-scanner-with-redis-websockets-and-postgres-2ig2</guid>
      <description>&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;This project started as an internal tool to understand unusual volume and intraday activity across thousands of US stocks.&lt;/p&gt;

&lt;p&gt;I recently built a real-time stock scanner that ingests thousands of symbols, processes live updates, and serves them to users with minimal delay. This post is a short breakdown of the architecture decisions that worked (and the ones that didn’t).&lt;/p&gt;




&lt;h2&gt;
  
  
  The Core Problem
&lt;/h2&gt;

&lt;p&gt;Market data is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;high-frequency&lt;/li&gt;
&lt;li&gt;bursty&lt;/li&gt;
&lt;li&gt;time-sensitive&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Writing every update directly to a relational database quickly becomes expensive and unnecessary — especially when most of the data is only relevant for seconds or minutes.&lt;/p&gt;




&lt;h2&gt;
  
  
  Architecture Overview
&lt;/h2&gt;

&lt;p&gt;The system is split into three layers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Ingestion&lt;/strong&gt; — pulling snapshot and streaming data from external APIs
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Processing&lt;/strong&gt; — normalizing, filtering, and calculating derived metrics
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Distribution&lt;/strong&gt; — pushing live updates to the frontend&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At a high level:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Redis handles hot, ephemeral data&lt;/li&gt;
&lt;li&gt;Postgres stores validated, historical data&lt;/li&gt;
&lt;li&gt;WebSockets deliver updates to clients in real time&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Why Redis for Live Data
&lt;/h2&gt;

&lt;p&gt;Redis turned out to be a much better fit than Postgres for intraday updates:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In-memory speed&lt;/li&gt;
&lt;li&gt;Natural TTL support for expiring symbols&lt;/li&gt;
&lt;li&gt;Pub/Sub for fan-out&lt;/li&gt;
&lt;li&gt;Zero WAL / IO pressure&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Postgres is still excellent — just not for data that changes every few seconds.&lt;/p&gt;




&lt;h2&gt;
  
  
  WebSockets for Distribution
&lt;/h2&gt;

&lt;p&gt;Instead of polling:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;active symbols are tracked dynamically&lt;/li&gt;
&lt;li&gt;only “in-play” tickers receive updates&lt;/li&gt;
&lt;li&gt;clients subscribe to exactly what they need&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This keeps both bandwidth and server load under control.&lt;/p&gt;




&lt;h2&gt;
  
  
  What I’d Do Differently Next Time
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Separate “hot” and “cold” data earlier&lt;/li&gt;
&lt;li&gt;Treat intraday data as disposable by default&lt;/li&gt;
&lt;li&gt;Avoid over-modeling early — schemas can come later&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Live Demo
&lt;/h2&gt;

&lt;p&gt;The project is live here:&lt;br&gt;&lt;br&gt;
&lt;a href="https://zipston.com" rel="noopener noreferrer"&gt;https://zipston.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It’s still evolving, but the core real-time pipeline is already doing the heavy lifting.&lt;/p&gt;




&lt;h2&gt;
  
  
  Closing Thoughts
&lt;/h2&gt;

&lt;p&gt;Real-time systems are less about frameworks and more about respecting the nature of your data.&lt;/p&gt;

&lt;p&gt;If your data expires quickly, your architecture should too.&lt;br&gt;
Happy to answer questions or discuss real-time data tradeoffs.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>python</category>
      <category>devops</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
