Published signals

Lessons from Rewriting a Stock SDK: From 105 Flat Methods to a Modular, Tree-Shakeable API

Score: 7/10 Topic: SDK redesign from monolithic to modular architecture

A developer shares their experience completely rewriting a stock market SDK after 18 iterations. The v2 redesign consolidates a bloated API into namespaces, adds tree-shaking support, and standardizes error handling and symbol normalization. This is a practical example of how to evolve a library from quick-and-dirty to production-grade.

A Chinese developer has published a detailed post-mortem on rewriting a stock market SDK (stock-sdk) from version 1 to version 2. The original v1 had grown organically over 18 releases, accumulating 105 flat getter methods in a single facade class. The v2 redesign completely rethinks the API surface: methods are grouped into namespaces, subpaths support tree-shaking for smaller bundles, data contracts and error types are unified, and symbol normalization is centralized. The rewrite also introduces CLI, MCP, and playground tools. While the post is specific to a financial data SDK, the architectural lessons—avoiding flat API bloat, designing for tree-shaking, and standardizing error handling—are broadly applicable to any developer maintaining a public library. The author emphasizes that the rewrite was driven by real user feedback and the need to support both browser and Node.js environments efficiently. This is a valuable signal for SDK maintainers and API designers looking to modernize their own libraries without breaking existing users.