Stock markets: US shares rise after wild swings