In this paper, we consider the problem of optimal investment by an insurer. The insurer invests in a market consisting of a bank account and m risky assets. The mean returns and volatilities of the risky assets depend nonlinearly on economic factors that are formulated as the solutions of general stochastic differential equations. The wealth of the insurer is described by a Cramér-Lundberg process, and the insurer preferences are exponential. Adapting a dynamic programming approach, we derive Hamilton-Jacobi-Bellman (HJB) equation. And, we prove the unique solvability of HJB equation. In addition, the optimal strategy is also obtained using the coupled forward and backward stochastic differential equations (FBSDEs). Finally, proving the verification theorem, we construct the optimal strategy.2000 Mathematics Subject Classification. 93E20, 60H30, 91B28, 91B30, 49L20, 90C40, 60J70, 62P05.