How to Design Real-Time Market Data Subscription and Data Caching Mechanisms for Stock APIs?

When developing a stock market data application, many developers initially focus on how to obtain real-time prices through an API. However, as the number of sub