first trading algorithm but takes about 50 hours to complete, must be refactored