On long term portfolio optimality via large deviations