Question: ****need help with this in PYTHON DIRECTIONS Many investment management companies are switching from manual stock trading done by humans to automatic stock trading by

****need help with this in PYTHON

****need help with this in PYTHON DIRECTIONS Many investment management companies areswitching from manual stock trading done by humans to automatic stock tradingby computers. Youve been tasked to write a simple automatic stock trader

DIRECTIONS Many investment management companies are switching from manual stock trading done by humans to automatic stock trading by computers. Youve been tasked to write a simple automatic stock trader function that determines whether to buy, sell, or do nothing (hold) for a particular account. It should follow the old saying "Buy low, sell high!" This function takes 4 input parameters in this order: 1. current_shares - current number of shares of this stock in the account (int) 2. purchase_price - price (per share) paid for current stock in the account (float) 3. market price current market price (per share) of stock in the account (float). available_ funds- maximum amount the client is willing to spend on a stock purchase (float). Any transaction (buy or sell) costs $10. This $10 must be paid out of the available_funds for a purchase, or out of the proceeds of a stock sale. Be sure to account for this fee in your profit calculations. A purchase would be considered profitable when the current market price is lower than the purchase price, and the available funds will allow us to buy enough shares so that the difference in value will cover the $10 transaction fee. In this case the function should return the string "Buy # shares" where # is an integer representing the number of shares to purchase. A sale would be considered profitable when the current market price is higher than the purchase price, and the value gained by selling the shares will cover the $10 transaction fee. In this case the function should return the string "Sell # shares" where # is an integer representing the number of shares to sell If neither a buy nor a sell would be profitable, then the function should return the string "Hold shares." Here are some test cases that your function should satisfy

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!