The formation of supply chains for raw materials is closely related to production problems involving the determination of prices for sold goods. The question often arises about the need to study the sources of raw materials and the methodology for pricing the goods produced, taking into account a large number of external aspects of the market. Often, only particular approaches to solving production problems are considered in the literature, and methods for solving the complex problem of forming supply chains for raw materials and pricing are poorly developed. This paper presents a mathematical model that makes it possible to assess the feasibility of interaction between a timber industry enterprise and a commodity exchange, with the daily formation of a price vector over the entire planning horizon. A two-stage algorithm for finding a suboptimal solution is considered, which at the first stage is based on linear optimization, and at the second, on gradient descent with the use of penalty functions. The model was tested on the data of the commodity and raw materials exchange of Russia and one of the enterprises of the Primorsky Territory. The result of testing was the volume of production of each type of product over the entire planning horizon, the volume of delivery of raw materials from regions to enterprises, as well as the methods of delivery of goods to the consumer and the policy of pricing. It is shown that almost all goods should increase in price due to a reduction in the excess volume of applications (demand) over the entire planning horizon, with the exception of two types of products. It is noted that the exchange can provide the necessary volume of raw materials for high-capacity production, which demonstrates the possibility, if necessary, to increase the volume of raw materials purchases. It is shown which goods will be included in the release plan more often than others when optimizing the price vector. The ways of delivery of final types of products are analyzed. The disadvantages and advantages of the mathematical model and algorithm are presented.