the code for stock time series class design