This paper aims to design a quadratic optimization model of an investment portfolio based on value-at-risk (VaR) by entering risk-free assets and company liabilities. The designed model develops Markowitz’s investment portfolio optimization model with risk aversion. Model development was carried out using vector and matrix equations. The entry of risk-free assets and liabilities is essential. Risk-free assets reduce the loss risk, while liabilities accommodate a fundamental analysis of the company’s condition. The model can be applied in various sectors of capital markets worldwide. This study applied the model to Indonesia’s mining and energy sector. The application results show that risk aversion negatively correlates with the mean and VaR of the return of investment portfolios. Assuming that risk aversion is in the 5.1% to 8.2% interval, the maximum mean and VaR obtained for the next month are 0.0103316 and 0.0138270, respectively, while the minimum mean and VaR are 0.0102964 and 0.0137975, respectively. The finding of this study is that the vector equation for investment portfolio weights is obtained, which can facilitate calculating investment portfolio weight optimization. This study is expected to help investors control the quality of appropriate investment, especially in some stocks in Indonesia’s mining and energy sector.