input: Write a python function to perform linear regression on stock data and determine the trend of the stock.
  assert stock_trend('StockData.csv') == 1 or stock_trend('StockData.csv') == -1
output: import pandas as pd
  from sklearn.linear_model import LinearRegression
  
  def stock_trend(file_path):
      # Load the stock data from the CSV file
      data = pd.read_csv(file_path)
      
      # Assuming the CSV has columns 'Date' and 'Close'
      # Convert the 'Date' column to datetime
      data['Date'] = pd.to_datetime(data['Date'])
      
      # Sort the data by date
      data = data.sort_values('Date')
      
      # Extract the necessary columns
      X = data.index.values.reshape(-1, 1)  # Dates as the feature
      y = data['Close'].values  # Closing prices as the target
      
      # Create and fit the linear regression model
      model = LinearRegression()
      model.fit(X, y)
      
      # Get the slope of the regression line
      slope = model.coef_[0]
      
      # Determine the trend based on the slope
      if slope > 0:
          return 1  # Upward trend
      else:
          return -1  # Downward trend