In this article, an optimal reinsurance problem is formulated from the perspective of an insurer, with the objective of minimizing the risk-adjusted value of its liability where the valuation is carried out by a cost-of-capital approach and the capital at risk is calculated by either the value-at-risk (VaR) or conditional value-at-risk (CVaR). In our reinsurance arrangement, we also assume that both insurer and reinsurer are obligated to pay more for a larger realization of loss as a way of reducing ex post moral hazard. A key contribution of this article is to expand the research on optimal reinsurance by deriving explicit optimal reinsurance solutions under an economic premium principle. It is a rather general class of premium principles that includes many weighted premium principles as special cases. The advantage of adopting such a premium principle is that the resulting reinsurance premium depends not only on the risk ceded but also on a market economic factor that reflects the market environment or the risk the reinsurer is facing. This feature appears to be more consistent with the reinsurance market. We show that the optimal reinsurance policies are piecewise linear under both VaR and CVaR risk measures. While the structures of optimal reinsurance solutions are the same for both risk measures, we also formally show that there are some significant differences, particularly on the managing tail risk. Because of the integration of the market factor (via the reinsurance pricing) into the optimal reinsurance model, some new insights on the optimal reinsurance design could be gleaned, which would otherwise be impossible for many of the existing models. For example, the market factor has a nontrivial effect on the optimal reinsurance, which is greatly influenced by the changes of the joint distribution of the market factor and the loss. Finally, under an additional assumption that the market factor and the loss have a copula with quadratic sections, we demonstrate that the optimal reinsurance policies admit relatively simple forms to foster the applicability of our theoretical results, and a numerical example is presented to further highlight our results.