The authors propose the algorithm for determining the balances on credit line that maximize the current cost of equity capital of an oligopoly company through investment in research. This article is based on the Cournot oligopoly model described in the work by (Vasin, Morozov, 2005). In contrast to the Cournot model, where the static case is investigated, in this article the dynamic extension of the investment model proposed in the work by (Perevozchikov, Lesik, 2014) is studied. This model is a generalization of the classic production problem for a dynamic case and allows to take into account the limitations on limiting leverage, defining an acceptable level of financial sustainability of the company, to formulate sufficient conditions for the company's sustainable growth regime and estimate rates of growth (Perevozchikov, Lesik, Karimov, 2016). The work’s main result is obtaining an explicit expression for the profit of oligopoly in the Cournot model, as a function of the volume of investment in research aimed at reducing the unit cost, from which follows the piecewise differentiability of the criterion in the constructed dynamic expansion of the model. This allows us to apply the projection method of a stochastic gradient with the averaging from the work by (Zavriev, Perevozchikov, 1991) to the obtained problem of discrete optimal control.