Questions tagged [sell]
The sell tag has no usage guidance.
68 questions
0
votes
0
answers
29
views
wht is wrong with my buy function and sell function
it keeps showing
:( buy handles valid purchase
expected to find "112.00" in page, but it wasn't found
@app.route("/buy", methods=["GET", "POST"])
@...
0
votes
1
answer
88
views
pset 9 finance :( sell page has all required elements
i searched around for this type of error and looked at my code, but was not able to figure it out. I had something very similar when debugging the buy function and used a similar process for the sell ...
0
votes
1
answer
24
views
can't seem to figure out the problem with the sell route code
can't seem to figure out the problem with the sell route code that check50 indicates
this is my sell route code:
@app.route("/sell", methods=["GET", "POST"])
@...
0
votes
1
answer
646
views
PSET 9 Finance checking that "56.00" is in page
I've been trying to solve this issue for hours and every time I run the code I get the error:
****:( sell handles valid sale
Cause
expected to find "56.00" in page, but it wasn't found
Log
...
0
votes
1
answer
97
views
FINANCE SELL : DROPDOWN MENU not showing any option DESPITE having look for solutions
This is my first time posting on reddit asking for help : I've been so far going through cs50 on ressources online when I got stuck, but here I can't figure it out even tho with the numerous online ...
0
votes
1
answer
190
views
Cs50 Finance :(sell handle valid sales :values appearing in index table but check50 doesnt recognise it
updated the code to display history properly,ie when sold shows negative,and when bought shows positive
updated index to remove entire row when stocks is 0
I cant figure out why check 50 is not ...
0
votes
1
answer
59
views
Buy/Sell on Index - button attributes & form value issues
I've got a couple issues adding my own buy/sell buttons to the index page.
First, each "Buy" or "Sell" buttons opens up the form for all of the table rows. How can I modify these ...
0
votes
0
answers
291
views
Is there a bug in check50 cs50/problems/2021/x/finance?
I completed problem set 9 and works as supposed, but with check50 I get the following result:
:( sell handles valid sale expected to find "56.00" in page, but it wasn't found
For testing ...
0
votes
1
answer
578
views
Finance PROBLEM with lookup: TypeError: quote_from_bytes() expected bytes
I have Finance barely ready but like most codes, it has a buggy near the finish line.
I have a problem with lookup. Always return None. I check it.
and Terminal shows this error:
TypeError: ...
0
votes
0
answers
234
views
Pset8 Finance - Sell - Fails to update user's cash in "users" table, and fails to insert sold shares into "portfolio" table
Big picture: On the sell page of the CS50 Finance, I select the shares symbol I want to sell, and enter the number of shares, and click the Sell button, which redirects me to the homepage, but the ...
-1
votes
2
answers
88
views
finance how to compare requested shares to shares owned
I'm having trouble trying to figure out how to write the sql statement to receive the amount of shares owned so I can compare it to the number requested, and if owned - requested < 0, don't let ...
0
votes
1
answer
510
views
pset 8 finance: :( sell handles valid sale
:)
Struggle with the last check. Get this error message:
expected to find "56.00" in page, but it wasn't found
Tried the same approach like I used for the buy-function. Create an extra template to ...
0
votes
1
answer
106
views
pset8 finance: Problem with calculaton for "/sell"
I'm implementing the "sell" function and have a problem with the calculation of the new value for "share" and "cash".
Here is my code:
@app.route("/sell", methods=["GET", "POST"])
@login_required
...
0
votes
1
answer
390
views
PSET7 Finance- Quote and Buy not passing all checks
I've just come back to CS50 after the semester ended and have been trying to debug my program to no avail. The application appears to be working when I test it myself, passes all checks, but has ...
0
votes
1
answer
41
views
Pset7 Sell stockprice not a bound parameter
I'm working on sell, and I ran into trouble in one of my db.execute statements. For whatever reason, in the previous line, it was perfectly fine using stock["price"] but in my second db.execute, it ...
0
votes
1
answer
186
views
Pset7 :( sell handles valid sale
I try to UPDATE cash but I get an error I don’t understand why. Used this syntax in buy and it works fine but now
File "/home/ubuntu/workspace/pset7/finance/application.py", line 243, in sell
...
0
votes
1
answer
157
views
after using style50 and correcting my spaces etc I ran my code again and got this error which makes no sense to me. need some help please?
def buy():
"""Buy shares of stock"""
if request.method == "GET":
return render_template("buy.html")
else:
info = lookup(request.form.get("symbol"))
if not info:
return apology("...
0
votes
1
answer
201
views
problem , yet again in pset7 . my sell page works fine but check50 shows me something else O.o
def sell():
"""Sell shares of stock"""
# method check
if request.method == "GET":
return render_template("sell.html")
else:
# valid name
info = lookup(request.form.get("symbol"))
if ...
1
vote
1
answer
1k
views
CS50 PSET7 Finance: in SELL; expected to find select field with name "symbol", but none found
My CS50 finance app passes all check50 tests except just one in the SELL component. I just can't find the error and need thoughts/ideas / tried a lot ( read: a-lot). My code was created in 2017 and ...
0
votes
2
answers
151
views
pset 7 sell Type Error 'NoneType' object
I am working on sell and I am getting an error: "TypeError: 'NoneType' object is not subscriptable" on the variable "price". I am not sure why as this is more or less the exact same code I have in buy ...
0
votes
1
answer
384
views
sell.html Dropdown Menu Problem
So, as the title says I can't figure out what I'm doing wrong to give the user a drop-down menu which contains the symbols of his/her stocks.
Thank you for your time in advance!
My intention is:
-...
0
votes
1
answer
2k
views
CS50 finance: Sell function.(Dropdown list of user shares NOT displayed via sell.html)
Purpose of Sell: to make sure the shares bought can be sold by selecting it through a dropdown list displaying symbols of share bought. I am trying to replicate the cs50 finance default page.
I have ...
0
votes
1
answer
309
views
pset7 sell: can not make drop down menu work
i can not get why drop down menu does not work. It seems that the list is empty, but when I check it in another program, it contains information as expected. I just don't get why the dorpdown list is ...
0
votes
1
answer
513
views
Pset7 Finance, Sell problem with POST requests
My problem is that I'm not getting any value back from my select form. I pass a list of stocks to the jinja template via return render_template("sell.html", stocks=stocks) and on the sell.html page I ...
0
votes
1
answer
94
views
Buy and Sell Function not working correctly
Okay I have been working for very long on pset7 but my buy function seemed to be working correctly however when I try to buy the same stock a second time it doesn't get updated in the portfolio table ...
0
votes
0
answers
350
views
pset7 buy/sell shares via index
As last task to do for pset7, "personal touch", I'd like to empower the user to buy and sell shares via index without having to type the stock symbol.
From here I found interesting to create a form ...
0
votes
1
answer
410
views
PSET7/C$50Finance/buy
I have created two tables in my database named : portfolio and user_data. portfolio has fields as: user_id, Symbol, Name, Shares, Price, Total, Datetime all of them "NOT UNIQUE" so as to let the user ...
0
votes
1
answer
443
views
PSET7/C$50Finance/sell
My portfolio table has fields user_id,Name,Symbol,Shares,Price,Total,Datetime showing who bought what at what price & when aka a record of all users buying their stocks. Now, if there is a user ...
0
votes
1
answer
60
views
Rum time error with SQL statement in sell() when try to get total of shares from finance.db
Here is the error SQL statement:
RuntimeError: (sqlite3.OperationalError) near ",": syntax error [SQL: "SELECT stock, SUM(shares) AS shares FROM 'transaction' WHERE userid = 3, stock = 'FB'"]
I'm ...
0
votes
1
answer
327
views
Pset7 sell - list out of range
So I am having trouble implementing the if function to test whether the number of shares the user is requesting to sell is less than the number of shares they have for that stock. Here's what I have ...
0
votes
1
answer
531
views
Jinja2 + Python error "TypeError: non-empty format string passed to object.__format__"
I tried to implement sell, but there's a problem in the index template that came up when the website tried to redirect from sell.html to index.html after the sail of stocks was done.
For reference, ...
0
votes
0
answers
90
views
Undefined index problem in Pset7 Sell
I have a problem as in here: pset7 sell controller issue: undefined index.
I made a new thread because that one's a year old. I hope this one won't get marked as a duplicate and get closed for it.
...
0
votes
1
answer
209
views
sell in pset7 - delete and update query bug
I hope I can get some help here (and hopefully this isn't too much of a duplicate of another thread). I've got some code here that I want to have checked to see why this weird thing is happening and ...
0
votes
1
answer
62
views
weird fatal error in sell
I am trying to update my history table using the below query:
// update history table
CS50::query("INSERT INTO history (user_id,sold,sold_number,selling_price,date) VALUES(?,?,?,?,NOW() )",$_SESSION[...
0
votes
1
answer
47
views
pset7 sell.php I seem to be missing something
I just finished sell.php, but I had to use $cash[0]["cash"], to get cash out
of my query. This dos not feel right. The code works, but I feel it is wrong.
Is there a better way to do this??
<?...
0
votes
1
answer
68
views
Unable to manually insert rows in Portfolio table
Working on sell.php now. Trying out Sell, I naturally find the need to replenish shares of some stock after selling, for testing purposes. When I try to manually insert, like instructions said to do ...
0
votes
1
answer
63
views
Pset7 pass data to drop down bottom
I'm now trying to make the sell button, and have a problem.
I try to do the query from data base just like index.php did.
And then I transfer the $rows results to sell_form.php(where show the button).
...
0
votes
1
answer
51
views
pset7 unsupported operand types
I am wrestling with an "unsupported operand error". According to Stack Overflow the problem is that I am trying to do math with an array but doesn't $ticker[0]["shares"]; refer to a single data point ...
0
votes
1
answer
50
views
sell.php doesn't return error when the stocks doesn't exist in the user's portfolio
<?php
require("../includes/config.php");
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
if (empty($_POST["stock"]))
{
apologize("You must provide the stock you want to sell.");
}
...
0
votes
1
answer
202
views
Pset7 Sell: can't display dropdown menu items
Trying to implement a dropdown menu in sell_form.php so that the user can choose one of the stocks he/she owns and sell it. However, the dropdown menu doesn't seem to be working properly, can someone ...
1
vote
1
answer
162
views
pset7 sell.php Fatal error: You have an error in your SQL syntax
I can't find my mistake for a few hours already, and I keep getting the same error:
Fatal error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version ...
0
votes
1
answer
81
views
I am currently working on sell.php. I have debugged the code several times but I am unable to find the error.?
Sell.php
// if user reached page via GET (as by clicking a link or via redirect)
if ($_SERVER["REQUEST_METHOD"] == "GET")
{
// else render form
$rows = CS50::query("...
0
votes
1
answer
64
views
pset7 sell: MVC problem
I can't seem to connect my sell_index.php (Where I get the symbols in with query) with my view, sell_form.php, because $symbols is empty.
I have sell working if I directly get symbols in sell_form.php,...
0
votes
1
answer
198
views
Pset7 - Issue with updating cash in sell.php
I wrote some code for sell.php in CS50 Finance, but the cash field in the users table does not update accurately. The code for updating this field is towards the bottom.
This is really driving me ...
0
votes
0
answers
102
views
how to save history
i am through with the register and quote but why do i get this error in trying to create history?
Fatal error: Table 'pset7.history' doesn't exist in /home/ubuntu/workspace/pset7/vendor/library50-...
0
votes
1
answer
107
views
Pset7 Sell.php not adding money to users
I have been working on the sell page for Pset 7. I have it so when i sell it removes the proper stock from the portfolios database. But for some reason it is not updating the cash in the users ...
0
votes
1
answer
65
views
pset7 sell.php reloads itself
My sell.php file renders sell_form.php but when I submit some stock symbol I don't get anything but reload of the same file. I can't figure out why. Can someone help me with this?
// Code deleted
...
0
votes
1
answer
109
views
pset7 sell controller issue: undefined index
I have been working at trying to fix an issue I have been having with a variable. I keep getting an error for an undefined index for value on line 49:
// update cash upon selling stock
query("UPDATE ...
0
votes
1
answer
60
views
PSET7 - preg_match and one other issue
I'm right on the cusp of finishing the pset7 after marathoning it today after not having touched CS50 in about a month. I have two final issues that can't seem to be resolved.
The first has to do ...
0
votes
1
answer
386
views
Pset7 undefined index
I'm getting this error in sell.php -
Notice: Undefined index: shares in /home/jharvard/vhosts/pset7/public/sell.php on line 20
My code :-
<?php
// configuration
require("../includes/...