Exemplo n.º 1
0
def getPrediction2(stock_name):
    stock_data = getStockData(stock_name)

    if not stock_data[0]:
        print("Sorry, the stock you requested is not in our database.")
        print("Please enter another stock.")
        return []
    roc = mm.getRateOfChange(stock_data)  # array
    if not roc:
        roc = [0]
    stoch_os = mm.getStochasticOscillator(stock_data)  # array
    asi = mm.getASI(stock_data)  # array
    curPrice = mm.getCurPrice(stock_data[4])

    data = []
    for i in stock_data[4]:
        data = [i] + data

    arima_prediction = mm.getARIMA(data)  # double
    fourier_prediction = mm.getFourier(data)

    prediction = mm.aggregatePrediction(roc, stoch_os, asi, curPrice,
                                        arima_prediction, fourier_prediction)

    data.append(prediction[0])
    #graph_data(stock_data[0], data, stock_name)

    return [
        roc[0], stoch_os[0], asi[0], curPrice, arima_prediction,
        fourier_prediction[0], prediction[0], prediction[1], stock_name
    ]
Exemplo n.º 2
0
def getOutputtedPrediction(stock_name):
    stock_data = techController.getStockData(stock_name)
    num_predictions = 36 # HAS TO be at most as much as num_predictions in Fourier Model

    lastCloses = []
    for i in range(num_predictions):
        stock_data[0].pop(0)
        stock_data[1].pop(0)
        lastCloses.append(stock_data[4].pop(0))
        currentClose = stock_data[4][0]
        stock_data[2].pop(0)
        stock_data[3].pop(0)

    roc = mm.getRateOfChange(stock_data)  # array
    stoch_os = mm.getStochasticOscillator(stock_data)  # array
    asi = mm.getASI(stock_data)  # array
    data = []
    for i in stock_data[4]:
        data = [i] + data

    arima_prediction = mm.getARIMA(data)  # double
    fourier_predictions = mm.getFourier(data)

    prediction = mm.aggregatePrediction( roc, stoch_os, asi,currentClose, arima_prediction, fourier_predictions)
    print(prediction)
    
    return [prediction[0], prediction[1], arima_prediction, fourier_predictions,lastCloses]
Exemplo n.º 3
0
def getPrediction(stock_name):
    stock_data = getStockData(stock_name)    
    roc = mm.getRateOfChange(stock_data) #array
    stoch_os = mm.getStochasticOscillator(stock_data) #array
    asi = mm.getASI(stock_data) #array
    
    data = []
    for i in stock_data[4]:
        data = [i] + data
        
    arima_prediction = mm.getARIMA(data) #double
    fourier_prediction = mm.getFourier(data)
    
    prediction = mm.aggregatePrediction(roc, stoch_os, asi, arima_prediction, fourier_prediction)
        
    data.append(prediction)
    graph_data(stock_data[0], data, stock_name)
    return
def getOutputtedPrediction(stock_name):
    stock_data = techController.getStockData(stock_name)

    lastTime = stock_data[0].pop()
    lastOpen = stock_data[1].pop()
    lastClose = stock_data[4].pop()
    lastHigh = stock_data[2].pop()
    lastLow = stock_data[3].pop()

    roc = mm.getRateOfChange(stock_data)  # array
    stoch_os = mm.getStochasticOscillator(stock_data)  # array
    asi = mm.getASI(stock_data)  # array
    arima_prediction = mm.getARIMA(stock_data[4])  # double
    fourier_prediction = mm.getFourier(stock_data[4])[0]

    prediction = mm.aggregatePrediction(roc, stoch_os, asi, arima_prediction,
                                        fourier_prediction)
    return [prediction, arima_prediction, fourier_prediction, lastClose]