Questions tagged [finance]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
180 views

pset7: ImportError: No module named 'register'

Why does the above error happen? register.html exists, and register() exists. Why would there be no errors for any other html imports? File "/home/ubuntu/workspace/finance/application.py", line 9, ...
0
votes
0answers
2k views

“jinja2.exceptions.UndefinedError: 'grand_total' is undefined” Pset7 Jinja2 and Python error

I'm still working on sell right now. After writing up my code for the route itself and then trying to test it, I found that I had a logic error on index.html and the index route with the USD amount ...
0
votes
1answer
431 views

Jinja2 + Python error “TypeError: non-empty format string passed to object.__format__”

I tried to implement sell, but there's a problem in the index template that came up when the website tried to redirect from sell.html to index.html after the sail of stocks was done. For reference, ...
0
votes
1answer
326 views

pset7 finance app in Python - buy function won't add anything to database!

The code I've written for the parameter checks all works fine, and on clicking the buy button everything seems to work... but then nothing gets added to my database! I've combed through the SQL query ...
0
votes
1answer
724 views

Trouble storing hashed password in database. Pset7 Finance - Register

I am just getting started on my register route in Pset7 and am getting a RuntimeError that I don't understand. Here is my register route code: @app.route("/register", methods=["GET", "POST"]) def ...
0
votes
1answer
112 views

how to link button to the return apology cs50 finance

I am off a bad start on this pset, I understand the general idea but still having some difficulty, for register I want to return the user to apology("must provide username") for example, and I looked ...
0
votes
1answer
701 views

Error messag “TypeError: can't multiply sequence by non-int of type 'float'”

I'm trying to implement index, and I'm having a bit of trouble. When trying to determine the total value of a user's holdings by doing the current price of each stock * the number of shares of stock, ...
0
votes
0answers
111 views

How to check if an SQL table exists without relying on errors?

pset7 help pls. Trying to check if a table exists. I am getting the error "information_schema.tables does not exist". I guess information_schema is not there in our SQL version? How else could I ...
0
votes
1answer
1k views

Here is my code for register in finance pset7 it is giving strange error

When I don't include last two lines in code about"remembering user id" and redirect user to login the code is registering the user successfully into the table but when I enter these two lines in the ...
0
votes
1answer
61 views

Flask column order randomly changes whenever I refresh local host

Whenever, I hit ctrl + s / close and re-open IDE, and then reload my local page for CS50 finance, I seem to experience a very weird issue of randomly changing column order. This happens without me ...
0
votes
1answer
80 views

PSet 7: Issues with flask table output - hint needed

I am trying to produce table headings using loop in flash but I get new lines after each: {% extends "layout.html" %} {% block title %} Portfolio overview {% endblock %} {% block main %} {% ...
5
votes
1answer
4k views

cs50 finance / pset-7 confused on index() table

I am trying to work on pset7, but am having a problem printing it out to the screen in the table format. I have all the values I need (the values I have are correct), but just can't figure out how to ...
0
votes
2answers
60 views

PS7: Please give me a hint on flask loop usage

Despite reading documentation I cannot figure out why my loop is not functioning properly and is only dynamic for stock symbol? Am I meant to be using multiple nested loops passing all prices, holding ...
0
votes
1answer
101 views

pset7: CS50 Finance, ide and flask say syntax is incorrect what am I doing wrong that I don't see?

In the "buy" function of applications.py, no matter what I type, the CS50 IDE and flask both say I have a syntax error in my program. I don't see it and have tried removing parts, checked the syntax ...
0
votes
1answer
54 views

CS50 PSET 7: Can't Get Started (2) [duplicate]

I am supposed to get success upon hitting go on MySQL. I get Error - #1046 - No Database selected. I reloaded the page but nothing changed. http://cdn.cs50.net/2016/x/psets/7/pset7/pset7.html#...
1
vote
1answer
108 views

Can't get to cs50 finance login page?

When I follow the instructions in pset7 and i enter https://ide50-username.cs50.io/ where username is my username i dont get to cs50 finace login page, but instead I get to a page that tells me the ...
1
vote
1answer
31 views

General PSET7 question

I am trying to fully understand what is happening with pset7 and I had some general questions. How does login_form.php (in views) know where (or send the information to) login.php is (under /public/...
1
vote
1answer
240 views

Debugging in Problem Set 7: CS50 Finance

I am in the process of completing Problem Set 7 and I would like to know if there is a better way to debug than using print statements.
0
votes
1answer
139 views

I`m getting a strange error in pset7 register.php

Parse error: syntax error, unexpected '==' (T_IS_EQUAL) in /home/ubuntu/workspace/pset7/public/register.php on line 5 And this line was in distribution code, so I didn`t write anything in this line. ...
1
vote
1answer
93 views

Duplicate entry Error when inserting into portfolios pset7

I am having an issue when inserting a symbol more than once into the portfolio table. I followed pset7 directions making both user_id and symbol as unique: A neat way to impose this restriction ...
0
votes
1answer
51 views

What study material to go through in order to understand CS50.php

I have just got my final scores for my final project and would like to first thank all the members that helped in the last few months, now what next after cs50? I was kind of thinking to master php so ...
0
votes
1answer
790 views

pset7 problem with buy and portfolios table

Hello again! I have a problem concerning my buy.php code. The whole site is ready to launch but I keep having a problem with this particular bug, that I seem to fix every time but it keeps coming ...
0
votes
1answer
173 views

Not being able to access CS50 Finance by https://ide50-username.cs50.io/

After executing all the steps as indicated in the Pset7 Spec I get the following message after trying to get into https://ide50-username.cs50.io/: <?php // configuration require("../includes/...
0
votes
2answers
162 views

pset7: buy.php keeps INSERT-ing the same stock into my database

Like it says on the tin: all of a sudden I can only buy stocks of a single company in pset7. For example, I logged in as John Harvard, and bough 10 shares of Google. I then tried to buy 10 shares of a ...
1
vote
1answer
82 views

Explain the syntax for function render in PSET 7

I don't completely understand this line of render. function render($view, $values = []) I know it passes two arguments, the second is an empty array that you can fill I think? I used this in 'Quote'...
0
votes
0answers
35 views

PSET7 Why can I not select last-child of table?

I am styline portfolio in PSET7. I am trying to select the last row to make it a different background colour but I can't seem to select it? I have tried various different ways but none work. HTML &...
1
vote
3answers
401 views

Problem loading phpMyAdmin

After working on pset7 for about a month now. I have reached a position where I thought that I was making some progress. However, it wasn't to be. When I logged on to my IDE and tried to load ...
0
votes
0answers
27 views

my code takes too long to execute

This loop here takes too long to be executed. Does it mean I am getting into an infinite loop? How can I fix it ? it is suppose to be reading from a csv file and storing them into an array then ...
0
votes
1answer
409 views

When I run my apache50 server at ~/workspace/pset7/public why does login.php files open?

I have a question regarding the working of pset7. I have completed it but now I am scratching my head for this question. When I run my apache50 server like : apache50 start ~/workspace/pset7/public ...
0
votes
1answer
46 views

sell.php doesn't return error when the stocks doesn't exist in the user's portfolio

<?php require("../includes/config.php"); if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST["stock"])) { apologize("You must provide the stock you want to sell."); } ...
1
vote
5answers
676 views

Cannot get started on pset7

I'm having problems with getting started with pset7. firstly, after following the instructions carefully and downloading the files for pset7. I tried accessing the CS50 Finance page within my IDE but ...
1
vote
1answer
61 views

C$50 Finance Pset7 - Buy.php not INSERTing shares correctly

My code for Buy.php. For some reason whenever I fill out both fields of shares and symbol correctly I get the apologize error that the data wasn't inserted into the table correctly. (I don't think I ...
0
votes
2answers
94 views
0
votes
1answer
92 views

Pset7 yahoo finance question

Hello world I have a question concerning pset7. If we get every stock's price through yahoo finance, where does yahho finance get all those information from? What is the main source for stock ...
0
votes
2answers
324 views

Pset 7 | C$50 Finance: query() undefined in register.php

I'm having an issue with register.php. When I try to run the file on my web server and press submit (no matter the inputs) I get this fatal error message: ( ! ) Fatal error: Call to undefined ...
1
vote
1answer
99 views

pset7 (buy): trouble comparing value of transaction with cash

For some reason it is impossible for me to compare the cost of the buy-transaction with the user's cash balance in pset7. $value correctly comes up as a float, but $cash comes up as a string (even ...
0
votes
3answers
100 views

Webdesign (final project question)

so I am having a bit of a problem here with editing my web project. This is my main.php: which is located in /final/public/main.php <?php $path = $_SERVER['DOCUMENT_ROOT']; $path .= "/...
1
vote
1answer
27 views

Confused about Pset7 Distro Code

Currently working through pset7 (Finance) and can't seem to wrap my head around how this piece of code works: $positions = []; //iterate through rows foreach ($rows as $row) { $stock = lookup($...
1
vote
2answers
363 views

Pset7 Finance: register.php gives me an error

Haven't started my implementation of register but I followed the spec up to creating register.php and copying the contents on the specs over. When I navigate to register.php I get this error: Is this ...
1
vote
0answers
368 views

Pset7 Register.php error [duplicate]

I have filled in register_form and register.php (still have not done the //TODO portion). But when I go to my site, and click register, I get two errors: ( ! ) Warning: Unknown: failed to open ...
0
votes
1answer
30 views

Can't access the shares for the portfolio

I have buy and sell implemented and I can successfully use them to buy and sell the shares but I can't make sure the user only sells shares that they have.I get the number of shares to sell from the ...
0
votes
1answer
119 views

CSS Having No Affect in PSET7

I'm trying to left align text in a table in pset7 and none of the CSS code I write in styles.css is having any affect whatsoever. I even went as far as giving an "id" to an individual "td" element and ...
0
votes
3answers
1k views

Finance: Buy/Sell does not insert into MySQL history table

On pset7 and struggling with the history part. When I buy or sell a stock, it's reflected in the portfolio and the cash available is also updated. However, it does not seem to be affecting the ...
0
votes
2answers
409 views

How to use cs50.io IDE for pset7

I have been working on all my cs50 assignments on cs50.io IDE till now expect for pset3. Now for pset7 I am unable to figure how to set up things on the online IDE. Can someone please tell me how to ...
2
votes
1answer
286 views

Not able to access staffs solution for PSET7 CS50 finance. Non connection to YAHOO at line 74

while accessing the staffs solutions, I get this error : Fatal error: Could not connect to Yahoo! in /home/cs50/vhosts/finance.cs50.net/includes/functions.php on line 74. I have already tried from 3 ...
1
vote
1answer
741 views

Extra feature to send receipts - PHP Mailer not connecting

I'm trying to add the feature to send "receipts" after buying and selling stocks. It seems to be very straightforward, I'm just using the code that David used in froshims, but I get the following ...
0
votes
1answer
107 views

pset7(finance) - HTML Validator Error “<th> in table body”

Can somebody please explain to me why I'm getting this error message from the HTML validator? It's telling me I have a "th" tag in my table body but it CLEARLY is in the table head. Why am I getting ...
0
votes
2answers
407 views

pset7(finance) - SQL command will not insert a new row for history

I'm having one last hiccup with my implementation of history. Everything about it works just fine except for the fact that it appears that only one entry can be stored in my SQL table, permanently. ...
0
votes
1answer
160 views

What does VALUES(shares) refer to in the ON DUPLICATE KEY UPDATE clause?

This is the working snippet: query("INSERT INTO portfolio (id, symbol, shares) VALUES(?, ?, ?) ON DUPLICATE KEY UPDATE shares = shares + VALUES(shares)", $_SESSION['id'], $_POST["...
0
votes
1answer
447 views

Non-negative integer check

The spec says to check for a non-negative integer in buy.php by using preg_match("/^\d+$/", $_POST["shares"]). I've tried to understand this expression and have gotten most of it, but would like some ...

1
5 6 7
8
9