Completed trading FSM and test code
Fix idle_wait function arg pattern match