File size: 571 Bytes
24718f4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import pickle
import pandas as pd
# Load the ARIMA model
with open("arima_model.pkl", "rb") as f:
model = pickle.load(f)
def predict_stock(input_data):
"""
input_data: dictionary with structure like {"feature": value}
For ARIMA, usually you just forecast next n steps.
"""
# Example: forecasting next n steps
n_steps = input_data.get("steps", 5)
forecast = model.forecast(steps=n_steps)
return forecast.tolist()
# Example usage
if __name__ == "__main__":
data = {"steps": 10}
print(predict_stock(data))
|