Question: I NEED IT IN PYTHON ASAP PLEASEEEE Automatic Stock Trader Many investment management companies are switching from manual stock trading (done by humans) to automatic
I NEED IT IN PYTHON ASAP PLEASEEEE
Automatic Stock Trader
Many investment management companies are switching from manual stock trading (done by humans) to automatic stock trading (done by computers). You've been tasked to write a simple automatic stock trader function that determines whether to buy, sell, or do nothing (hold) shares of a stock for a particular account. It should follow the old saying "Buy low, sell high!"
This function must make the decision (to buy, sell, or hold) based on the following information.
1.Current number of shares of this stock in the account
2.Price (per share) paid for current stock in the account
3.Current market price (per share) of this stock
4. Maximum amount the client is willing to spend on a purchase
Additional information
Any transaction (buy or sell) costs $10. Be sure to account for this fee in your profitability calculations.
In order for a purchase (buy) to be considered profitable, the current market price (per share) must lower than the price (per share) paid for current stock in the account. Additionally, the amount the client is willing to spend on a purchase must allow us to buy enough shares so that the difference in value will cover the $10 transaction fee.
In order for a sale (sell) to be considered profitable, the current market price (per share) must be higher than the price (per share) paid for current stock in the account. Additionally, the value gained by selling the shares must also cover the $10 transaction fee.
If neither a buy nor a sell would be profitable, then we should simply hold the existing shares.
Part 1 - Analysis and Design
Take some time to analyze the problem described above. Read through the description at least two times. When you fell that you have a reasonable understanding of the problem, then continue on below.
Test Cases
Come up with a set of six test cases. Two of the test cases should be cases where we should buy some number of shares. Two of the test cases should be cases where we should sell some number of shares. Two of the test cases should be cases where we should simply hold the shares currently in the account.
1. Specify the following for each test case.
2. Current number of shares of this stock in the account
3. Price (per share) paid for current stock in the account
4. Current market price (per share) of this stock
5. Maximum amount the client is willing to spend on a purchase
For each test case, determine whether we should buy, sell, or hold shares. If we should by, then also specify the number of shares to buy to maximize value. If we should sell shares, then also specify the number of shares that we should sell to maximize profit.
Design
Use a flowchart or pseudocode to sketch a design for an algorithm that will correctly determine the appropriate action to take based on the four inputs. Remember that your algorithm must also determine the number of shares to buy or sell in addition to deciding to buy or sell or hold.
Use your test cases to verify and correct your design.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
