What is the best practice to get the historical prices and volumes in OnData() function?
I'd like to get the following data in OnData() to compare.

 

  • current price and volume of spy
  • 1 day ago high and low prices of spy
  •  2 days ago high and low prices of spy
  •  1 days ago volume of spy