BossKey-Stock Puts Live Market Data in Your Terminal, Then Disguises It as a Docker Build
The tool solves a specific social-signaling problem that many developers recognize but few tools address: terminal-native workflows make window-switching conspicuous, and a boss key that renders plausible build output eliminates the ambient judgment of a screen full of red and green numbers. The `termios` + `select` pattern for single-threaded, non-blocking keyboard input alongside Rich's Live display is reusable for any terminal app that needs both real-time updates and instant key responses without pulling in curses.
BossKey-Stock is a Python terminal tool that fetches live Chinese stock data from Sina Finance's free, no-key HTTP endpoint and renders it in a Rich Live table. Pressing `b` instantly replaces the price table with a fake Docker build log — complete with step numbers, occasional warnings, and a running timer — so anyone glancing at the screen sees a routine build, not a portfolio. The whole thing runs in a single thread using `termios` for raw keyboard input and `select` for non-blocking reads, avoiding conflicts with Rich's alternate-screen rendering.
The data layer handles Shanghai/Shenzhen code prefixes, converts share counts to lot-based display units, detects trading hours to skip idle polling, and preserves the last successful fetch when the network drops. Configuration lives in a TOML file, and installation is a single `pip install` away. The 500-line codebase splits cleanly into CLI, main loop, data fetching, boss-mode rendering, and config modules.
Underneath the technical choices is a sharper observation: the social friction of checking stocks at work isn't about the act itself, but about the public signal it sends. A terminal-native tool with a boss key removes that signal without changing the behavior.
The core problem isn't technical — it's that switching to a stock app in an open-plan office broadcasts a negative social signal, and a terminal-native tool with a plausible disguise removes that signal without changing the underlying behavior.
Rich's Live component and curses both want control of the terminal, but the `termios` approach sidesteps the conflict entirely by only reconfiguring the input side, leaving Rich's output rendering untouched.
A single-threaded loop with `select` and a sub-second timeout is often a simpler, more debuggable alternative to threading or asyncio for terminal apps that need both real-time UI updates and instant keyboard response.
The boss-key concept — disguising one application as another — is decades old (DOS games faking Lotus 1-2-3), but applying it to a terminal stock ticker with a Docker build log is a clever modern remix that exploits the ambient plausibility of build output in a dev workspace.
Haha this is brilliant, the need to 'press the b key to pretend you're compiling' is practically a hard requirement 😂 I used to sneak peeks at the market in my browser too, but switching windows was way too obvious. After my boss caught me twice, I learned my lesson. Your approach of using termios + select for non-blocking monitoring is clever, much lighter than curses, and Rich's table rendering really does look good. I've also stepped on that GBK decoding pitfall; Sina's API returns data with inconsistent encoding. A small suggestion: if you want to support Hong Kong or US stocks later, you could try akshare as a data source. Its API stability is better than Sina's, and you wouldn't have to handle encoding issues yourself. Also, the choice of TOML for configuration is great, much more readable than JSON and it supports comments. Starred, looking forward to a custom stock grouping feature later~
Haha, same feeling. Just added a position cost/profit feature, and more features will be added later [grin]
I also considered using akshare, but I haven't seen stability issues with Sina yet. Supporting multiple data source rotations could be an option later~