moving cache creationg into its own function
was having trouble with NaNs from missing closing prices