A New open economy macroeconomic model with endogenous portfolio diversification and firms entry