I've created a rough stock rotation algorithm but it doesn't seem to purchase the stock. Is there anything wrong with it? I really appreciate any help. 

Author