title: How to predict stock price for the next day with Python?
body: <p>I'm trying to predict the stock price for the next day of my serie, but I don't know how to "query" my model. Here is my code in Python:</p>
  
  <pre><code># Define my period
  d1 = datetime.datetime(2016,1,1)
  d2 = datetime.datetime(2016,7,1)
  
  # Get the data
  df = web.DataReader("GOOG", 'yahoo', d1, d2)
  # Calculate some indicators
  df['20d_ma'] = pandas.rolling_mean(df['Adj Close'], window=20)
  df['50d_ma'] = pandas.rolling_mean(df['Adj Close'], window=50)
  
  # Create the model
  from sklearn.linear_model import LinearRegression
  from sklearn.cross_validation import train_test_split
  
  X = df[list(df.columns)[6:]] # Adj Close and indicators...
  y = df['Adj Close']
  
  X_train, X_test, y_train, y_test = train_test_split(X, y)
  
  model = LinearRegression()
  model.fit(X_train,y_train)
  </code></pre>
  
  <p>Ok, what I need is to query the model ( model.predict(..¿?..) ) to predict the stock price for the 'next' day.</p>
  
  <p>How can I do it?</p>
  
  <p>Thank's in advance!!!</p>