US stocks rose on Wednesday as investors adopted a cautiously optimistic view that the US-Iran war might soon come to a close amid efforts by Washington to negotiate terms of a ceasefire.