Critical UPDATE: The BUY function EXPLICITLY wants a "button" despite the form being in working order, you need to update the code as follows on buy.html (this is a modification only to the last line that turns the from click into a button to satisfy: Buy
The issue with buttons actually now applies to all buttons in Buy, sell and quote. Just use for every button or check50 will turn red (tested in 2024) Crucial here is the type="submit", which the html seems to be tested/scanned for.
:( buy handles valid purchase expected to find "112.00" in page, but it wasn't found I'm having this problem even though I got the right text to appear in a flash message and the button to work.
People having issues with the 2024 version,: there is a note for the index. The lookup function no longer returns a "name". Just delete ( stock["name"] = quote["name"]) from the code and also from the html table. Thanks Devin for all your great tutorials.
I do not understand how it should be now implemented. Can you please help? My previous code was like this: for stock in stocks: quote = lookup(stock["symbol"]) stock["price"] = quote["price"] stock["total"] = stock["price"] * stock["shares"] total_price += stock["total"]
I love how you are replying to every single person who has doubt even after 5 months of posting this video this is really great. I appreciate your efforts. Thank you so much for your work and dedication.
You are a literal godsend... I struggled so much with this problem set, like panic attack level and finding this video stopped me from giving up my entire 6 months journey. I cannot put into words how grateful I am that you chose to upload this video to help the thousands of people who like me struggled. I'm sure you already know from the hundreds of people thanking you that you are appreciated, but truly, thank you! On to final project!!!!!
Yo my whole project is working perfectly fine bruv did it all by myself but when I do check50 im getting an error on the buy page stating "buy handles valid purchase expected to find "112.00" in page, but it wasn't found" do you perhaps have a solution for this bruv???
My pleasure! Thanks so much for the support! I'm so happy I was able to help! Appreciate you sticking with it till you found me an congrats on completing this!
@@josiahking2772 This question is answered in the video 3 times, i put it in the description, and I've answered it on MANY comments - trust me that the answer you're looking for is MUCH simpler than you think but if you read other comments, I promise you'll get there.
I feel you - making this one was..... intense. Not the code (which wasnt fun) but the video - cutting out all the repeats and trying to trim it down. I did my best but MAN was it a big one. Congrats making it to the end!
Helped me out a TONNNNNN!!!!! Didn't officially enroll in cs50 but was using the entire course as a primer for my enrolled Comp Sci courses next month-I think all of this will lay an awesome foundation, and Devin I cannot quite frankly thank you enough for all of this. Smoothed out the major bumps in the road through a lot of the differing projects when I got stuck, and this last project was an absolute beast that would have taken me way WAY longer without your help. THank you so much my man
I'm sorry to be so late to such a nice comment. I can't tell you how much I appreciate you letting me know that I've helped you. I'm glad you're done and hopefully, as I grow this channel, I can continue to contribute to your growth as a coder. Keep up the great work and thanks again!
Late, but was CRYING and having a full on mental breakdown because I couldn't solve this and all the other tutorials took hours but didn't work. Then... A MIRACLE HAPPENED! I found this video and finished the pset in an HOUR and I am crying tears of joy THANK YOU SO MUCH FOR ENDING MY SUFFERING
@@Luci_19 make sure you first cd finance then sqlite3 finance.db then execute your command. Dont forget to get into the sql file first before updating anything in terminal
Submission criterias are so strict that even when the app is working as it should, there's still :( marks. Your work has certainly helped me as it's provided the reference I've needed. By the way, the proper way is to create a stock table and a separately transactions table. At every transaction you add stock AND update transactions accordingly. You return the content of the transaction table to /history table, and that of stock table to the root folder table, accordingly. This allows for purchase of the same stock many times at different values. As I stated above, your work was instrumental to help me move at critical stages. You are appreciated. Thank you.
In the video I mention 3 times that the money isn't formatted. And it's in the description as well. I did this on purpose because I want the user to find and update these things accordingly. This was a very simple task (as you noticed) so I wanted to make sure people could identify this error, and update it on their own.
Oh okay! I get you now. Did not really watch the video, I just went to a section that puzzled me. Now I edited the comment accordingly@@RealisticResponse
Thank you! This was really helpful. It makes a hard an frustrating problem a good learning tool, there is a lot to learn by going through your video and the completed project. Once again thank you and congratulations for being a person that shares knowledge and helps others.
Hi! Helping others is a big deal for me. I'm so grateful for each comment and person out there letting me know I'm helping so thanks so much for the feedback!
Sorry for the delay - been away - but coming back to comments like these make all the difference in the world. I appreciate my subscribers and commenters and supporters more than they know - I'm glad I was able to help you out.
You are an angel and I wish all the best for you and your family. Keep up the great work and helping people, you are an incredible person, congratulations.💟
Thanks man, your video helps a lot, I just saw the code to clarify some things, borrow ideas and do things that I was doing in 3 or more lines, just to review the logic to do it in one. This is for real a tough one as you said, but it's Cs50, we all know how difficult this course is. I think that despite making the codes work throughout the course, what bothers me most was making the code pass the test, I know that some tests are very useful, but in other cases the lines simply work but the tests go wrong, and you don't even knows where to look for this error, and in which case it is giving an error, even with the help of the course's AI. Anyway, thanks again.
You're not wrong. I've made a few functional codes myself and they didn't "pass" CS50 algo. But I just kept re-working the code until something happened. Good work getting this far and 'hopefully' completing.
I am so thankful for you. Today i will be submitting my final project and all thanks to you. This journey would have been impossible without your help. This pset was the most toughest but with your help i was able to do it. You're godsend
This one is TOUGH dont feel bad. I see now why there's so few video helps for the whole course but this one especially. Good job making it through. Good luck on your project!
Thank you so much brother I appreciate you and your help, I have been struggling with this problem set until I found your account ✨ I am watching your videos from KSA 🇸🇦
hello friend, I'm sorry for not expressing myself well, I would never diminish your work, on the contrary I am very grateful for your help, without it I would not have been able to finish the course, thank you very much
I didn't think you were being disrespectful. I'm happy to help and will do whatever I can. This small thing was just more than i was or am able without a whole other video. I'm happy to help and happy to see you're completing the course! Thanks so much and dont worry. I'm here to help.
Such a legend for this, i was starting to get demotivated because I wasn't confident in my logic, but using your guide to proof check what I was doing helped alot with that. Your explanations made it so easy for me to understand what i was doing.
Can tell you how much this means to me. I keep getting downhearted since making these. Not all of the feedback is positive and it gets tough trying to help people all over the world. But comments like this definitely keep me motivated. I appreciate you, and congratulations on making it this far!
brother, can you tell me what he meant in 10:50 , how do I add the codes in the sql file? I wrote the codes in a seperate .sql file and kept it inside finance folder , then i went to sqlite3 and now what?
@@omarhoque1662 I wrote a response on your other comment - hopefully it helps. but get into your sql file b entering the command sqlit3.db to enter the existing sql database (recall sql week and manipulation).
There's already an updated video. The changes to CS 50 do not affect the code. the code in this video is correct. Please feel free to watch the short video regarding the update.
Bro, haven't seen you in a couple of months since ps6 I guess. Thank you for making the code scale larger, the content is perceived in a completely different way.
My pleasure. Onnupdated videos when they come you should see improved visual and sound. Also for future courses. I appreciate the feedback and want to make sure these videos are helping . Glad to see you made it back around! Congrats on making it to the end.
The course is difficult for true beginners I hope that these helped you understand better. Always good to re look at what you've done. The second time around is super helpful now that you have the know how. This is all about practice and redundancy. Good work!
@@RealisticResponse Yeah, totally agree. I'm on the first month studying computer science and I have to say that it was very difficult to me to understand all the stuff. Your videos helped a lot of people around the world, thanks! Hugs from Brazil!
@@caiomac1 man that's hugely appreciated! Thank you so much! Coding is all about working together. The internet was LITERALLY invented to advance science thanks to Tim Berners Lee. I'm for it and I'm here to help. Great job and keep up the good work!
:( buy page has all required elements Cause expected button to submit form, but none was found Log sending POST request to /login sending GET request to /buy found required "symbol" field found required "shares" field - what is this error even though i have a button for buy
Guys, be careful when creating the files for your templates because if you just go to File - New File, the default option is to create your html files in the Finance folder, and you want them in the Templates folder :D Yes, I was that idiot who didn't pay attention and re-wrote the code 1398203 times for no reason ... :D
Thanks so much for sharing this! It's invaluable information lol we've all been there and sharing our mistakes will always help others avoid them. This is why i love the coding community! Keep up the great work!!!
here are the errors I encounter after running your code : :( buy handles valid purchase expected to find "9,888.00" in page, but it wasn't found :| sell page has all required elements can't check until a frown turns upside down :| sell handles invalid number of shares can't check until a frown turns upside down :| sell handles valid sale can't check until a frown turns upside down
Hey there! So Here's some more hints - First, in the video i mention it about 3 times. Also - in the description there's a hint. This error means that your totals are not in 2 decimal point formats. To fix this you need to look at your app.py and use a function (see description) to make sure that your total's are giving you the results in just 2 decimal places. Also look to other comments here. I've had this question the most. I knew leaving it out would cause this, but i needed to leave some things up to the user. The basics of this go back to week 2 i believe so I'm certain once you see it, it will click. Just get that updated and you'll be good to go!
@patrickfaudap7216 Where you able to solve the error? I have the same error and I've been trying and asking for help but no one has replied to my comment..can you help me please?
@@davidninoaguirrecampis6617 You replied to his comment but didn't read the comment I told him on how to solve it. There are dozens of answers I have here helping people solve this same problem. I recommend reading my replies and that might help you understand.
hello! Great video. Just asking at 5:23 on Line 8 it states "url_for(register" is this the part where we paste the image or is this text necessary? Many thanks! 😁
Hi! The text is necessary. In that line (which we have on all .html files) the program is using html and flask to find and load your 'register' route/view. Its an html FORM that will POST a request to the listed url in the app.py file. Does that help?
Not sure if anyone caught this yet but a critical piece you didn't note in your sell section is the number if shares should be a negative value 17:21 . This is in your code but not mentioned and easily missed. Thanks for the video.
You're a gem. This video was several days of editing. I appreciate the feedback and looking out for others. There was bound to be a thing or two i missed so thank you for helping and supporting others.
so you're going to update it in sql. In your terminal (just like when we did sql) you're going to type: sqlite3 finance.db that will open the sql database and you'll update the tables with that code. Once you're done just exit SQL and get back to the code. Does that help?
@@RealisticResponse I put it in my terminal and got out of it ran flask run and it still isn't working. In my history on the website it isn't listing the transaction type. I have it in my html. and I have it in my updated table but it's still not showing up.
@@jessipresten9042 It wont show up unless you sql it and look for it. you should be able to view it if you .schema what do you mean it's not showing up?? changes to sql dont just show up - they're built into the database so its not something we see unless we pull it up like i do in the video or run .schema or run .tables or something.
I WAS STUCK ON THIS PSET FOR FOREVERRR. THANK YOU SO MUCH FOR THIS QUALITY CONTENT!! only suggestion would be to make a detailed video with deeper explanations if possible! that’s something that would help me soo so much to understand why we write certain code. ALSO, for those of you getting the :( on buy handles valid purchase, make sure to test this only after you have formatted the price to match the criteria (2 d.p.)! A hint for this is that you need to use the format function on your index.html!
Since we're already in August, I'm waiting for the 2025 drop and plan to re-do the WHOLE course with better quality. I've improved my PC, My Mic, My Camera, all of it - hoping to do some better, deeper dives to help more people but THANK YOU for you're early support and comments!!!
I have been on this pset for more than 3 weeks, your code really helped except for one final error in buy. :( buy handles valid purchase exception raised in application: KeyError: 'value' I think this is a problem with the API key but im not sure. If it is a problem with the api key then could someone please tell where you're getting yours. thank you
Hello Mr. Finley, is there any way that you can make a 2024 version? I tried using your code but it did not work. Thank you for your videos, I couldn't have done most of the course without you. Please consider making a 2024 version soon...
:) app.py exists :) application starts up :) register page has all required elements :) registering user succeeds and portfolio page is displayed :) registration with an empty field fails :) registration with password mismatch fails :) registration rejects duplicate username :) login page has all required elements :) logging in as registered user succceeds :) quote page has all required elements :) quote handles invalid ticker symbol :) quote handles blank ticker symbol :) quote handles valid ticker symbol :) buy page has all required elements :) buy handles invalid ticker symbol :) buy handles fractional, negative, and non-numeric shares :) buy handles valid purchase :) sell page has all required elements :) sell handles invalid number of shares :) sell handles valid sale :) history page shows transactions As Of 08:50AM on 27, January 2024 this code still works. although, AS MENTIONED, you need to convert to USD - the only check that has been added is for a $28.00 on history page which, as mentioned in the video, means you have to convert "price" on your history page to 2 decimals. This code till works.
Hey Devin..!! its been over a week I'm working on finance but getting errors in sell function. some are those errors which I can't understand where I screwed up, when I execute check50 it even can't check any function.
Hey there, you're not giving me anything to go off of here. I understand something is broken but you're kind of just telling me nothing is working. I can't really evaluate the depth of the issue. This should have take a while, over a week isn't uncommon - but you should have been testing at every stage and every html extension. if you did this then we can identify the error. or if you have an error message... but telling me nothing works is the same as telling me 'i have no code' - i just dont have anything to imagine where the problem is or could be.
I talk about this 3 times in the video and there's hints in the description and I've answered it dozens of times in the comments Please look to previous comments for help - it's a very simple addition to the code that you need. Please have a look around to see if any of the other previous comments or description help.
@@mario050488 I talk about this 3 times in the video and there's hints in the description and I've answered it dozens of times in the comments Please look to previous comments for help - it's a very simple addition to the code that you need. Please have a look around to see if any of the other previous comments or description help.
Hi Devin, I have all the code and checked that my sql table was updated but I am still having trouble with my buy page. Here is my error :( buy handles valid purchase application raised an exception (see the log for more details). Everything else is working on the site.
this should be in your buy function in app.py - theres something missing telling the program what to do when executing a buy - it has to do with the function that updates the sql to add a share and subtract the cost of it.
Hello, I've been trying to solve the CS50x problem since a month but I am still unable to. The only set left is this one. Is there any correct solution form where I can copy the code and learn from it. I'm really tired now.
Hey there. I don't have a cheat sheet. This video can help you solve the issue. The code and explanation is all there. Don't feel bad if you have to take a break. But i don't have the outline as an answer sheet posted anywhere.
Ok... hear me out.... ORIGINALLY I'm a finance major. So when I was writing the code I intended to use Total Value as the total value of just the stocks; and Grand Total as the value of the stocks AND the cash balance. As you correctly pointed out, in this code, total_value += stock_value grand_total += stock_value They ended up being the same. And this video took so long to make that I wanted to chuck my computer out the window. So I never went back and changed them to the parameters I originally meant to use. So... I knew i'd get called out eventually... but I was in too deep. lol and i left it. But that was the original plan.
hello, thankyou for the video --> im a bit confused about the "index section" its showing error expected to find 112.00 something...... can you clarifify what to do to convert the number into USD? timestamp: 15:45
All values need to be in USD format. I have to re-do this video explaining this since it's the Number 1 asked question. There should be lots of help here in the comments section since that one gets asked a lot. Hopefully previous comments can point you in the right direction.
im having some trouble with the quote part. When i click get quote, the correct quote names dont show it just shows whatever i typed for the quote name and symbol. Please help Devin
I must be misreading this. When you lookup a quote it shows you the quote price right? I think I'm misreading this. If you can explain further I'll see what I can do.
Thank you so much for the video, helped me understand the concepts a lot more but there is one error that keeps showing up and idk where. It's within the buy function as it says a float is not iterable and gives me a type error, although it says the buy handles the purchase. If you could point me in the right direction, that would be awesome! Thanks again
I can. Try defining float in your index function. Defining it early will clear most things up. Otherwise - consider using the built in 'usd' function. if that doesn't make sense - drop a line in the discord and I'll help get it sorted! you're almost there!!!
Can someone please help me I've been working on the project for several hours but I can't get rid of this error code: “expected to find "9,888.00" in page, but it wasn't found”. Thank you
Hey there! There are dozens of comments regarding this issue and I cover it twice in the video. In your app.py you need to implement the usd or float function to get your totals on income rounded appropriately. You're very close and this is early cs50 logic. You can get there. Use one of those two logics so that your balances are rounded to 2 decimal places.
@@RealisticResponse Thank you for the answer. Even though it's so easy, I still can't seem to figure it out. Can you please show me how to solve the problem?
I have a question about this problem. I found this this problem very difficult, and to be honest, I couldn't do anything on my own. That's why I watched your tutorial. Since I've paid the fee for the verified certificate with a 90% discount from edX, I've been wondering: " Is me using most part of the code you provided in the video against the academic honesty? Can I lose my certificate because of it? " I really wanted to finish this course without any help from the internet, but it's just too difficult for someone like me who hasn't got a great CS knowledge. Could you shed some light on this point please?
My videos are meant as guides. But to answer your question let me ask you this. If you're in a group project at school. And there is a portion you dont understand, but as a team they help you and explain to you so that you DO understand. So you use the value they've given you. Do you view that as cheating? This video took me a LONG time to make and I've spent countless hours continuing to help people since posting it. the value of this video is to help you learn. not for you to copy - there are also countless changes you can make if this video helps you understand. But if you don't understand, how are you to learn and continue? I hop this better answers your question.
thanks again for this video! having a small problem. when I sell shares of a stock, say I sell 5 shares of (T) those shares are added to my total. so instead of having 5 shares ill have 10. any ideas? thanks!
Yes! it's in likely in the def sell function. Check lines (roughly) 285ish against my code and make sure that section is correct. Should be in the else function or the dbexecute below that.
thanks! decided to do a total rewrite but when get back to that ill check it again! thanks for all your help, you should do paid 1on1 coaching or something man @@RealisticResponse
ok so im looking at it now, and I think your lines go up to 273. I looked in else: quote = lookup(symbol) if quote is None: return apology("symbol not found") price = quote["price"] total_sale = shares * price db.execute("UPDATE users SET cash = cash + :total_sale WHERE id = :user_id", total_sale=total_sale, user_id=session["user_id"]) but didn't see an issue Maybe it above that? @@RealisticResponse
By check50 sell I get sell page has all required elements, sell handles invalid number of shares and sell handles valid sale but with all of these can't check until a frown upside down
Hey Sabine! One way is to update the app.py file using float logic and USD() I mention this twice in the video as well as in the description. This part is up to you. At this point in the class if you've been following along and following with my videos you should have the know how. You need to get your index to return totals in 2 decimal places - how you do that is up to you but it is required for the final.
Somebody please help me out. I'm getting the error under "buy handles valid purchase" ``` sending GET request to /signin sending POST request to /login sending POST request to /buy exception raised in application: TypeError: 'NoneType' object is not subscriptable ``` I went trough everything printed out every value, double-checked every condition and still cannot find what is the root of the problem. I'm not returning a None value to anywhere.
I can tell you with certainty; you're overlooking something. The error indicates a but function purchase which could be sql related, but you also may have errors in each portion of your signin, login, and buy. without seeing your code, it's difficult to discern but it sounds like a sql issue. You either aren't starting with the amount of money required, or adding shares to table, or reducing money from purchase - something like that. This code has worked for thousands of people. If you take your time, you'll find the error. This is part of programming is identifying bugs. something is missing. or tabbed wrong. or you used - instead of =. any of these could be the issue. you have to be patient with the code. My code and this video are a guide. by this stage in the course you should be able to read it. you should be familiar with debugging. read the error, read the code, be patient, and update accordingly. This is all part of programming. It's something you can't stand against and must embrace is this is the path you wish to take.
:) app.py exists :) application starts up :) register page has all required elements :) registering user succeeds and portfolio page is displayed :) registration with an empty field fails :) registration with password mismatch fails :) registration rejects duplicate username :) login page has all required elements :) logging in as registered user succceeds :) quote page has all required elements :) quote handles invalid ticker symbol :) quote handles blank ticker symbol :) quote handles valid ticker symbol :) buy page has all required elements :) buy handles invalid ticker symbol :) buy handles fractional, negative, and non-numeric shares :) buy handles valid purchase :) sell page has all required elements :) sell handles invalid number of shares :) sell handles valid sale :) history page shows transactions Still works for 2024
Please Help :) I am receiving error: :( logging in as registered user succeeds and log reason is: exception raised in application: RuntimeError: no such column: name. I tried updating sql by going through the steps you suggested with creating a new table but when I try to do that I get : Parse error: table transactions already exists CREATE TABLE transactions ( id INTEGER PRIMARY KEY AUTOINCREMENT, user_id INTE ^--- error here
no such column name implies the original built-in sql rows might be missing. when you open your sql and view tables you should have 2. The one you created and the one it came with. Can you verify both tables exist within the sql file?
Whenever I click the sell button I am getting Internal Server error. In the terminal it says TypeError: The view function for sell did not return a valid response. The function either returned None or ended without a return statement. Any ideas on what the problem is?
Hi, this video helped me greatly!! But I still cannot get rid of one error - the log says there is no such table: transactions. Do you know how I could fix that?
Sorry - somehow YT didn't notify me of this error. If you're missing 'transactions' then the SQL code hasn't been updated. Did you see the portion of the video where we updated sqlite3 finance.db ? we need to add transactions to the sql so it can be logged.
@@RealisticResponse no problem thank you for replying! You were right, I just mistyped the name of the table and therefor the program couldn't find it :) Thank you again!
When i do check50 it returns :( registering user succeeds and portfolio page is displayed expected status code 200, but got 400 i have tried using print statements and it doesn't print anything. Do any one have experienced the same problem?
I do have a problem with the sell function. Even though I applied the usd() function everywhere I could, I still get the error: expected to find "56.00" in page, but it wasn't found. 😔. I'm so tired of this error.
Check your html and app.py and make sure you've implemented the cash function - if you run your page and look, you need to get down to 2 decimal places - to do this, you have to use the cash function - there's a LOT of comments here that help answer this question. you're very close - it's honestly simple enough that when you see it you'll kick yourself at this point.
Hi there! Huge thanks for uploading this video, truly helped a ton! But now I'm facing an issue when I go to the drop-down to select the symbol of the stock I wish to sell. When I select the drop-down, none of my owned stocks appears for me to select. I definitely have the stock but I just can't choose any of it. Any help would be appreciated!
Have you considered not using the drop down method and switching it to an input stle box like the one you use to purchase shares? If the shares are owned and not in the drop down then perhaps an input method would solve this? You've already used one in your code so you could just switch it to that.
Thank you for the tip! That actually sounds pretty good, will give that a try. But for my learning purpose, would you have any idea as to why my owned shares just aren't appearing despite following your code? @@RealisticResponse
So i've noticed some users (like mac users) are having trouble with the drop down - instead of using the drop down tr coding your sell more like your buy - using input instead of drop down. Should help fix it.
Hey! Havent heard any issues here. Did you create the sql file so that when you register a new user it has somewhere to save that info and then log them in?
Can y help me please it give me this bugs :( buy handles fractional, negative, and non-numeric shares application raised an exception (see the log for more details) :( buy handles valid purchase expected to find "112.00" in page, but it wasn't found :| sell page has all required elements can't check until a frown turns upside down :| sell handles invalid number of shares can't check until a frown turns upside down :| sell handles valid sale can't check until a frown turns upside down :| history page shows transactions can't check until a frown turns upside down
Do you know why I keep getting these two errors? :( registration rejects duplicate username sending POST request to /register exception raised in application: NameError: name 'checkUsername' is not defined :( registering user succeeds sending POST request to /register exception raised in application: NameError: name 'checkUsername' is not defined
The function you're using "checkUsername" in your app.py is not properly coded. My guess is the register function based on the error. You need to reevaluate the code in this portion where you define "checkUsername" to make sure it's accurate.
Thanks for the support. Your problem is too general though. This code works. It's been tested thousands of times at this point. So something is off in yours but I'm not sure what. If you can be more specific, i may be able to help.
When I run flask run and click on the thhif file, it shows up on the website but it doesn't have a register or quote or buy or sell. The entire website is still the same as when I first opened the source code. Thank you bro. @@RealisticResponse
When I followed you, you watched the video details, but after the code was finished, it was not linked together, what should I do? Please help. @@RealisticResponse
A previous version I wrote. It doesn't serve a purpose. I was going in a different direction and left it in. but it is a dead line of code so shouldn't impact yours if you do not use. This video took so long to do, removing something I didn't end up using in the end became to tedious so it died in-line.
Thank you so much for your video it was helpful. I am having an issue with My login, it returned an error saying expected a 200 status code but got a 400 status code. What can I do
@@preciousadedamola8294 this is too vague i dont know where your error is. 400 means bad request. but i'm not sure where you're getting it. this is a whole application. the 400 could be getting thrown anywhere.
@@fantasticearner3415 @preciousadedamola8294 this is too vague i dont know where your error is. 400 means bad request. but i'm not sure where you're getting it. this is a whole application. the 400 could be getting thrown anywhere.
Hello i think i need your help, i did the code exactly like yours , but it gives me a error message saying " expected to find "9,888.00" i page, but it wasnt found" (i did exactly like yours because with my changes to your code it gave me the same error message) any help?
I mention this 3 times in the video and in the description and in many, many comments. Its a very simple feature that I left out on purpose but if you read through some comments here you'll find the help you need to solve.
nvm I found the issue. I'm sure that you have already fixed it, but for anyone struggling in the future, you need to make sure that your index uses the "usd" function. {{ stock.price | usd }} {{ (stock.price * stock.total_shares) | usd }}
@@ext1nct297 i have the same issue for days now...When you say "index" you mean that it needs to be displayed in usd format on the main page where index table is shown?
He means the code on the index page needs to be converted to usd - I mention it several times in the video and in the description and multiple comments. convert your totals to usd and you'll be good to go
hey there Devin! I really appreciate your work but I'm having a tiny problem in my register function. I don't know why but my register wont work like it wont register if I try. Is there a solution to my problem?
Hi! I'm certain there's a fix but this problem is too general. I can't identify the issue just by knowing there's a problem. It seems pretty straight forward that the issue is in the register function or html but I couldn't say where. Also possible the sql file is corrupt - this happens from time to time
Hi you have been so helpful. Thank you for your help during this process. I am getting so close to finally finishing up and sadly im not able to get thought the problem of this last code. it keep coming up ":( logging in as registered user succceeds application raised an exception (see the log for more details)" not sure what that problem could be. could you help?
This is a unique issue. possibly a flask issue - when you're running the application - your codespace should be showing a running log. is there anything in the log that shows what the error is? It could be flask, sql, or app.py but i dont have enough info to know based on this.
Hey I encountered an error and not able to resolve it on my own can any one help me. The error is :( buy handles valid purchase Cause expected to find "9,888.00" in page, but it wasn't found Log sending GET request to /signin sending POST request to /login sending POST request to /buy checking that "112.00" is in page checking that "9,888.00" is in page
This is a COMMON question. Please see details and pinned notes. In the video I mention I did NOT solve this and its up to you to complete the app.py to get the digits of the numbers on your login screen down to 2 decimal places. You can use FLOAT or the built in USD or anything similar but you need to get the monies down to 2 decimal points to complete this task. Its mentioned in the video a few times and in notes I left on cideo
Hey, I ran check50 and got the following :( registering user succeeds IndexError: list index out of range :( registration rejects duplicate username IndexError: list index out of range I don't understand this error, could you help?
index out of range Go through your app.py and look at the SQL Commands. # Query database for username rows = db.execute("SELECT * FROM users WHERE username = ?", request.form.get("username"))
Hey Garbson. This video is the best I can do. It solves everything except converting money to 2 decimal places which is a task anyone on week 9 should be able to handle. This video took hours of prep testing work and editing. It is the final video for this particular problem set that I'll be making. This video is a walk thru and explains concepts. I apologize if it's not working for you. Its literally the best I could do with what I had.
i am having a error with my check50 it says that "unknown file type......skipping" to all html and css files.sir can you please help me this? and my finance is working fine. it is also saying that can't check a frown until it turns upside down please sir please help me with this
The only thing that I think could be wrong is your file extensions and/or locations. you need to make sure all html files are labeled ".html" and are nested inside the "templates" folder. you need to make sure your .css file is labeled as such and is nested in your "static" file folder. The only thing I can think is that your files and folders are likely labeled wrong or messed up somehow.
Last I ran this code it cleared all green - I've run it thousands of times now. It will get an update in 2025 as it seems to still work. This particular video is a huge undertaking. Perhaps if you elaborate the problem I can assist.
Hi so for the sell function it tells me that it didn't return a valid response, it either returned none or ended without a return statement. I don't get what it means by "the view function"? What do you think I could have done wrong?
Ok this is a big one but could be something small. That error might mean that the sell either returning None explicitly (like using the return None statement) or ending without a return statement. The sell function should have two main branches: one for handling the form submission (POST request) one for rendering the initial page (GET request). The problem might be occurring if the function reaches the END of the else block without returning anything. One possible fix is, add a return statement at the end of the ELSE block to ensure that the function returns a response in all cases. So you might check the return apology or otherwise the return render template make sure they're in the right loops unlikely but possible is the return redirect. Here's a snippet of the possible location of the code: return redirect("/") return apology("symbol not found") # If the user visits the page else: return render_template("sell.html", stocks=stocks)
Critical UPDATE: The BUY function EXPLICITLY wants a "button" despite the form being in working order, you need to update the code as follows on buy.html (this is a modification only to the last line that turns the from click into a button to satisfy:
Buy
Shares:
Symbol:
Submit
The issue with buttons actually now applies to all buttons in Buy, sell and quote.
Just use for every button or check50 will turn red (tested in 2024)
Crucial here is the type="submit", which the html seems to be tested/scanned for.
@@lpdemodimi I love this quote - I haven't gotten the update for 2024 yet so THANK YOU for noting this!
@@lpdemodimi hey I've done this but it's still showing me "expected button to submit form, but none was found."
:( buy handles valid purchase
expected to find "112.00" in page, but it wasn't found
I'm having this problem even though I got the right text to appear in a flash message and the button to work.
@@chaitanyadubakula same, even im getting it. did u figure out how to solve it?
People having issues with the 2024 version,: there is a note for the index. The lookup function no longer returns a "name". Just delete ( stock["name"] = quote["name"]) from the code and also from the html table. Thanks Devin for all your great tutorials.
I love this comment! I Hope everyone is reading this. thank you!!!
I do not understand how it should be now implemented. Can you please help?
My previous code was like this:
for stock in stocks:
quote = lookup(stock["symbol"])
stock["price"] = quote["price"]
stock["total"] = stock["price"] * stock["shares"]
total_price += stock["total"]
@@aristzampaftis6828 gonna have to hop in discord and be patient but I'll help you figure this out: discord.gg/GeTqTCHA
NOTE: taking this line out means that the colspan="4" NEEDS to be colspan="3" in BOTH spots, otherwise the check50 will give an error
@@aristzampaftis6828 I need to know what error your getting - new discord link is:
discord.gg/YPsWnFWW
good for 7 days
This is an insane assignment for those of us who are taking this as an "introduction" 🤕
@@sethtufte7660 I agree. It's a huge undertaking. Hopefully the video helps some. Even making this was massive for me
I love how you are replying to every single person who has doubt even after 5 months of posting this video this is really great. I appreciate your efforts. Thank you so much for your work and dedication.
Lol coding as a beginner isn't easy. Some people just need reassuring. Thanks so much for the support! I really appreciate comments like this!
You are a literal godsend... I struggled so much with this problem set, like panic attack level and finding this video stopped me from giving up my entire 6 months journey. I cannot put into words how grateful I am that you chose to upload this video to help the thousands of people who like me struggled. I'm sure you already know from the hundreds of people thanking you that you are appreciated, but truly, thank you! On to final project!!!!!
could you submit it bro? the code is working?
Yo my whole project is working perfectly fine bruv did it all by myself but when I do check50 im getting an error on the buy page stating "buy handles valid purchase
expected to find "112.00" in page, but it wasn't found" do you perhaps have a solution for this bruv???
My pleasure! Thanks so much for the support! I'm so happy I was able to help! Appreciate you sticking with it till you found me an congrats on completing this!
@@alialdalate4225 respond to my comments no les than weekly - code still works - update video to prove it - you're good - just stick to it!
@@josiahking2772 This question is answered in the video 3 times, i put it in the description, and I've answered it on MANY comments - trust me that the answer you're looking for is MUCH simpler than you think but if you read other comments, I promise you'll get there.
It does indeed work. As for the part he tells you to do on your own, he drops a lot of hints. Thanks Devin.
You are the BEST! well done and congrats! Hopefully I'll have more helpful stuff this coming year!
I need help related to finance project please reply me 🙏
thanks Devin. longest 22 minutes of my life 😀
I feel you - making this one was..... intense. Not the code (which wasnt fun) but the video - cutting out all the repeats and trying to trim it down. I did my best but MAN was it a big one. Congrats making it to the end!
Helped me out a TONNNNNN!!!!! Didn't officially enroll in cs50 but was using the entire course as a primer for my enrolled Comp Sci courses next month-I think all of this will lay an awesome foundation, and Devin I cannot quite frankly thank you enough for all of this. Smoothed out the major bumps in the road through a lot of the differing projects when I got stuck, and this last project was an absolute beast that would have taken me way WAY longer without your help. THank you so much my man
I'm sorry to be so late to such a nice comment. I can't tell you how much I appreciate you letting me know that I've helped you. I'm glad you're done and hopefully, as I grow this channel, I can continue to contribute to your growth as a coder. Keep up the great work and thanks again!
I need help related to finance project please reply me 🙏
Late, but was CRYING and having a full on mental breakdown because I couldn't solve this and all the other tutorials took hours but didn't work. Then... A MIRACLE HAPPENED! I found this video and finished the pset in an HOUR and I am crying tears of joy THANK YOU SO MUCH FOR ENDING MY SUFFERING
Allah Akbar 🙏
Hey, I'm stuck on the sql part it keeps leaving at this ...> can you if don't mind help me out please?
@@Luci_19 make sure you first
cd finance
then
sqlite3 finance.db
then execute your command. Dont forget to get into the sql file first before updating anything in terminal
make sure you end SQL commands with a semi colon;@@Luci_19
Great Video Brother!!!
Thanks to you i am moving to final Project ,
Thank youuu!!!!!
Keep this good work continue you will definitely Grow ❤❤❤❤
All you my friend! Congrats on completing this! Happy I was here to be a part of this with you!
bro can u help me out
im stuck
Submission criterias are so strict that even when the app is working as it should, there's still :( marks. Your work has certainly helped me as it's provided the reference I've needed.
By the way, the proper way is to create a stock table and a separately transactions table. At every transaction you add stock AND update transactions accordingly. You return the content of the transaction table to /history table, and that of stock table to the root folder table, accordingly. This allows for purchase of the same stock many times at different values.
As I stated above, your work was instrumental to help me move at critical stages. You are appreciated. Thank you.
In the video I mention 3 times that the money isn't formatted. And it's in the description as well. I did this on purpose because I want the user to find and update these things accordingly. This was a very simple task (as you noticed) so I wanted to make sure people could identify this error, and update it on their own.
Oh okay! I get you now. Did not really watch the video, I just went to a section that puzzled me. Now I edited the comment accordingly@@RealisticResponse
Thank you! This was really helpful. It makes a hard an frustrating problem a good learning tool, there is a lot to learn by going through your video and the completed project. Once again thank you and congratulations for being a person that shares knowledge and helps others.
Hi! Helping others is a big deal for me. I'm so grateful for each comment and person out there letting me know I'm helping so thanks so much for the feedback!
Dude you have been such a huge help and inspiration while i was taking this course. This video helps clear up a lot of things for me.
On to your final project I suppose?
Sorry for the delay - been away - but coming back to comments like these make all the difference in the world. I appreciate my subscribers and commenters and supporters more than they know - I'm glad I was able to help you out.
You are an angel and I wish all the best for you and your family. Keep up the great work and helping people, you are an incredible person, congratulations.💟
Thanks so much! Congrats on making it this far!
Thanks man, your video helps a lot, I just saw the code to clarify some things, borrow ideas and do things that I was doing in 3 or more lines, just to review the logic to do it in one. This is for real a tough one as you said, but it's Cs50, we all know how difficult this course is. I think that despite making the codes work throughout the course, what bothers me most was making the code pass the test, I know that some tests are very useful, but in other cases the lines simply work but the tests go wrong, and you don't even knows where to look for this error, and in which case it is giving an error, even with the help of the course's AI. Anyway, thanks again.
You're not wrong. I've made a few functional codes myself and they didn't "pass" CS50 algo. But I just kept re-working the code until something happened. Good work getting this far and 'hopefully' completing.
I need help related to finance project please reply me 🙏
Hello , I am facing an internal server error here in register can you please help I followed all the steps yet it' keeps showing error
Thank you Devin for this detailed video! You are an inspiration to myself and I am sure many others! thank you once again!
Great solution, before this vid I was stuck with an error 302 instead of status code 200. This pset was TOUGH. Thanks for the help.
Absolutely! Thanks for the shout out! This one wasn't easy but I'm glad you got through it! good job!
I am so thankful for you. Today i will be submitting my final project and all thanks to you. This journey would have been impossible without your help. This pset was the most toughest but with your help i was able to do it. You're godsend
Hello man iam too but I still have a problem I fnace it doesn't wana work
Congrats! I'm Happy for you! we all need a little help sometimes. Happy i was able to be part of your journey!
Bro you are a LIFE saver. Had most of it, but couldn't find how to reference the session's user_id for the life of me. Thank you!
Happy to help! good job making it this far!
I need help related to finance project please reply me 🙏
are you doing pset9 2024? did the code work for you?
Really though thanks for the video this is super helpful and Encouraging, I finished the lab then came to this one and was like "WUT"
This one is TOUGH dont feel bad. I see now why there's so few video helps for the whole course but this one especially. Good job making it through. Good luck on your project!
Thank u for all of the help that u provided. Love the content and information. Hugs from Argentina
Thank you so much brother I appreciate you and your help, I have been struggling with this problem set until I found your account ✨
I am watching your videos from KSA 🇸🇦
Thanks! So happy I could help! I'm on to CS50W now and then after that I think maybe the MIT course but we'll see where the road takes us!
I had this pset going well up until buy where everything got messy for me, but your explanation of how it works helped me a ton. thank you!
Glad I was able to be a part of your success! Congratulations!
hello friend, I'm sorry for not expressing myself well, I would never diminish your work, on the contrary I am very grateful for your help, without it I would not have been able to finish the course, thank you very much
I didn't think you were being disrespectful. I'm happy to help and will do whatever I can. This small thing was just more than i was or am able without a whole other video.
I'm happy to help and happy to see you're completing the course! Thanks so much and dont worry. I'm here to help.
thank you so much for the great help!!!! And your logic is crystal clear , admire you!! hope you all the best !!!
Thanks so Much! Just getting back at it after a break and hope to bring you lots more helpful information! Appreciate you!
Thank you very much for your hard work! I have learned so much and finally understood everything!
Thanks so much for the support hearing that you understand is invaluable. Appreciate you so much and congrats!
That one actually get to me pretty easy, even that I struggle at the more earliest psets...
That's great! This is a tough PSet that shows excellent growth that it's not difficult for you. Well done!
Thanks Devin! you are the 🐐
Congrats on making it this far. Happy to help in your journey!
Such a legend for this, i was starting to get demotivated because I wasn't confident in my logic, but using your guide to proof check what I was doing helped alot with that. Your explanations made it so easy for me to understand what i was doing.
Can tell you how much this means to me. I keep getting downhearted since making these. Not all of the feedback is positive and it gets tough trying to help people all over the world. But comments like this definitely keep me motivated. I appreciate you, and congratulations on making it this far!
brother, can you tell me what he meant in 10:50 , how do I add the codes in the sql file? I wrote the codes in a seperate .sql file and kept it inside finance folder , then i went to sqlite3 and now what?
@@omarhoque1662 I wrote a response on your other comment - hopefully it helps. but get into your sql file b entering the command sqlit3.db to enter the existing sql database (recall sql week and manipulation).
Awsome bro . thanks ! for the short and clear explantions
Recording this one was a nightmare - Thanks for your support! Appreciate you and congrats on making it this far.
This one hurt! Thank you for your help:)
Here to help!
Finally!!! Thank you you're awesome ❤
Let's go! Check the recent video for a giveaway. Gratz making it this far!
Hello brother, thank you for your efforts and I hope you will re-explain this problem because cs50 has updated it🙏
There's already an updated video. The changes to CS 50 do not affect the code. the code in this video is correct. Please feel free to watch the short video regarding the update.
That was awesome explanation
Great! Thanks Finley
Thank you so much and congrats on making it this far!
Bro, haven't seen you in a couple of months since ps6 I guess. Thank you for making the code scale larger, the content is perceived in a completely different way.
My pleasure. Onnupdated videos when they come you should see improved visual and sound. Also for future courses. I appreciate the feedback and want to make sure these videos are helping . Glad to see you made it back around! Congrats on making it to the end.
@@RealisticResponse Thanks Devin. It's been a long journey.
Thank you :) You are a life saver
Thanks for the support! Almost done!
Thanks for your help ! 😇
Absolutely! My pleasure keep up the good work!
Nice video, bro! Thanks for the support, without these type of videos, we can't finish the course... :/
The course is difficult for true beginners I hope that these helped you understand better. Always good to re look at what you've done. The second time around is super helpful now that you have the know how. This is all about practice and redundancy. Good work!
@@RealisticResponse Yeah, totally agree. I'm on the first month studying computer science and I have to say that it was very difficult to me to understand all the stuff. Your videos helped a lot of people around the world, thanks! Hugs from Brazil!
@@caiomac1 man that's hugely appreciated! Thank you so much! Coding is all about working together. The internet was LITERALLY invented to advance science thanks to Tim Berners Lee. I'm for it and I'm here to help. Great job and keep up the good work!
Awesome been waiting for this lol
It has ARRIVED! lol took me some time hope it works.
THANK YOU SO MUCHHHH!!!!!!i've finally finished this pset!!!!
I need help related to finance project please reply me 🙏
Thanks buddy this helped me a lot
Congrats! Hope your final project goes well!
You Da Man, Respect👍
appreciate you! good job finishing and good luck with your final project!
@@RealisticResponse Thanks buddy, I am gonna need it.🙏
@@Iquon1 find me on discord if you need help! here for it. congrats again!
@@RealisticResponse Thanks buddy, thats very kind of you🙌
:( buy page has all required elements
Cause
expected button to submit form, but none was found
Log
sending POST request to /login
sending GET request to /buy
found required "symbol" field
found required "shares" field - what is this error even though i have a button for buy
Read the replies from the pinned comment
Guys, be careful when creating the files for your templates because if you just go to File - New File, the default option is to create your html files in the Finance folder, and you want them in the Templates folder :D Yes, I was that idiot who didn't pay attention and re-wrote the code 1398203 times for no reason ... :D
Thanks so much for sharing this! It's invaluable information lol we've all been there and sharing our mistakes will always help others avoid them. This is why i love the coding community! Keep up the great work!!!
@@RealisticResponse I still cant believe the silly mistake, but that's why I shared it also, I can imagine other people doing the same thing :D
@@TeamUpWithAI lol understand completely. But I'm glad you found and shared. Thanks again!
LOL this happened to me multiple times had to restart so many times
@@RealisticResponse wait so if I made a transactions.sql file for the transaction table, that should go under the template folder?
here are the errors I encounter after running your code : :( buy handles valid purchase
expected to find "9,888.00" in page, but it wasn't found
:| sell page has all required elements
can't check until a frown turns upside down
:| sell handles invalid number of shares
can't check until a frown turns upside down
:| sell handles valid sale
can't check until a frown turns upside down
Hey there! So Here's some more hints - First, in the video i mention it about 3 times. Also - in the description there's a hint.
This error means that your totals are not in 2 decimal point formats. To fix this you need to look at your app.py and use a function (see description) to make sure that your total's are giving you the results in just 2 decimal places.
Also look to other comments here. I've had this question the most. I knew leaving it out would cause this, but i needed to leave some things up to the user. The basics of this go back to week 2 i believe so I'm certain once you see it, it will click. Just get that updated and you'll be good to go!
@patrickfaudap7216 Where you able to solve the error? I have the same error and I've been trying and asking for help but no one has replied to my comment..can you help me please?
@@davidninoaguirrecampis6617 You replied to his comment but didn't read the comment I told him on how to solve it. There are dozens of answers I have here helping people solve this same problem. I recommend reading my replies and that might help you understand.
hello! Great video. Just asking at 5:23 on Line 8 it states "url_for(register" is this the part where we paste the image or is this text necessary? Many thanks! 😁
Hi! The text is necessary. In that line (which we have on all .html files) the program is using html and flask to find and load your 'register' route/view.
Its an html FORM that will POST a request to the listed url in the app.py file. Does that help?
Not sure if anyone caught this yet but a critical piece you didn't note in your sell section is the number if shares should be a negative value 17:21 . This is in your code but not mentioned and easily missed. Thanks for the video.
You're a gem. This video was several days of editing. I appreciate the feedback and looking out for others. There was bound to be a thing or two i missed so thank you for helping and supporting others.
I need help related to finance project please reply me 🙏
thank you so much for this video!
Hi Devin, when you are adding the transaction table am I inputting that information exactly. You had it on a notepad but where did you put the code?
so you're going to update it in sql.
In your terminal (just like when we did sql) you're going to type:
sqlite3 finance.db
that will open the sql database and you'll update the tables with that code. Once you're done just exit SQL and get back to the code. Does that help?
Thank you! @@RealisticResponse
@@RealisticResponse I put it in my terminal and got out of it ran flask run and it still isn't working. In my history on the website it isn't listing the transaction type. I have it in my html. and I have it in my updated table but it's still not showing up.
@@jessipresten9042 my pleasure!
@@jessipresten9042 It wont show up unless you sql it and look for it. you should be able to view it if you .schema what do you mean it's not showing up?? changes to sql dont just show up - they're built into the database so its not something we see unless we pull it up like i do in the video or run .schema or run .tables or something.
I WAS STUCK ON THIS PSET FOR FOREVERRR. THANK YOU SO MUCH FOR THIS QUALITY CONTENT!! only suggestion would be to make a detailed video with deeper explanations if possible! that’s something that would help me soo so much to understand why we write certain code. ALSO, for those of you getting the :( on buy handles valid purchase, make sure to test this only after you have formatted the price to match the criteria (2 d.p.)! A hint for this is that you need to use the format function on your index.html!
Since we're already in August, I'm waiting for the 2025 drop and plan to re-do the WHOLE course with better quality. I've improved my PC, My Mic, My Camera, all of it - hoping to do some better, deeper dives to help more people but THANK YOU for you're early support and comments!!!
I need help related to finance project please reply me 🙏
@@cricfever_30 hey, i could try helping! what’s the issue!
@@meera.srivastava bro send me your instgram I'd there we discuss, because I continue to get an error that's a reason. Please reply
@@cricfever_30 how can i help?
I have been on this pset for more than 3 weeks, your code really helped except for one final error in buy. :( buy handles valid purchase exception raised in application: KeyError: 'value'
I think this is a problem with the API key but im not sure. If it is a problem with the api key then could someone please tell where you're getting yours. thank you
Did you get this solved?
Good work bro
Congrats making it this far! Good luck with your final project!
Hello Mr. Finley, is there any way that you can make a 2024 version? I tried using your code but it did not work. Thank you for your videos, I couldn't have done most of the course without you. Please consider making a 2024 version soon...
:) app.py exists
:) application starts up
:) register page has all required elements
:) registering user succeeds and portfolio page is displayed
:) registration with an empty field fails
:) registration with password mismatch fails
:) registration rejects duplicate username
:) login page has all required elements
:) logging in as registered user succceeds
:) quote page has all required elements
:) quote handles invalid ticker symbol
:) quote handles blank ticker symbol
:) quote handles valid ticker symbol
:) buy page has all required elements
:) buy handles invalid ticker symbol
:) buy handles fractional, negative, and non-numeric shares
:) buy handles valid purchase
:) sell page has all required elements
:) sell handles invalid number of shares
:) sell handles valid sale
:) history page shows transactions
As Of 08:50AM on 27, January 2024 this code still works. although, AS MENTIONED, you need to convert to USD - the only check that has been added is for a $28.00 on history page which, as mentioned in the video, means you have to convert "price" on your history page to 2 decimals.
This code till works.
@@RealisticResponse Thank you, sir. I'm very grateful for your help, have a great new year
print("Thank you Thank you Thank you Thank you!"*10000)😍
thank YOU - appreciate your support! keep up the great work!
@@RealisticResponseI need help related to finance project please reply me 🙏
Hey Devin..!! its been over a week I'm working on finance but getting errors in sell function. some are those errors which I can't understand where I screwed up, when I execute check50 it even can't check any function.
Hey there, you're not giving me anything to go off of here. I understand something is broken but you're kind of just telling me nothing is working. I can't really evaluate the depth of the issue. This should have take a while, over a week isn't uncommon - but you should have been testing at every stage and every html extension. if you did this then we can identify the error. or if you have an error message... but telling me nothing works is the same as telling me 'i have no code' - i just dont have anything to imagine where the problem is or could be.
Hello, when I check, it keeps ask "buy say handles valid purchase expected to find "112.00" in page, but was't found? How can I solve this
I have the same problem. Do you know how to solve it? Is it becuase of the decimals?
I talk about this 3 times in the video and there's hints in the description and I've answered it dozens of times in the comments Please look to previous comments for help - it's a very simple addition to the code that you need. Please have a look around to see if any of the other previous comments or description help.
@@mario050488 I talk about this 3 times in the video and there's hints in the description and I've answered it dozens of times in the comments Please look to previous comments for help - it's a very simple addition to the code that you need. Please have a look around to see if any of the other previous comments or description help.
Hi Devin, I have all the code and checked that my sql table was updated but I am still having trouble with my buy page. Here is my error :( buy handles valid purchase
application raised an exception (see the log for more details). Everything else is working on the site.
this should be in your buy function in app.py - theres something missing telling the program what to do when executing a buy - it has to do with the function that updates the sql to add a share and subtract the cost of it.
I'm having the same issue. How did you resolve??
Thanks!
My pleasure! Keep up the good work!
Hello,
I've been trying to solve the CS50x problem since a month but I am still unable to. The only set left is this one. Is there any correct solution form where I can copy the code and learn from it. I'm really tired now.
Hey there. I don't have a cheat sheet. This video can help you solve the issue. The code and explanation is all there. Don't feel bad if you have to take a break. But i don't have the outline as an answer sheet posted anywhere.
Make sure to (cash)| usd on every html!
I got one question: In the Index function what's the point in having two variables total_value and grand_total that always have the same value?
Ok... hear me out.... ORIGINALLY I'm a finance major. So when I was writing the code I intended to use Total Value as the total value of just the stocks; and Grand Total as the value of the stocks AND the cash balance. As you correctly pointed out, in this code,
total_value += stock_value
grand_total += stock_value
They ended up being the same. And this video took so long to make that I wanted to chuck my computer out the window. So I never went back and changed them to the parameters I originally meant to use. So... I knew i'd get called out eventually... but I was in too deep. lol and i left it. But that was the original plan.
hello, thankyou for the video --> im a bit confused about the "index section" its showing error expected to find 112.00 something...... can you clarifify what to do to convert the number into USD? timestamp: 15:45
All values need to be in USD format. I have to re-do this video explaining this since it's the Number 1 asked question. There should be lots of help here in the comments section since that one gets asked a lot. Hopefully previous comments can point you in the right direction.
im having some trouble with the quote part. When i click get quote, the correct quote names dont show it just shows whatever i typed for the quote name and symbol. Please help Devin
I must be misreading this. When you lookup a quote it shows you the quote price right? I think I'm misreading this. If you can explain further I'll see what I can do.
Thank you so much for the video, helped me understand the concepts a lot more but there is one error that keeps showing up and idk where. It's within the buy function as it says a float is not iterable and gives me a type error, although it says the buy handles the purchase. If you could point me in the right direction, that would be awesome! Thanks again
I can. Try defining float in your index function. Defining it early will clear most things up. Otherwise - consider using the built in 'usd' function. if that doesn't make sense - drop a line in the discord and I'll help get it sorted! you're almost there!!!
Can someone please help me I've been working on the project for several hours but I can't get rid of this error code: “expected to find "9,888.00" in page, but it wasn't found”. Thank you
Hey there! There are dozens of comments regarding this issue and I cover it twice in the video. In your app.py you need to implement the usd or float function to get your totals on income rounded appropriately. You're very close and this is early cs50 logic. You can get there. Use one of those two logics so that your balances are rounded to 2 decimal places.
@@RealisticResponse Thank you for the answer. Even though it's so easy, I still can't seem to figure it out. Can you please show me how to solve the problem?
@@luc_kht I can help you solve this but you have to hop in discord. I cant give you the answer but I can help get you there
Thamks broooo!
Happy to help! this one was a monster!
I have a question about this problem.
I found this this problem very difficult, and to be honest, I couldn't do anything on my own. That's why I watched your tutorial.
Since I've paid the fee for the verified certificate with a 90% discount from edX, I've been wondering:
" Is me using most part of the code you provided in the video against the academic honesty? Can I lose my certificate because of it? "
I really wanted to finish this course without any help from the internet, but it's just too difficult for someone like me who hasn't got a great CS knowledge.
Could you shed some light on this point please?
No, you wont loose your certificate
@@hi_eklavya Thank you, really relieving.
My videos are meant as guides. But to answer your question let me ask you this. If you're in a group project at school. And there is a portion you dont understand, but as a team they help you and explain to you so that you DO understand. So you use the value they've given you. Do you view that as cheating? This video took me a LONG time to make and I've spent countless hours continuing to help people since posting it. the value of this video is to help you learn. not for you to copy - there are also countless changes you can make if this video helps you understand. But if you don't understand, how are you to learn and continue? I hop this better answers your question.
thanks again for this video! having a small problem. when I sell shares of a stock, say I sell 5 shares of (T) those shares are added to my total. so instead of having 5 shares ill have 10. any ideas? thanks!
Yes! it's in likely in the def sell function. Check lines (roughly) 285ish against my code and make sure that section is correct. Should be in the else function or the dbexecute below that.
thanks! decided to do a total rewrite but when get back to that ill check it again! thanks for all your help, you should do paid 1on1 coaching or something man @@RealisticResponse
ok so im looking at it now, and I think your lines go up to 273. I looked in
else:
quote = lookup(symbol)
if quote is None:
return apology("symbol not found")
price = quote["price"]
total_sale = shares * price
db.execute("UPDATE users SET cash = cash + :total_sale WHERE id = :user_id",
total_sale=total_sale, user_id=session["user_id"])
but didn't see an issue Maybe it above that?
@@RealisticResponse
:( buy handles valid purchase
expected to find "112.00" on the page, but it was not found. I get this from the check50 but how can I solve this?
Or this: :( buy handles valid purchase expected to find "9,88.00" in page, but it wasn't found
By check50 sell I get sell page has all required elements, sell handles invalid number of shares and sell handles valid sale but with all of these can't check until a frown upside down
Hey Sabine! One way is to update the app.py file using float logic and USD() I mention this twice in the video as well as in the description. This part is up to you. At this point in the class if you've been following along and following with my videos you should have the know how.
You need to get your index to return totals in 2 decimal places - how you do that is up to you but it is required for the final.
Somebody please help me out. I'm getting the error under "buy handles valid purchase"
```
sending GET request to /signin
sending POST request to /login
sending POST request to /buy
exception raised in application: TypeError: 'NoneType' object is not subscriptable
```
I went trough everything printed out every value, double-checked every condition and still cannot find what is the root of the problem. I'm not returning a None value to anywhere.
I can tell you with certainty; you're overlooking something. The error indicates a but function purchase which could be sql related, but you also may have errors in each portion of your signin, login, and buy. without seeing your code, it's difficult to discern but it sounds like a sql issue. You either aren't starting with the amount of money required, or adding shares to table, or reducing money from purchase - something like that.
This code has worked for thousands of people. If you take your time, you'll find the error. This is part of programming is identifying bugs. something is missing. or tabbed wrong. or you used - instead of =. any of these could be the issue. you have to be patient with the code.
My code and this video are a guide. by this stage in the course you should be able to read it. you should be familiar with debugging. read the error, read the code, be patient, and update accordingly. This is all part of programming. It's something you can't stand against and must embrace is this is the path you wish to take.
Hello Devin, would you consider checking the 2024 version?
I'll be updating all of these over the next month or so. Yes. Stay tuned
:) app.py exists
:) application starts up
:) register page has all required elements
:) registering user succeeds and portfolio page is displayed
:) registration with an empty field fails
:) registration with password mismatch fails
:) registration rejects duplicate username
:) login page has all required elements
:) logging in as registered user succceeds
:) quote page has all required elements
:) quote handles invalid ticker symbol
:) quote handles blank ticker symbol
:) quote handles valid ticker symbol
:) buy page has all required elements
:) buy handles invalid ticker symbol
:) buy handles fractional, negative, and non-numeric shares
:) buy handles valid purchase
:) sell page has all required elements
:) sell handles invalid number of shares
:) sell handles valid sale
:) history page shows transactions
Still works for 2024
@@RealisticResponse thanks for your reply and checking the solution!!👏
@@dennou2012 Congrats on making it to the end :)
Please Help :) I am receiving error: :( logging in as registered user succeeds and log reason is: exception raised in application: RuntimeError: no such column: name. I tried updating sql by going through the steps you suggested with creating a new table but when I try to do that I get : Parse error: table transactions already exists
CREATE TABLE transactions ( id INTEGER PRIMARY KEY AUTOINCREMENT, user_id INTE
^--- error here
no such column name implies the original built-in sql rows might be missing. when you open your sql and view tables you should have 2. The one you created and the one it came with. Can you verify both tables exist within the sql file?
@@RealisticResponse thanks you are right I made a typo and added 'name' once I removed that word everything went through fine.
@@WTDTravelChannel Great work! good debugging! Congrats on making it this far!
Whenever I click the sell button I am getting Internal Server error. In the terminal it says TypeError: The view function for sell did not return a valid response. The function either returned None or ended without a return statement. Any ideas on what the problem is?
Nervermind, I fixed it.
Hi, this video helped me greatly!! But I still cannot get rid of one error - the log says there is no such table: transactions. Do you know how I could fix that?
Sorry - somehow YT didn't notify me of this error. If you're missing 'transactions' then the SQL code hasn't been updated. Did you see the portion of the video where we updated sqlite3 finance.db ? we need to add transactions to the sql so it can be logged.
@@RealisticResponse no problem thank you for replying! You were right, I just mistyped the name of the table and therefor the program couldn't find it :) Thank you again!
When i do check50 it returns :( registering user succeeds and portfolio page is displayed
expected status code 200, but got 400 i have tried using print statements and it doesn't print anything. Do any one have experienced the same problem?
i have same problem
I do have a problem with the sell function. Even though I applied the usd() function everywhere I could, I still get the error: expected to find "56.00" in page, but it wasn't found. 😔. I'm so tired of this error.
Check your html and app.py and make sure you've implemented the cash function - if you run your page and look, you need to get down to 2 decimal places - to do this, you have to use the cash function - there's a LOT of comments here that help answer this question. you're very close - it's honestly simple enough that when you see it you'll kick yourself at this point.
Hi there! Huge thanks for uploading this video, truly helped a ton! But now I'm facing an issue when I go to the drop-down to select the symbol of the stock I wish to sell. When I select the drop-down, none of my owned stocks appears for me to select. I definitely have the stock but I just can't choose any of it. Any help would be appreciated!
Have you considered not using the drop down method and switching it to an input stle box like the one you use to purchase shares? If the shares are owned and not in the drop down then perhaps an input method would solve this? You've already used one in your code so you could just switch it to that.
Thank you for the tip! That actually sounds pretty good, will give that a try. But for my learning purpose, would you have any idea as to why my owned shares just aren't appearing despite following your code? @@RealisticResponse
Hi for the sell page every dropdown option seems to be blank, as in its literally white space, this makes it so all symbols are invalid, not sure why.
Stock Symbol
{% for stock in stocks %}
{{ stock['symbol'] }}
{% endfor %}
when I inspect the page it gives this:
So i've noticed some users (like mac users) are having trouble with the drop down - instead of using the drop down tr coding your sell more like your buy - using input instead of drop down. Should help fix it.
I get stuck at the register page (can't login & can't register) @5min45s. Anyone else ?
Hey! Havent heard any issues here. Did you create the sql file so that when you register a new user it has somewhere to save that info and then log them in?
Try checking your margins and making sure they are tabbed out properly! And also make sure everything is spelled correctly.
Y r master!!!
Hahaha thank you! Appreciate you!
Can y help me please it give me this bugs
:( buy handles fractional, negative, and non-numeric shares
application raised an exception (see the log for more details)
:( buy handles valid purchase
expected to find "112.00" in page, but it wasn't found
:| sell page has all required elements
can't check until a frown turns upside down
:| sell handles invalid number of shares
can't check until a frown turns upside down
:| sell handles valid sale
can't check until a frown turns upside down
:| history page shows transactions
can't check until a frown turns upside down
This is answered in many many comments and referenced 4 times in the video. Please see other comments that will help solve this.
Does this video also work for the 9th week of the cs50x course of 2024 and give us the correct answer?
Last time I checked (Early feb) the answer is yes - I took a few months break and am getting back to all weeks and updating videos.
In the history page, is the column Type supposed to be empty? Are we supposed to tell whether is a buy or sell transaction?
You could add buy and sell to the table but the + and - in front would indicate a buy or sell. but yes. I love the idea of adding this to the table.
Do you know why I keep getting these two errors?
:( registration rejects duplicate username
sending POST request to /register
exception raised in application: NameError: name 'checkUsername' is not defined
:( registering user succeeds
sending POST request to /register
exception raised in application: NameError: name 'checkUsername' is not defined
The function you're using "checkUsername" in your app.py is not properly coded. My guess is the register function based on the error. You need to reevaluate the code in this portion where you define "checkUsername" to make sure it's accurate.
I Have a problem in check50 with something called "can't check until a frown turns upside down" how do I solve it?
There's an error and you have to check the log to see where and what the error is. Check you're error log like you've been doing.
I followed you but the website still doesn't recognize me and I don't know what to do. You did a great job
Thanks for the support. Your problem is too general though. This code works. It's been tested thousands of times at this point. So something is off in yours but I'm not sure what. If you can be more specific, i may be able to help.
When I run flask run and click on the thhif file, it shows up on the website but it doesn't have a register or quote or buy or sell. The entire website is still the same as when I first opened the source code. Thank you bro.
@@RealisticResponse
When I followed you, you watched the video details, but after the code was finished, it was not linked together, what should I do? Please help.
@@RealisticResponse
what is the grand_total variable for in the index function?
A previous version I wrote. It doesn't serve a purpose. I was going in a different direction and left it in. but it is a dead line of code so shouldn't impact yours if you do not use. This video took so long to do, removing something I didn't end up using in the end became to tedious so it died in-line.
Am I the only one who is getting:
:( logging in as registered user succceeds
expected status code 200, but got 404
in check50?
Let me know if you still need help sorry for delay. Back now.
Thank you so much for your video it was helpful. I am having an issue with My login, it returned an error saying expected a 200 status code but got a 400 status code.
What can I do
Same
Do you got any solution
I also need help... been on that error for a week now
@@preciousadedamola8294 this is too vague i dont know where your error is. 400 means bad request. but i'm not sure where you're getting it. this is a whole application. the 400 could be getting thrown anywhere.
@@fantasticearner3415 @preciousadedamola8294 this is too vague i dont know where your error is. 400 means bad request. but i'm not sure where you're getting it. this is a whole application. the 400 could be getting thrown anywhere.
Hello i think i need your help, i did the code exactly like yours , but it gives me a error message saying " expected to find "9,888.00" i page, but it wasnt found" (i did exactly like yours because with my changes to your code it gave me the same error message) any help?
I mention this 3 times in the video and in the description and in many, many comments. Its a very simple feature that I left out on purpose but if you read through some comments here you'll find the help you need to solve.
buy said symbol not found :( buy handles valid purchase
expected to find "112.00" in page, but it wasn't found
Did you ever find a solution?Im having the same issue
nvm I found the issue. I'm sure that you have already fixed it, but for anyone struggling in the future, you need to make sure that your index uses the "usd" function. {{ stock.price | usd }}
{{ (stock.price * stock.total_shares) | usd }}
@@ext1nct297 i have the same issue for days now...When you say "index" you mean that it needs to be displayed in usd format on the main page where index table is shown?
You found the hidden key! Great work @ext1nct297 well done!
He means the code on the index page needs to be converted to usd - I mention it several times in the video and in the description and multiple comments. convert your totals to usd and you'll be good to go
hey there Devin! I really appreciate your work but I'm having a tiny problem in my register function. I don't know why but my register wont work like it wont register if I try. Is there a solution to my problem?
Hi! I'm certain there's a fix but this problem is too general. I can't identify the issue just by knowing there's a problem. It seems pretty straight forward that the issue is in the register function or html but I couldn't say where. Also possible the sql file is corrupt - this happens from time to time
thank you I was able to find the problem
I have a problem with the API key. The register page of IEX cloud simply dont load!!!
I dont think 2024 is requiring the api key - can you tell me abit more?
Hi you have been so helpful. Thank you for your help during this process. I am getting so close to finally finishing up and sadly im not able to get thought the problem of this last code. it keep coming up ":( logging in as registered user succceeds application raised an exception (see the log for more details)" not sure what that problem could be. could you help?
This is a unique issue. possibly a flask issue - when you're running the application - your codespace should be showing a running log. is there anything in the log that shows what the error is? It could be flask, sql, or app.py but i dont have enough info to know based on this.
Hey I encountered an error and not able to resolve it on my own can any one help me.
The error is
:( buy handles valid purchase
Cause
expected to find "9,888.00" in page, but it wasn't found
Log
sending GET request to /signin
sending POST request to /login
sending POST request to /buy
checking that "112.00" is in page
checking that "9,888.00" is in page
This is a COMMON question. Please see details and pinned notes. In the video I mention I did NOT solve this and its up to you to complete the app.py to get the digits of the numbers on your login screen down to 2 decimal places. You can use FLOAT or the built in USD or anything similar but you need to get the monies down to 2 decimal points to complete this task. Its mentioned in the video a few times and in notes I left on cideo
@@RealisticResponse Thanks for informing I eventually solved this problem by FLOAT logic. Thanks for this tutorial It helped a lot.
@@akashvasava8243 EXCELLENT! well done!
Hey, I ran check50 and got the following
:( registering user succeeds
IndexError: list index out of range
:( registration rejects duplicate username
IndexError: list index out of range
I don't understand this error, could you help?
index out of range
Go through your app.py and look at the SQL Commands.
# Query database for username
rows = db.execute("SELECT * FROM users WHERE username = ?", request.form.get("username"))
my friend, please I beg you, to make a video, step by step on how to do this problem 9, I really can't do it
Hey Garbson. This video is the best I can do. It solves everything except converting money to 2 decimal places which is a task anyone on week 9 should be able to handle. This video took hours of prep testing work and editing. It is the final video for this particular problem set that I'll be making. This video is a walk thru and explains concepts. I apologize if it's not working for you. Its literally the best I could do with what I had.
i am having a error with my check50 it says that "unknown file type......skipping" to all html and css files.sir can you please help me this?
and my finance is working fine.
it is also saying that can't check a frown until it turns upside down
please sir please help me with this
The only thing that I think could be wrong is your file extensions and/or locations.
you need to make sure all html files are labeled ".html" and are nested inside the "templates" folder. you need to make sure your .css file is labeled as such and is nested in your "static" file folder.
The only thing I can think is that your files and folders are likely labeled wrong or messed up somehow.
@@RealisticResponse a lot thanks sir I fixed and got my certificate🥰🥰
@@ritvanriteshpartapsingh174 WELL DONE!!!! Congrats!!!! I'm happy for you and good job sticking to it!
Could you update the video, please? I have been issues with my code on July
Last I ran this code it cleared all green - I've run it thousands of times now. It will get an update in 2025 as it seems to still work. This particular video is a huge undertaking. Perhaps if you elaborate the problem I can assist.
I need help related to finance project please reply me 🙏
Hi so for the sell function it tells me that it didn't return a valid response, it either returned none or ended without a return
statement. I don't get what it means by "the view function"? What do you think I could have done wrong?
Ok this is a big one but could be something small.
That error might mean that the sell either returning None explicitly (like using the return None statement) or ending without a return statement.
The sell function should have two main branches:
one for handling the form submission (POST request)
one for rendering the initial page (GET request).
The problem might be occurring if the function reaches the END of the else block without returning anything.
One possible fix is, add a return statement at the end of the ELSE block to ensure that the function returns a response in all cases.
So you might check the
return apology
or otherwise the
return render template
make sure they're in the right loops
unlikely but possible is the
return redirect. Here's a snippet of the possible location of the code:
return redirect("/")
return apology("symbol not found")
# If the user visits the page
else:
return render_template("sell.html", stocks=stocks)