The stock market defied reason as 2023 comes to an end after a year filled with uncertainty including higher interest rates, a banking crisis, and fears of a recession.