The Nasdaq Composite and S&P 500 rose on Tuesday due to strong gains from Palantir as market focused on latest trade news.