Investment allocation algorithm