trading logic