Skip to content

Conversation

@Mihir8829
Copy link
Collaborator

Added the sell -> check stock to the function, adjusted the arguments according to client input for both buy and sell and string should be able to pass spaces instead of commas!

#we will need the stock price in the sell function as well because it updates the balance in the database. check lines 122-124 in server.py

…k_id = ?"

    cursor.execute(query, (user_id, stock_id))
    result = cursor.fetchone()
    if result is None:
        print("User does not hold the stock with ticker '{}'".format(ticker))
        returnquery = "SELECT quantity FROM user_stocks WHERE user_id = ? AND stock_id = ?"
    cursor.execute(query, (user_id, stock_id))
    result = cursor.fetchone()
    if result is None:
        print("User does not hold the stock with ticker '{}'".format(ticker))
        returnquery = "SELECT quantity FROM user_stocks WHERE user_id = ? AND stock_id = ?"
    cursor.execute(query, (user_id, stock_id))
    result = cursor.fetchone()
    if result is None:
        print("User does not hold the stock with ticker '{}'".format(ticker))
        returnquery = "SELECT quantity FROM user_stocks WHERE user_id = ? AND stock_id = ?"
    cursor.execute(query, (user_id, stock_id))
    result = cursor.fetchone()
    if result is None:
        print("User does not hold the stock with ticker '{}'".format(ticker))
        returnquery = "SELECT quantity FROM user_stocks WHERE user_id = ? AND stock_id = ?"
    cursor.execute(query, (user_id, stock_id))
    result = cursor.fetchone()
    if result is None:
        print("User does not hold the stock with ticker '{}'".format(ticker))
        returnquery = "SELECT quantity FROM user_stocks WHERE user_id = ? AND stock_id = ?"
    cursor.execute(query, (user_id, stock_id))
    result = cursor.fetchone()
    if result is None:
        print("User does not hold the stock with ticker '{}'".format(ticker))
        return
updated the buy sell functions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant