Skip to content

Commit 748ca65

Browse files
author
Sepehr Bazyar
committed
feat: generate readme markdown with ai
1 parent adb5131 commit 748ca65

File tree

1 file changed

+50
-2
lines changed

1 file changed

+50
-2
lines changed

README.md

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,50 @@
1-
# NYSE
2-
Real-time Trading Notifier
1+
# Real-Time Trading Notification System
2+
3+
Scalable real-time system that sends new deal updates to users who follow one or more company tags/symbols.
4+
5+
### What it does
6+
7+
- Merchants post new deals via API
8+
- Users receive only deals for the tags they follow
9+
- Updates arrive via WebSocket in < 1 second (usually 100–300 ms)
10+
11+
### Core design choices
12+
13+
- **One Redis Pub/Sub channel** ("new_deals")
14+
→ every app server subscribes only once
15+
→ avoids thousands of connections per user
16+
17+
- **Server-side fan-out**
18+
→ app servers receive every deal → filter locally → send only to relevant connected users
19+
→ no per-tag channels, no client-side filtering
20+
21+
- **Per-user batching** (default 100 ms)
22+
→ messages are collected briefly → sent as JSON array
23+
→ fewer packets, better mobile experience, less server overhead
24+
25+
- **In-memory tracking** per app instance
26+
tag → connected WebSockets
27+
WebSocket → subscribed tags
28+
→ very fast, scales horizontally by adding more app servers
29+
30+
### Tech stack (2025–2026 style)
31+
32+
- FastAPI (REST + WebSocket)
33+
- SQLModel (database models)
34+
- PostgreSQL / SQLite (persistent data)
35+
- Redis Pub/Sub (lightweight broadcast)
36+
- asyncio + in-memory dicts (fan-out & batching)
37+
38+
### Why these choices?
39+
40+
- **Redis single channel** → constant low connection count
41+
- **No Kafka / RabbitMQ** → overkill, higher latency & ops cost
42+
- **In-memory fan-out** → fastest possible delivery (no extra network hops)
43+
- **Batching** → huge win for throughput and battery/network efficiency
44+
- **FastAPI + SQLModel** → modern, async, type-safe, easy to maintain
45+
46+
### Quick start
47+
48+
```bash
49+
poetry install
50+
uvicorn src.main:app --reload

0 commit comments

Comments
 (0)