Real time bidding (RTB) is emerged with the rapid development and integration of Internet and big data, and it has become the most important business model for online computational advertising. In RTB-based advertising markets, Demand Side Platforms (DSPs) aim to help the advertisers buy ad impressions matched with their target audiences. Due to the existence of discount rate, the advertising effect may be diminished when displaying the advertisements multiple times to the same target audience. As such, frequency capping is widely considered as a crucial issue faced by most advertisers. In this paper, we mainly consider the frequency capping problems in RTB advertising markets, and establish a two-stage optimization model for advertisers and DSPs. Utilizing the computational experiment approach, we design two experiments to validate our model. The experimental results show that under different discount rates, the optimal frequency caps are different. Moreover, when considering all the discount rates, there exists an optimal frequency cap, at which the expected maximum revenue can be obtained in the long run.