Ejemplo n.º 1
0
def insert():
    share = StringVar
    quantity = IntVar
    share = variable1.get()
    quantity = E1.get()
    amount = round(get_data_of_stocks(share)[2][0], 2)
    invest = round(float(quantity) * float(amount), 2)
    stock = db.Stocks(share, quantity, amount, invest)
    db.insert_stocks(stock)
    message = "Company: {}\nQuantity: {}\nPrice: {}\nInvestment: {}".format(share, quantity, amount, invest)
    tab1_display.insert(INSERT, message)
Ejemplo n.º 2
0
def generate_data(company):
    close, opens, low, high, dates, volume = get_data_of_stocks(company)

    random_close = np.random.randint(low=min(close), high=max(close), size=30)
    random_opens = np.random.randint(low=min(opens), high=max(opens), size=30)
    random_high = np.random.randint(low=min(high), high=max(high), size=30)
    random_low = np.random.randint(low=min(low), high=max(low), size=30)
    random_volume = np.random.randint(low=min(volume),
                                      high=max(volume),
                                      size=30)

    return random_close, random_opens, random_high, random_low, random_volume
Ejemplo n.º 3
0
def buttonClick1():
    close , opens , low , high , dates ,volume = get_data_of_stocks(variable1.get())

    new_dates = []
    new_close = []

    for i in range(0, len(close), 15):
        new_dates.append(dates[i])
        new_close.append(close[i])
    
    plt.plot(new_dates,new_close)
    plt.xlabel("Dates($)")
    plt.ylabel("Closing Price($)")
    plt.title(variable1.get())
    plt.show()
Ejemplo n.º 4
0
def predict_data(company):
    close, opens, low, high, dates, volume = get_data_of_stocks(company)

    X, Y = convert_to_dataFrame(opens, high, low, close, volume)

    reg = LinearRegression()
    reg = reg.fit(X[['opens', 'high', 'low', 'volume']], Y['close'])

    random_close, random_opens, random_high, random_low, random_volume = generate_data(
        company)
    test_x, test_y = convert_to_dataFrame(random_opens, random_high,
                                          random_low, random_close,
                                          random_volume)

    predict = reg.predict(test_x[['opens', 'high', 'low', 'volume']])

    return predict