Questions tagged [sell]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
102 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
0answers
103 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
2answers
61 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
1answer
158 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
1answer
86 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
1answer
241 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
1answer
35 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
1answer
105 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
1answer
103 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
1answer
129 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
1answer
407 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
2answers
136 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
1answer
314 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
1answer
1k 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
1answer
251 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
1answer
451 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
1answer
91 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
0answers
273 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
1answer
367 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
1answer
364 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
1answer
56 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
1answer
241 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
1answer
418 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
0answers
88 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
1answer
168 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
1answer
58 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
1answer
38 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
1answer
64 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
1answer
62 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
1answer
43 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
1answer
46 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
1answer
186 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
1answer
152 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
1answer
76 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
1answer
57 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
1answer
194 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
0answers
98 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
1answer
106 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
1answer
63 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
1answer
107 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
1answer
55 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
1answer
383 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/...
0
votes
1answer
314 views

pset7 sell.php doesn't sell stocks or change cash

I'm done with pset7 but my sell.php never updates the portfolio table when I sell stocks. it only displays the drop-down menu correctly where it shows the stocks bought in the list, but when i choose ...
0
votes
1answer
114 views

a problem with queries in sell.php

My problem is that whatever symbol I write in sell_form.php even if it doesn't exist in portfolio table, the query retursn true. Here's the query in sell.php and that's sell_form.php <form ...
0
votes
0answers
101 views

pset7, Database updates, but not reflected on screen

Update I found out that $cash is only holding a value of 1, when the database has a value of 10,942.54. the number format i was using in portfolio.php was stretching the 1 to 10,000. Any idea why the ...
0
votes
2answers
101 views

pset7: displaying apology for messups

So I'll start easy with quote.php. It works if I give the correct symbol, and correctly apologizes if i leave the form blank. But any invalid symbols seems to allow for render to work on quote_display....
0
votes
2answers
266 views

How to create a dropbox menu in pset7 sell_form.php?

I'm currently struggling with the sell form of pset7. I want to create a dropbox menu with displays the stocks a users owns and is able to sell. I have a controller called sell.php and a template ...
1
vote
2answers
94 views

Array in php vs R (pset7 sell.php)

Ok, I'm at pset7 (C$50 Finance), more specifically trying to implement sell.php. I have created a template, sell_form.php, where users can select the symbol of the stock they want to sell and ...
2
votes
1answer
73 views

Pset7 How to Program Popup?

I'm trying to create a popup after a user successfully sells a stock. I want it to look like Chrome's confirm form resubmission popup I'm pretty sure I need javascript, html, and css, but I'm not ...
2
votes
1answer
313 views

Cannot get drop down menu to display for pset7. Why would this be?

I have set up a template form that sends the symbol selected by the user to the controller. I cannot get the form to show when I request the page. Here is my code for the form: <form action="...