input: from typing import List
  
  def max_revenue(prices: List[int]) -> int:
      """ Calculate the maximum revenue that can be obtained from buying and selling
      stock based on the given list of prices. The revenue is calculated by finding the
      maximum sum of consecutive differences between prices.
      
      >>> max_revenue([10, 7, 5, 8, 11, 9])
      6
      """
output:     max_diff = 0
      min_price = prices[0]
      
      for price in prices:
          if price < min_price:
              min_price = price
          else:
              max_diff = max(max_diff, price - min_price)
      
      return max_diff