Skip to main content
added 454 characters in body
Source Link
Cliff B
  • 69.3k
  • 4
  • 33
  • 56

It looks like stock is the symbol for the stock in the database, and it is being assigned to both the name and symbol.

for purchase in purchases:
    stock = purchase["stock"]
    ...
    purchase['symbol'] = purchase['stock']

I don't see anywhere in the code where the actual symbolstock name is retrieved from the database or anywhere else.

The choice of field names is ambiguous. By using "stock", it is intuitively ambiguous whether the field contains the stock's name or symbol. Renaming the vars and database field names to 'symbol' and 'stock_name' would be far more intuitive and clear about their contents and would eliminate any ambiguity of what the data represents.

Unlikely, but it would also be worthwhile to check that the stock symbol isn't being stored in the stock name field in the database.

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance.

It looks like stock is the symbol for the stock in the database, and it is being assigned to both the name and symbol.

for purchase in purchases:
    stock = purchase["stock"]
    ...
    purchase['symbol'] = purchase['stock']

I don't see anywhere in the code where the actual symbol is retrieved from the database or anywhere else.

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance.

It looks like stock is the symbol for the stock in the database, and it is being assigned to both the name and symbol.

for purchase in purchases:
    stock = purchase["stock"]
    ...
    purchase['symbol'] = purchase['stock']

I don't see anywhere in the code where the actual stock name is retrieved from the database or anywhere else.

The choice of field names is ambiguous. By using "stock", it is intuitively ambiguous whether the field contains the stock's name or symbol. Renaming the vars and database field names to 'symbol' and 'stock_name' would be far more intuitive and clear about their contents and would eliminate any ambiguity of what the data represents.

Unlikely, but it would also be worthwhile to check that the stock symbol isn't being stored in the stock name field in the database.

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance.

Source Link
Cliff B
  • 69.3k
  • 4
  • 33
  • 56

It looks like stock is the symbol for the stock in the database, and it is being assigned to both the name and symbol.

for purchase in purchases:
    stock = purchase["stock"]
    ...
    purchase['symbol'] = purchase['stock']

I don't see anywhere in the code where the actual symbol is retrieved from the database or anywhere else.

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance.