def validate_input parameters
				unless parameters.is_a?(Hash)
					raise StockException, 'Given parameters have to be a hash.'
				end

				# Check if stock symbol is specified.
				unless parameters.has_key?(:symbol)
					raise StockException, 'No stock symbol specified.'
				end
				# Check if stock symbol is a string.
				unless parameters[:symbol].is_a?(String)
					raise StockException, 'Stock symbol must be a string.'
				end

				# Use today date if :end_date is not specified.
				unless parameters.has_key?(:end_date)
					parameters[:end_date] = Date.today.strftime("%Y-%m-%d")
				end

				unless parameters.has_key?(:start_date)
					raise StockException, 'Start date must be specified.'
				end
	 			
				unless DATE_REGEX.match(parameters[:start_date])
					raise StockException, 'Invalid start date specified. Format YYYY-MM-DD.'
				end

				unless DATE_REGEX.match(parameters[:end_date])
					raise StockException, 'Invalid end date specified. Format YYYY-MM-DD.'
				end

				unless parameters[:start_date].to_date < parameters[:end_date].to_date
					raise StockException, 'End date must be greater than the start date.'
				end

				unless parameters[:start_date].to_date < Date.today
					raise StockException, 'Start date must not be in the future.'
				end

				# Set to default :type if key isn't specified.
				parameters[:type] = :daily if !parameters.has_key?(:type)

				unless TYPE_CODES_ARRAY.has_key?(parameters[:type])
					raise StockException, 'Invalid type specified.'
				end
			end
def validate_input parameters
				unless parameters.is_a?(Hash)
					raise StockException, 'Given parameters have to be a hash.'
				end

				# Check if stock symbol is specified.
				unless parameters.has_key?(:symbol)
					raise StockException, 'No stock symbol specified.'
				end
				# Check if stock symbol is a string.
				unless parameters[:symbol].is_a?(String)
					raise StockException, 'Stock symbol must be a string.'
				end

				# Use today date if :end_date is not specified.
				unless parameters.has_key?(:end_date)
					parameters[:end_date] = Date.today.strftime("%Y-%m-%d")
				end

				unless parameters.has_key?(:start_date)
					raise StockException, 'Start date must be specified.'
				end
	 			
				unless DATE_REGEX.match(parameters[:start_date])
					raise StockException, 'Invalid start date specified. Format YYYY-MM-DD.'
				end

				unless DATE_REGEX.match(parameters[:end_date])
					raise StockException, 'Invalid end date specified. Format YYYY-MM-DD.'
				end

				unless parameters[:start_date].to_date < parameters[:end_date].to_date
					raise StockException, 'End date must be greater than the start date.'
				end

				unless parameters[:start_date].to_date < Date.today
					raise StockException, 'Start date must not be in the future.'
				end

				# Set to default :type if key isn't specified.
				parameters[:type] = :daily if !parameters.has_key?(:type)

				unless TYPE_CODES_ARRAY.has_key?(parameters[:type])
					raise StockException, 'Invalid type specified.'
				end
			end
Input parameters validation