Question: How to develop a class named stock tracker that takes the definitions: The constructor "StockTracker ()" creates an initially empty StockTracker object buy(quanity, price) method performs a purchase transaction. Quantity should be a positive integer and price should be a positive floating point value.
A ValueError will be raised if any of these conditions is not satisfied sell(quanity,price) method performs a sell transaction. Quantity should be a positive integer and price should be a positive floating point value. Also the quantity to sell must be equal to or less than the total number of shares on hand. A ValueError will be raised if any of these conditions is not satisfied.
It returns the gain (or loss) for this particular transaction. getProfit () method returns the total gain (or loss) since the creation of the object getQuantityOnHand () method the quantity of shares on hand how to develop a class named stock tracker that takes the definitions: The constructor "StockTracker ()" creates an initially empty StockTracker object buy(quanity, price) method performs a purchase transaction.
Quantity should be a positive integer and price should be a positive floating point value. A ValueError will be raised if any of these conditions is not satisfied sell(quanity,price) method performs a sell transaction. Quantity should be a positive integer and price should be a positive floating point value.
Also the quantity to sell must be equal to or less than the total number of shares on hand. A ValueError will be raised if any of these conditions is not satisfied.
It returns the gain (or loss) for this particular transaction. getProfit () method returns the total gain (or loss) since the creation of the object getQuantityOnHand () method the quantity of shares on hand