👨💻 Learn How to Code with Private Classes - www.dorscodingschool.com/coachingplans ❓Having a hard time with CS50, FreeCodeCamp or Odin Project? Practice with our exclusive free coding platform: www.codingdors.com/ 🎯 Are You A Coding Expert? Take Our Free Quiz and Find Out - www.dorscodingschool.com/quiz
@@DorsCodingSchool Please add chapters , it's a crucial thing in a very long video like this. Sometimes we miss something in the code and it's ultimately difficult to check it's place in the video. Appreciate it
I think there might be an issue with the index function. In your implementation you retrieve the price of the stocks from the transactions table, but that's the fixed price at which the stock was traded. You should instead send api request to the provider to retrieve the current prices for your stocks to keep the value of the portfolio up to date. Apart from that the tutorial is very useful and beginner friendly, thank you very much!
Thank you for the message! We'll take a look! By the way, we have a Telegram Group to help people learn how to code and where you can connect with learners from all over the world. Over there you can ask any question about programming and you can easily get your questions answered within 24 hours. Besides that, you will have access to our membership with more than 400 problems made by us to ease your learning curve and 2 hours of group coaching every week! Check www.dorscodingschool.com/products
At your index page, the PRICE is the prices of the stocks when you made the purchase, but I think it should be the current price of the stocks, so you shouldn't pull out the price from transaction table.
Thank you for the hint. We will take a look! By the way, we have a Telegram Group to help people learn how to code and where you can connect with learners from all over the world. Over there you can ask any question about programming and you can easily get your questions answered within 24 hours. Besides that, you will have access to our membership with more than 400 problems made by us to ease your learning curve and 2 hours of group coaching every week! Check www.dorscodingschool.com/products
@@jamarwilson3592You can make a dictionary in index() that has key of the stock symbol and value of the lookup function for that symbol(you can use dict comprehension to achieve this easily). It will work because lookup(symbol) will always return a current price since it connects with the stocks website via given API. After you completed the dictionary of prices you can use it in jinja for loop. There are probably better ways to do this but this works as promised but it's kinda slow. Hope that helps for your or anybody interested.
Thank you for this amazing video, have been stuck in this task for days going crazy over the errors. This was very helpful thank you very much, saved my life fr. Keep it going love your videos!!!!! :))))
Thanks a lot, there were many things that was not getting clear to me, but your tutorial really helped me. I wish you bright future ahead as you have developed really good skills . and thanks once again.
For the index page. I belive you are supposed to a) use current prices of the stock b) calculate the grand total (cash + sum of all the in order to calculate the portfolio value. I was able to do a). But I just could not get b) to work.
just a quick question why do you choose to use "Get" instead of "Post" as the specification was explicit to Submit the user’s input via POST to /register. in any case, your videos are very much on point thanks for sharing
In the SQL at 1:21:00, it should be "SELECT SUM(shares) AS shares FROM transactions WHERE user_id=:id AND symbol = :symbol" instead of "SELECT shares FROM transactions WHERE user_id=:id AND symbol = :symbol GROUP BY symbol"
But ("SELECT SUM(shares) AS shares FROM transactions WHERE user_id = ? AND symbol = ?", user_id, symbol) is correct, too? I am not quite sure with user_id = [...] user_id.
I don't understand where you got the phpLiteAdmin. The cs50 codespace where you're supposed to code doesn't allow that nor is there anything resembling that. Do I have to have that or no?
Thank you for your video! It's great! I have a problem when I'm testing with CS50 buy fails to pass the fractions, negative and non-numeric check. Can anyone help me?
I had the same issue. I tried doing the basic "if shares < 0 approach", and when checking the log for the error it said "exception raised in application: ValueError: invalid literal for int() with base 10: '1.5'" I think this is because of how int treats special characters, in this case the decimal point. I ended up getting past the issue with a try catch. It tries to run the the function with shares but if it catches anything funky it throws a 404. It's probably too late for you, but hopefully this comment helps someone else in our position.
In the register section, how does your try except prevent to encode multiple times the same username ? There is nothing that block encoding multiple times the same username as you don't check for an already existing one in the database. You can encode lot of same username if you want.
We’d love to help you more. Did you know you can join our Discord Group and get help from me and from people around the world that are also learning how to code? dorscodingschool.com/discord
@@A-Karim2003 Oh a lot ! I did a one year course IRL on web development, and then after I specialized in C#/.NET, and now I quit programming cause there is no hope to find a job as as a junior. Almost 2 years lost, cool.
Are you getting the symbol from html and checking if exists in your app.py? We’d love to help you more. Did you know you can join our Discord Group and get help from me and from people around the world that are also learning how to code? dorscodingschool.com/discord
how do i get the name of the stock/symbol in portfolio, for example under symbol we get NFLX and i want a row with name that gives Netflix Inc? and how do i add the cash in portfolio cus for now we have only total.
We’d love to help you more, I believe in here it might be complicated to help because your question is a bit complex. Did you know you can join our Free Discord Group and get help from me and from people around the world that are also learning how to code? dorscodingschool.com/discord
It's the file where you store your database. You need it to pass :) We’d love to help you more. Did you know you can join our Free Discord Group and get help from me and from people around the world that are also learning how to code? dorscodingschool.com/discord
You should use the sessions["user_id"]. By the way, we have a Telegram Group to help people learn how to code and where you can connect with learners from all over the world. Over there you can ask any question about programming and you can easily get your questions answered within 24 hours. Besides that, you will have access to our membership with more than 400 problems made by us to ease your learning curve and 1 hour of group coaching every month! Check www.dorscodingschool.com/products
Are you subtracting the number of shares in your sell route? By the way, we have a Telegram Group to help people learn how to code and where you can connect with learners from all over the world. Over there you can ask any question about programming and you can easily get your questions answered within 24 hours. Besides that, you will have access to our membership with more than 400 problems made by us to ease your learning curve and 1 hour of group coaching every month! Check www.dorscodingschool.com/products
We’d love to help you more. Did you know you can join our Discord Group and get help from me and from people around the world that are also learning how to code? dorscodingschool.com/discord
To display the value of a variable in HTML, you should use: {{ var }} If you want our help, you can join our Free Discord Community: www.dorscodingschool.com/discord
Hi! I have a question 🙋 when executing the flask run it gives me this error "WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead." what should I do?
hi, thank you for the great explaining , but when i run flask run in my turminal window it give me a bug says that it is in use with another program i tried to close the web-page and clear my window and run again with the same bug, how can ifix this bug?
We’d love to help you more. Did you know you can join our Free Discord Group and get help from me and from people around the world that are also learning how to code? dorscodingschool.com/discord
Everything seem to be working fine but when I try to check with check50, it says "exception raised in application: ValueError: invalid literal for int() with base 10: '1.5' ", do you know how I should fix this?
The problem is that you need to convert your shares into an int and check if that's not an integer before you continue your code. We’d love to help you more. Did you know you can join our Free Discord Group and get help from me and from people around the world that are also learning how to code? dorscodingschool.com/discord
@@DorsCodingSchool I did set "shares = int(request.form.get("shares"))". Also I tried to enter 1.5 on the buy page, it will have a little notification say "Enter a valid value" just like the sample page CS50 provided. Really confused on what could be the issue here.
@@lucyjohns8694 Hey yo, I also just had this error and was able to fix it. The thing when inserting nothing in an integer it takes it as a Value Error , in this case when leaving blank the shares in either buy or sell, therefore what you can do is a try and except method and doing what you want afterwards.
hi, for /buy. I keep getting an error exception raised in application: TypeError: 'int' object is not subscriptable but I don't know what this means or how to solve it. Can someone help? Thank you!!
at 41:47 , can u pls explain how you have got user id just by sessions[" user_id "]--- but in /login route they have got user id by executing db command. so are you using this " sessions[" user_id "] ".
when click "Register" I get a massage "internal error" instead " TODO 405" saying "jinja2 exemption template not found:Register. html. So I cannot proceed as i do not get screen "sell buy ...." "log out" How can I correct this please.
Thank you so much for all of this effort. Your explanations and videos have been getting better with each pset. Can you please explain the purpose of line 242 user_shares_real = user_shares[0][“shares”] Thanks
@@DorsCodingSchool I think I understand. Would you get the same answer by changing your SQL code to: ("SELECT SUM(shares) FROM transactions WHERE user_id=? AND symbol=?", user_id, symbol) and then eliminating the second line? I understand that there are many ways to solve the same problem but if the answer is the same then I think I understand the code. Thanks for replying
oh wait, i ran it in sqlite3 and i get the answer like this: ________ shares ________ 4 ________ So are we saying that I need the first result of this (0) where the title is "shares"?
Why in this problem we got an error after check50 Which is excepted to find 112.00 in page but it wasn't found What's that mean and how to solve this 🤔
At 32:50 does anyone else have a > appear after each line as well? Does anyone know why that is and how it can be fixed? Edit: Does anyone else fail about half of the tasks when running check50?
We’d love to help you more. Did you know you can join our Discord Group and get help from me and from people around the world that are also learning how to code? dorscodingschool.com/discord
Both syntax are the same ;) You can select what you prefer! By the way, we have a Telegram Group to help people learn how to code and where you can connect with learners from all over the world. Over there you can ask any question about programming and you can easily get your questions answered within 24 hours. Besides that, you will have access to our membership with more than 400 problems made by us to ease your learning curve and 1 hour of group coaching every month! Check www.dorscodingschool.com/products
Deleted the project at the very end for the 3rd time now. please explain how you implemented the two places past the decimal where it shows monetary value on any part of the webpage.
You should implement USD() every time you're adding prices to your transactions table. Don't use the USD() when adding cash to your users table. For example, price=usd(price).
You should double-click your finance.db and then you're able to create a new table. By the way, we have a Telegram Group to help people learn how to code and where you can connect with learners from all over the world. Over there you can ask any question about programming and you can easily get your questions answered within 24 hours. Besides that, you will have access to our membership with more than 400 problems made by us to ease your learning curve and 1 hour of group coaching every month! Check www.dorscodingschool.com/products
"exception raised in application: TypeError: unsupported format string passed to Undefined.__format__ " I get this error and can't find out whta is causing it!!! any help?
This error message is too open. We are able to help you if we see your code and what you did. If you want, you can join our Discord Community :) Check out: www.dorscodingschool.com/discord
We’d love to help you more. Did you know you can join our Discord Group and get help from me and from people around the world that are also learning how to code? dorscodingschool.com/discord
Can anyone help me? I got an error message with the db.execute("INSERT INTO transactions (user_id, symbol, shares, price, date) VALUES (?, ?, ?, ?, ?)", user_id, symbol, shares, price, date) the error says: "price" is not defined I created a table in the database and all the other values seem to be working just fine. I tried to change the data type to Numeric, Float, and Real but this error keeps showing up
Do you have a variable in app.py called price? By the way, we have a Telegram Group to help people learn how to code and where you can connect with learners from all over the world. Over there you can ask any question about programming and you can easily get your questions answered within 24 hours. Besides that, you will have access to our membership with more than 400 problems made by us to ease your learning curve and 1 hour of group coaching every month! Check www.dorscodingschool.com/products
You should click the DB file and it will open up the phpadmin for you (: By the way, we have a Telegram Group to help people learn how to code and where you can connect with learners from all over the world. Over there you can ask any question about programming and you can easily get your questions answered within 24 hours. Besides that, you will have access to our membership with more than 400 problems made by us to ease your learning curve and 2 hours of group coaching every week! Check www.dorscodingschool.com/products
at 42:27 gio says you can do id = ? or id = :id. I received a runtime error when I used id = ? so for future reference use the :id to avoid bugs :) hope this helps someone!
Hello, pls i don't know if anyone can help me with this. On 1:16:34 when i entered "flask run" it's telling me "API_KEY not set". please what should i do ?
Every time you're working with your project you have to put your api key before running flask. You should follow the "Background" section at cs50.harvard.edu/x/2023/psets/9/finance/
The code gives me two errors :( "registering user succeeds application raised an exception (see the log for more details)" "registration rejects duplicate username application raised an exception (see the log for more details)" idk what to do :((
This error is too open. You should check the log for more details. There are some problems that we can only help you if we see your code and understand what you thought about when solving :/
Hello there! I hope this message find you. I was struggling with the same problem. Here is the solution: username = request.form.get('username') database = db.execute("SELECT * FROM users WHERE username = ?", username) if len(database) != 0: return apology("username already exists")
session["user_id"] = new_user I'm trying to figure out what value the new user variable has from being assign insert sql query, works I just don't know why can anyone help 21:12
You're adding all the data about the user in your session. All data you have about the user is the username, password (hash), id, and cash. The session["user_id"] will give you the id of the user when you're logged in. By the way, we have a Telegram Group to help people learn how to code and where you can connect with learners from all over the world. Over there you can ask any question about programming and you can easily get your questions answered within 24 hours. Besides that, you will have access to our membership with more than 400 problems made by us to ease your learning curve and 1 hour of group coaching every month! Check www.dorscodingschool.com/products
We’d love to help you more. Did you know you can join our Free Discord Group and get help from me and from people around the world that are also learning how to code? dorscodingschool.com/discord
We’d love to help you more. Did you know you can join our Free Discord Group and get help from me and from people around the world that are also learning how to code? dorscodingschool.com/discord
Thank you! I recommend you to do CS50 and CS50 Web to learn how to code. I started to learn how to code in 2020 and I feel pretty familiar with the concepts because of these two courses (: By the way, we have a Telegram Group to help people learn how to code and where you can connect with learners from all over the world. Over there you can ask any question about programming and you can easily get your questions answered within 24 hours. Besides that, you will have access to our membership with more than 400 problems made by us to ease your learning curve and 1 hour of group coaching every month! Check www.dorscodingschool.com/products
hlo please help me i am stuck at week 9 finance only due to non availability of api keys the iex site is removed in 2024 due to the major update in course and dont know how to get an api key please help @ Dors Coding School
👨💻 Learn How to Code with Private Classes - www.dorscodingschool.com/coachingplans
❓Having a hard time with CS50, FreeCodeCamp or Odin Project? Practice with our exclusive free coding platform: www.codingdors.com/
🎯 Are You A Coding Expert? Take Our Free Quiz and Find Out - www.dorscodingschool.com/quiz
I'm just here to comment that, in my case, everything you did worked in my codes. Thanks for the video, it helps me a lot!!!
Glad I could help!
Quote: 32:25
Sell : 1:10:07
History: 1:23:52
Thank you for adding the timestamp, we appreciate it!
@@DorsCodingSchool Please add chapters , it's a crucial thing in a very long video like this. Sometimes we miss something in the code and it's ultimately difficult to check it's place in the video. Appreciate it
I think there might be an issue with the index function. In your implementation you retrieve the price of the stocks from the transactions table, but that's the fixed price at which the stock was traded. You should instead send api request to the provider to retrieve the current prices for your stocks to keep the value of the portfolio up to date.
Apart from that the tutorial is very useful and beginner friendly, thank you very much!
Thank you for the message! We'll take a look!
By the way, we have a Telegram Group to help people learn how to code and where you can connect with learners from all over the world. Over there you can ask any question about programming and you can easily get your questions answered within 24 hours.
Besides that, you will have access to our membership with more than 400 problems made by us to ease your learning curve and 2 hours of group coaching every week!
Check www.dorscodingschool.com/products
@@DorsCodingSchool How can I join the telegram group? I would be very interested in that
I see this and am trying to understand how to request the provider to get current prices. Do you have the solution by anychance?
Thanks for these videos! I watched other youtubers but your videos are the best!
clearest explanations on youtube, and the animations are amazing! keep it up!
Thank you!
Thank you so much Giovanna. Helped me a lot to get through the different requirements. This was a tough one.
At your index page, the PRICE is the prices of the stocks when you made the purchase, but I think it should be the current price of the stocks, so you shouldn't pull out the price from transaction table.
Thank you for the hint. We will take a look!
By the way, we have a Telegram Group to help people learn how to code and where you can connect with learners from all over the world. Over there you can ask any question about programming and you can easily get your questions answered within 24 hours.
Besides that, you will have access to our membership with more than 400 problems made by us to ease your learning curve and 2 hours of group coaching every week!
Check www.dorscodingschool.com/products
So what do you actually do?
@@jamarwilson3592You can make a dictionary in index() that has key of the stock symbol and value of the lookup function for that symbol(you can use dict comprehension to achieve this easily). It will work because lookup(symbol) will always return a current price since it connects with the stocks website via given API. After you completed the dictionary of prices you can use it in jinja for loop. There are probably better ways to do this but this works as promised but it's kinda slow. Hope that helps for your or anybody interested.
Thank you for this amazing video, have been stuck in this task for days going crazy over the errors. This was very helpful thank you very much, saved my life fr. Keep it going love your videos!!!!! :))))
22:47 Quote
32:58 Buy
52:37 Index
Thanks a lot, there were many things that was not getting clear to me, but your tutorial really helped me. I wish you bright future ahead as you have developed really good skills . and thanks once again.
Thank you! We are glad that it helped!
Best programming channel I've ever seen
thank you so much for the content sister. everything is so smooth and clear. i encourage you to do this stuff more.
Thank you, I will!
For the index page. I belive you are supposed to
a) use current prices of the stock
b) calculate the grand total (cash + sum of all the in order to calculate the portfolio value.
I was able to do a). But I just could not get b) to work.
Thank you dear sister, it is so amazing tutorial. I liked it so much. Everything is smooth and easy to understand. Thank you. )
just a quick question why do you choose to use "Get" instead of "Post" as the specification was explicit to Submit the user’s input via POST to /register. in any case, your videos are very much on point thanks for sharing
You should use GET to display the register form in the screen and POST to handle the data from the form and insert in the database
Man can you help me with the IEX Cloud registration, how can i registrer there
In the SQL at 1:21:00, it should be "SELECT SUM(shares) AS shares FROM transactions WHERE user_id=:id AND symbol = :symbol" instead of "SELECT shares FROM transactions WHERE user_id=:id AND symbol = :symbol GROUP BY symbol"
But
("SELECT SUM(shares) AS shares FROM transactions WHERE user_id = ? AND symbol = ?", user_id, symbol)
is correct, too? I am not quite sure with user_id = [...] user_id.
Thank you
I don't understand where you got the phpLiteAdmin. The cs50 codespace where you're supposed to code doesn't allow that nor is there anything resembling that. Do I have to have that or no?
did you find a way how to use that?
You need to click on the database and click ‘load anyway’ phplite admin is one of the options
Thank you❤️…You’re God Sent🎊🙏🏽
When I run check it says
:( buy handles valid purchase
application raised an exception (see the log for more details)
Do you know where I went wrong?
thank you very much this assignment was very challenging but you explained it in a very easy way
Thank you for your video! It's great!
I have a problem when I'm testing with CS50 buy fails to pass the fractions, negative and non-numeric check.
Can anyone help me?
I had the same issue. I tried doing the basic "if shares < 0 approach", and when checking the log for the error it said "exception raised in application: ValueError: invalid literal for int() with base 10: '1.5'"
I think this is because of how int treats special characters, in this case the decimal point. I ended up getting past the issue with a try catch. It tries to run the the function with shares but if it catches anything funky it throws a 404. It's probably too late for you, but hopefully this comment helps someone else in our position.
@@novedekne Thanks for this comment. I stack with this errors for days and your comments finally help me.
Thank you Gio for this video, great job keep it up!
Your video was very helpful to me!😁
I realy like your exeplanation
Great video and explanation. How did you use phpliteadmin inside vscode?
Thank you so much!
2024. I have a problem with the API key. The register page of IEX cloud simply dont load!!!
i think we don't need to use API key any more.!
Do we not need an API key anymore? Could you please explain why im kinda confused. Much thanks
Same, but do we need to use the API key in 2024?
I have an error trying to get a quote. Any symbol I enter outputs none and so it shows as invalid
thank you so much!
Great explanations. I am not seeing the $ before the dollar amounts. What am I missing in the code?
best in the west
thank you
In the register section, how does your try except prevent to encode multiple times the same username ? There is nothing that block encoding multiple times the same username as you don't check for an already existing one in the database. You can encode lot of same username if you want.
We’d love to help you more. Did you know you can join our Discord Group and get help from me and from people around the world that are also learning how to code? dorscodingschool.com/discord
@@DorsCodingSchool why would I join anything if you don't answer when I point an error ?
@@SirMika9 lol. what did you end up doing after cs50
@@A-Karim2003 Oh a lot ! I did a one year course IRL on web development, and then after I specialized in C#/.NET, and now I quit programming cause there is no hope to find a job as as a junior. Almost 2 years lost, cool.
Muito obrigada!!!! Ajudou demais!
you're so amazing. I failed at finance..
very complete, very well explained, i thank you so much !
39:46 Is it necessary to create the table like you have done, as this is not like that in VS Code...
You can create the same way. Just need to double click the file finance.db and click the hyperlink
@@DorsCodingSchool it doesnt work for me
@@tanaysethi18 i just typed the sql querie inside the command line.
you don't need to use the website.
Getting error message under quote, code is unable to pick up symbols, getting 400 "Must provide Symbol" error message, please help
Are you getting the symbol from html and checking if exists in your app.py?
We’d love to help you more. Did you know you can join our Discord Group and get help from me and from people around the world that are also learning how to code? dorscodingschool.com/discord
how do i get the name of the stock/symbol in portfolio, for example under symbol we get NFLX and i want a row with name that gives Netflix Inc? and how do i add the cash in portfolio cus for now we have only total.
We’d love to help you more, I believe in here it might be complicated to help because your question is a bit complex. Did you know you can join our Free Discord Group and get help from me and from people around the world that are also learning how to code? dorscodingschool.com/discord
What is phpliteadmin and do you need it to pass the pset??
It's the file where you store your database. You need it to pass :)
We’d love to help you more. Did you know you can join our Free Discord Group and get help from me and from people around the world that are also learning how to code? dorscodingschool.com/discord
Quick question: How did you get user_id in the transactions table to match id in the users table?
You should use the sessions["user_id"].
By the way, we have a Telegram Group to help people learn how to code and where you can connect with learners from all over the world. Over there you can ask any question about programming and you can easily get your questions answered within 24 hours.
Besides that, you will have access to our membership with more than 400 problems made by us to ease your learning curve and 1 hour of group coaching every month!
Check www.dorscodingschool.com/products
One of the best videos out there, surely helped a lot. But I have a big problem!! The sell actually makes me buy more shares :( can anyone help?
Are you subtracting the number of shares in your sell route? By the way, we have a Telegram Group to help people learn how to code and where you can connect with learners from all over the world. Over there you can ask any question about programming and you can easily get your questions answered within 24 hours.
Besides that, you will have access to our membership with more than 400 problems made by us to ease your learning curve and 1 hour of group coaching every month!
Check www.dorscodingschool.com/products
Maybe I missed it, but shouldn't /index show the current value of each holding = shares * price? I didn't see this implemented in the video.
Yes, you're right! We added a fixed comment on how you can solve it :)
@@DorsCodingSchool where is this comment?
i have a problem with the lookup function. it keep showing me (symbol does not exists ) when i quote NFLX. any help ?
We’d love to help you more. Did you know you can join our Discord Group and get help from me and from people around the world that are also learning how to code? dorscodingschool.com/discord
Does this code actually update the stock values after they've been bought?
Yes, it does!
Hi! This may be a silly question, but can you please tell me where you implement the value of the symbol in the table that shows Netflix? Thanks
To display the value of a variable in HTML, you should use:
{{ var }}
If you want our help, you can join our Free Discord Community: www.dorscodingschool.com/discord
Hi! I have a question 🙋 when executing the flask run it gives me this error "WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead." what should I do?
If you want, you can join our Free Discord Community: www.dorscodingschool.com/discord
THANK YOU SO MUCH!!!!
hi, thank you for the great explaining , but when i run flask run in my turminal window it give me a bug says that it is in use with another program i tried to close the web-page and clear my window and run again with the same bug, how can ifix this bug?
TY So much Gio, this was so helpful for me.
Glad it helped!
Thank you for this video, it's so useful.🙏🙏🙏
You're welcome 😊
But the index page should print out current_price, insead of the price recorded in transaction.db right?
You're right. It should print out the current price. By the time we didn't notice that :/
Thank you for your message!
@@DorsCodingSchool Good to know. Thanks!
CREATE TABLE transactions (user_id AUTOINCREMENT NOT NULL, symbol TEXT, shares INTEGER, price INTEGER, date DATE);
What is the problem in this query?
We’d love to help you more. Did you know you can join our Free Discord Group and get help from me and from people around the world that are also learning how to code? dorscodingschool.com/discord
oi Geovana tudo bem?, por favor me ajude, nao estou conseguindo solucionar esse problema
Everything seem to be working fine but when I try to check with check50, it says "exception raised in application: ValueError: invalid literal for int() with base 10: '1.5' ", do you know how I should fix this?
The problem is that you need to convert your shares into an int and check if that's not an integer before you continue your code.
We’d love to help you more. Did you know you can join our Free Discord Group and get help from me and from people around the world that are also learning how to code? dorscodingschool.com/discord
@@DorsCodingSchool I did set "shares = int(request.form.get("shares"))". Also I tried to enter 1.5 on the buy page, it will have a little notification say "Enter a valid value" just like the sample page CS50 provided. Really confused on what could be the issue here.
@@lucyjohns8694 Hey yo, I also just had this error and was able to fix it. The thing when inserting nothing in an integer it takes it as a Value Error , in this case when leaving blank the shares in either buy or sell, therefore what you can do is a try and except method and doing what you want afterwards.
@@DarkkneZPanda Thank you for sharing!
hi, for /buy. I keep getting an error
exception raised in application: TypeError: 'int' object is not subscriptable
but I don't know what this means or how to solve it. Can someone help? Thank you!!
If you check our solution on GitHub we fixed this issue! You have to do a try/except block ☺️
@@DorsCodingSchool how do i get the solution on github?
how do you open phpliteadmin?
Thank you so much, this was a great video
You're welcome!
at 41:47 , can u pls explain how you have got user id just by sessions[" user_id "]--- but in /login route they have got user id by executing db command. so are you using this " sessions[" user_id "] ".
We are using sessions, that was set in the login route
when click "Register" I get a massage "internal error" instead " TODO 405" saying "jinja2 exemption template not found:Register. html. So I cannot proceed as i do not get screen "sell buy ...." "log out" How can I correct this please.
Thank you so much for all of this effort. Your explanations and videos have been getting better with each pset.
Can you please explain the purpose of line 242
user_shares_real = user_shares[0][“shares”]
Thanks
To get exactly the number of shares, because the db will return you a dictionary with key "shares" and value of how many shares you have
@@DorsCodingSchool I think I understand. Would you get the same answer by changing your SQL code to: ("SELECT SUM(shares) FROM transactions WHERE user_id=? AND symbol=?", user_id, symbol) and then eliminating the second line? I understand that there are many ways to solve the same problem but if the answer is the same then I think I understand the code. Thanks for replying
oh wait, i ran it in sqlite3 and i get the answer like this:
________
shares
________
4
________
So are we saying that I need the first result of this (0) where the title is "shares"?
Why in this problem we got an error after check50
Which is excepted to find 112.00 in page but it wasn't found
What's that mean and how to solve this 🤔
hey yo, I'm having the same problem. Were you able to find the solution?
@@DarkkneZPanda did you find it?
Hi after i was done implementing the buy route, i get an error saying jsonify is not defined...why that?
You should import the jsonify library at the top of your code. You can do that by adding:
from flask import jsonify
@@DorsCodingSchool Thanks
At 32:50 does anyone else have a > appear after each line as well? Does anyone know why that is and how it can be fixed?
Edit: Does anyone else fail about half of the tasks when running check50?
Our GitHub contains the correct implementation to pass all the tests :) You can find it at dorscodingschool.com/ebook
@Dors Coding School I tried doing that last week, but I never received a confirmation email.
in the index section how to do the total not the total of the table I mean the total = cash + totals
We’d love to help you more. Did you know you can join our Discord Group and get help from me and from people around the world that are also learning how to code? dorscodingschool.com/discord
greatly explained great content!!
Glad you liked it!
In my database, the date shows hours, minutes, and seconds also, how can I ignore them and just show the date?
It depends on what type you're using to store date and how are you receiving the current date.
jsonify() does not work for me:
NameError: name 'jsonify' is not defined
So I just printed it and checked that way
Great. If you want to use jsonify you need to import at the top of the code :)
I dont know what the syntax id = :id mean what is that different from "?" 1:21:23
Both syntax are the same ;) You can select what you prefer!
By the way, we have a Telegram Group to help people learn how to code and where you can connect with learners from all over the world. Over there you can ask any question about programming and you can easily get your questions answered within 24 hours.
Besides that, you will have access to our membership with more than 400 problems made by us to ease your learning curve and 1 hour of group coaching every month!
Check www.dorscodingschool.com/products
Deleted the project at the very end for the 3rd time now. please explain how you implemented the two places past the decimal where it shows monetary value on any part of the webpage.
You should implement USD() every time you're adding prices to your transactions table. Don't use the USD() when adding cash to your users table. For example, price=usd(price).
did you figure it out?
When I compile the code I have this error showing like buy handles valid purchase expected to find ‘112.00’ in page but it wasn’t found any idea??
I got it now it’s asking me to include placeholder for shares and symbol and price in flask both bought and sold
@@vlogs_by_matthew how did you resolve the 112.00 problem?
What am i supposed to do in 40:04 ? I am in the new environment in VS Code and i cant code a new table
You should double-click your finance.db and then you're able to create a new table. By the way, we have a Telegram Group to help people learn how to code and where you can connect with learners from all over the world. Over there you can ask any question about programming and you can easily get your questions answered within 24 hours.
Besides that, you will have access to our membership with more than 400 problems made by us to ease your learning curve and 1 hour of group coaching every month!
Check www.dorscodingschool.com/products
"exception raised in application: TypeError: unsupported format string passed to Undefined.__format__ "
I get this error and can't find out whta is causing it!!! any help?
it's in the buy part
This error message is too open. We are able to help you if we see your code and what you did.
If you want, you can join our Discord Community :)
Check out: www.dorscodingschool.com/discord
why you multiplied (-1) to shares in the sql statement
To represent that the user sold the shares (:
@@DorsCodingSchool ya i figured that out afterwards, thanks
@@mohitsharma-ep9iy You're welcome!
why are you using GET method in sell?
Because you have to display the screen that the user will sell his items. Otherwise, you're not able to show the form in your page.
Why am I getting Error Forwarding port :(( when I flask run the code
We’d love to help you more. Did you know you can join our Discord Group and get help from me and from people around the world that are also learning how to code? dorscodingschool.com/discord
Can someone help me understand why uptd_cash was used and then not defined later?
Can anyone help me? I got an error message with the db.execute("INSERT INTO transactions (user_id, symbol, shares, price, date) VALUES (?, ?, ?, ?, ?)", user_id, symbol, shares, price, date) the error says: "price" is not defined
I created a table in the database and all the other values seem to be working just fine. I tried to change the data type to Numeric, Float, and Real but this error keeps showing up
Do you have a variable in app.py called price?
By the way, we have a Telegram Group to help people learn how to code and where you can connect with learners from all over the world. Over there you can ask any question about programming and you can easily get your questions answered within 24 hours.
Besides that, you will have access to our membership with more than 400 problems made by us to ease your learning curve and 1 hour of group coaching every month!
Check www.dorscodingschool.com/products
@@DorsCodingSchool I do not. I also tried using another name for the DB column, but the problem persists
In this video you are not returning apology when user does not select symbol in sell section?
Yes, you should return apology if the user doesn't select a symbol
how do i open the phpadmin tab
You should click the DB file and it will open up the phpadmin for you (:
By the way, we have a Telegram Group to help people learn how to code and where you can connect with learners from all over the world. Over there you can ask any question about programming and you can easily get your questions answered within 24 hours.
Besides that, you will have access to our membership with more than 400 problems made by us to ease your learning curve and 2 hours of group coaching every week!
Check www.dorscodingschool.com/products
at 42:27 gio says you can do id = ? or id = :id. I received a runtime error when I used id = ? so for future reference use the :id to avoid bugs :) hope this helps someone!
Did you add the variable that holds the id after the sql command?
Same here. Said I had more values that ? for that was here is my code:
userCashDb = db.execute("SELECT cash FROM users WHERE id = (?)", id=user_id)
i am facing a problem login it show error what part should i fix
If you want our help, you can join our Free Discord Community: www.dorscodingschool.com/discord
Tried to run mine but there's "Attributes Error: SQL object has no attributes execute" in 55:00 . Any help would be appreciated 🙂
Do you have "db = SQL("sqlite:///finance.db")" in your code? It should be around line 37.
@@DorsCodingSchool I have that in line 27
Hello, pls i don't know if anyone can help me with this. On 1:16:34 when i entered "flask run" it's telling me "API_KEY not set". please what should i do ?
Every time you're working with your project you have to put your api key before running flask. You should follow the "Background" section at cs50.harvard.edu/x/2023/psets/9/finance/
@@DorsCodingSchool thanks so much 😊, I was just focused on getting it done and I’ve forgotten about getting the API Token. Thanks so much
The code gives me two errors :(
"registering user succeeds
application raised an exception (see the log for more details)"
"registration rejects duplicate username
application raised an exception (see the log for more details)"
idk what to do :((
This error is too open. You should check the log for more details. There are some problems that we can only help you if we see your code and understand what you thought about when solving :/
Hello there! I hope this message find you. I was struggling with the same problem. Here is the solution:
username = request.form.get('username')
database = db.execute("SELECT * FROM users WHERE username = ?", username)
if len(database) != 0:
return apology("username already exists")
@@GuguG47 It doesn't work :( ¿could I send u the hole code so u can help me better? I really need help with this :((. ¿By your email maybe?
@@giulianaambrosino7944 were you able to figure this out? I have the same thing occurring
session["user_id"] = new_user
I'm trying to figure out what value the new user variable has from being assign insert sql query, works I just don't know why can anyone help 21:12
You're adding all the data about the user in your session. All data you have about the user is the username, password (hash), id, and cash.
The session["user_id"] will give you the id of the user when you're logged in.
By the way, we have a Telegram Group to help people learn how to code and where you can connect with learners from all over the world. Over there you can ask any question about programming and you can easily get your questions answered within 24 hours.
Besides that, you will have access to our membership with more than 400 problems made by us to ease your learning curve and 1 hour of group coaching every month!
Check www.dorscodingschool.com/products
is it possible to download a phpliteadmin in ps code???
We’d love to help you more. Did you know you can join our Free Discord Group and get help from me and from people around the world that are also learning how to code? dorscodingschool.com/discord
How can this bug be fixed? :( buy handles fractional, negative, and non-numeric shares
application raised an exception (see the log for more details)
We’d love to help you more. Did you know you can join our Free Discord Group and get help from me and from people around the world that are also learning how to code? dorscodingschool.com/discord
@@DorsCodingSchool You could just put me through right here lol
can any one help i tried my account and it always show the message of the username or password is invalid
Any idea why this happened when i ran check50......😦 quote handles valid ticker symbol
expected to find "28.00" in page, but it wasn't found
How do i apply the USD filter to the quoted template?
Figured it out
you just have to make use of the usd filter in quoted.html
Great job 👏
@@DorsCodingSchool i have the same problem only this time it is in buy and i already added | usd() in index to ["price"] (line 22) and cash (line 32)
please provide source
Tried to input the code exactly the way you did, but I get a syntax error under the "register" part. Anyone know what's going on?
Let's take a look and get back to you explaining (:
@@DorsCodingSchool Thank you!
@@marlib7 Do you know what line do you get the syntax error?
@@DorsCodingSchool No I don't, I will test everything again and let you know if I find the source of the problem
@@marlib7 I've got the same problem, did you end up finding what was the problem ?
Any advice on how can i become an amazing programmer like you? How many years did it took you to be this good?
Thank you! I recommend you to do CS50 and CS50 Web to learn how to code. I started to learn how to code in 2020 and I feel pretty familiar with the concepts because of these two courses (:
By the way, we have a Telegram Group to help people learn how to code and where you can connect with learners from all over the world. Over there you can ask any question about programming and you can easily get your questions answered within 24 hours.
Besides that, you will have access to our membership with more than 400 problems made by us to ease your learning curve and 1 hour of group coaching every month!
Check www.dorscodingschool.com/products
shall I login with my real account
hlo please help me i am stuck at week 9 finance only due to non availability of api keys the iex site is removed in 2024 due to the major update in course and dont know how to get an api key please help @ Dors Coding School
You don’t need the API key anymore. In their requirements they explain all the steps you should take :)
@@DorsCodingSchool please i couldnt find myself please do help me
52:00
Are u from Brazil?
Yes haha
@@DorsCodingSchool Reconheci pelo sotaque kkkkk muito bom encontrar br pelos cursos cs50
Can you send the solution for the helpers.py and styles.css? I don't see it
We didn't change helpers.py and styles.css when we were coding ;)
check50 is not getting through
this video is good but should remain it is need to use inside usd() function
Thanks for your message, we will fix this problem!
can you explain?