input: Write a function to compute the moving average of time-series data points. The function should take a list of data points and an integer window size as input, and return a list of moving averages for each data point. The moving average for a data point is calculated by taking the average of the data points within the specified window size. If the window size exceeds the number of available data points, it should take the average of all available data points up to that point.
  
  def moving_average(data_points, window):
      moving_averages = []
      for index in range(len(data_points)):
          start = 0 if index - window + 1 < 0 else index - window + 1
          window_data = data_points[start:index + 1]
          average = sum(window_data) / len(window_data)
          moving_averages.append(average)
      
      return moving_averages
  
  window = 3
  time_series = [3, 5, 7, 2, 8, 10, 11, 65, 72, 81, 99, 100, 150]
  assert moving_average(time_series, window) == [3.0, 4.0, 5.0, 4.333333333333333, 5.666666666666667, 6.666666666666667, 9.666666666666666, 28.666666666666668, 49.0, 72.66666666666667, 84.33333333333333, 93.33333333333333, 116.33333333333333]
  assert moving_average([], 3) == []
  assert moving_average([1], 1) == [1.0]
  assert moving_average([1, 2, 3], 5) == [1.0, 1.5, 2.0]
output: def moving_average(data_points, window):
      moving_averages = []
      for index in range(len(data_points)):
          start = 0 if index - window + 1 < 0 else index - window + 1
          window_data = data_points[start:index + 1]
          average = sum(window_data) / len(window_data)
          moving_averages.append(average)
      
      return moving_averages