We propose a dynamic stochastic accumulation model for determining optimal decision between stock and bond investments during accumulation of pension savings. Stock prices are assumed to be driven by the geometric Brownian motion. Interest rates are modeled by means of the Cox-Ingersoll-Ross model. The optimal decision as a solution to the corresponding dynamic stochastic program is a function of the duration of saving, the level of savings and the short rate. Qualitative and quantitative properties of the optimal solution are analyzed. The model is tested on the funded pillar of the Slovak pension system. The results are calculated for various risk preferences of a saver.