Trade system emulation using FSM in OTP