Loading...

Messages

Proposals

Stuck in your homework and missing deadline? Get urgent help in $10/Page with 24 hours deadline

Get Urgent Writing Help In Your Essays, Assignments, Homeworks, Dissertation, Thesis Or Coursework & Achieve A+ Grades.

Privacy Guaranteed - 100% Plagiarism Free Writing - Free Turnitin Report - Professional And Experienced Writers - 24/7 Online Support

Program that automatically buys and sells stocks

20/04/2021 Client: muhammad11 Deadline: 2 Day

DIRECTIONS Many investment management companies are switching from manual stock trading done by humans to automatic stock trading by computers. You've 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. 2. 3. 4. current_shares - current number of shares of this stock in the account (int). purchase_price - price (per share) paid for current stock in the account (float). 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: Test 1 Test 2 Test 3 Test 4 Test 5 Test 6 current_shares 10 20 15 1 10 1 purchase_price 100 2 12 1 1 1 market_price 1 1 1 11 3 12 available_funds 10 21 12 0 30 0 OUTPUT Buy 11 shares Buy 2 shares HoldShares Sell 10 shares Hold shares Sell 1 shares Rationale for test cases: Test 1 Even though the current market price is very low (compared to the purchase price), after paying the $10 transaction fee, we would not have any funds left to buy shares; so we can only hold. Test 2 After paying the $10 transaction fee, there are enough funds remaining to buy 11 shares. At a purchase_price vs. market_price difference of $1 per share, our 11 shares represent a value gain of $11 dollars, which is $1 more than the $10 transaction fee - so we come out $1 ahead. Test 3 After paying the $10 transaction fee, there are enough funds remaining to buy 2 shares. At a purchase_price vs. market_price difference of $11 per share, our 2 shares represent a value gain of $22 dollars, which is $12 more than the $10 transaction fee - so we come out $12 ahead. Test 4 Selling our 1 share for $11 will leave us with just $1 after we pay the $10 transaction fee. That is the same as what we paid for it, and we won't make any profit - so we should hold. Test 5 With a market_price vs. purchase_price vs. difference of $2 per share, we stand to make $20 from the sale of our 10 shares. This is $10 more than the price of the transaction fee, so we will come out $10 ahead - therefore we should sell all 10 shares. Test 6 Our 1 share is worth $11 more than we paid for it at the current market price. The $11 dollars obtained by selling that share now will still leave us with a profit of $1 after paying the $10 transaction fee. Profit is profit, so we should sell. Things to think about when you’re designing and writing this program: 1. Look for opportunities to use variables as a way to name things, and to break larger more complex expressions down into simpler expressions. 2. Spend some time choosing your names carefully. Names should be descriptive. 3. Try to design and write your code a few lines at a time. Design and write a few lines, then run some tests to see if these lines are doing what you want them to do. If they are not, then analyze and correct them before you move on to the next few lines of code. ...

Homework is Completed By:

Writer Writer Name Amount Client Comments & Rating
Instant Homework Helper

ONLINE

Instant Homework Helper

$36

She helped me in last minute in a very reasonable price. She is a lifesaver, I got A+ grade in my homework, I will surely hire her again for my next assignments, Thumbs Up!

Order & Get This Solution Within 3 Hours in $25/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 3 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 6 Hours in $20/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 6 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 12 Hours in $15/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 12 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

6 writers have sent their proposals to do this homework:

Accounting Homework Help
Professional Accountant
Top Quality Assignments
Engineering Guru
Coursework Helper
Assignment Guru
Writer Writer Name Offer Chat
Accounting Homework Help

ONLINE

Accounting Homework Help

I have read your project details. I can do this within your deadline.

$32 Chat With Writer
Professional Accountant

ONLINE

Professional Accountant

I am known as Unrivaled Quality, Written to Standard, providing Plagiarism-free woork, and Always on Time

$17 Chat With Writer
Top Quality Assignments

ONLINE

Top Quality Assignments

You can award me any time as I am ready to start your project curiously. Waiting for your positive response. Thank you!

$45 Chat With Writer
Engineering Guru

ONLINE

Engineering Guru

Hello, I an ranked top 10 freelancers in academic and contents writing. I can write and updated your personal statement with great quality and free of plagiarism

$20 Chat With Writer
Coursework Helper

ONLINE

Coursework Helper

Give me a chance, i will do this with my best efforts

$44 Chat With Writer
Assignment Guru

ONLINE

Assignment Guru

I have read and understood all your initial requirements, and I am very professional in this task.

$25 Chat With Writer

Let our expert academic writers to help you in achieving a+ grades in your homework, assignment, quiz or exam.

Similar Homework Questions

Champion of the world maya angelou questions and answers - Pink floyd brick in the wall - Bacterial and fungal amylase lab report - Ibm deutschland gmbh 71137 ehningen - Manhood and masculinity in macbeth - Design futuring tony fry pdf - Dro contingency worksheet answers - 9781305503090 - Identify 2 data sets and discuss appropriate structures of the datasets. - ?? same-day 0833173182 TEYATEYANENG ABORTION CLINIC // PILLS,,,, - Ericsson capital tt font download - Conway game of life glider - Roosevelt speak softly and carry a big stick - Arabella faded crowned rosette rug - Briefly describe your family's economic background - Health Care - Geographic center of australia - Week 6: apn professional development plan paper - When given a list of items to remember - Amoeba sisters biomagnification answer key - Music History - Closed form definition poetry - Mcq based case study by aon hewitt - Industrial health and hygiene ppt - Class in america 2009 gregory mantsios - Cultural convergence examples - From cruelty to goodness by philip hallie - All 4 problems are independent problems and should be considered separately. - The symantec threatcon level has been raised to level 2 - MKTG - Example picot question for medication errors - Translational partition function for monatomic gas - A beautiful mind math problem - Question- 8hours - Don't look back 1996 - Plane stress transformation equations - Merrill lynch online trading - John donne death be not proud - The induction coil works on the principle of - Finite element analysis questions and answers pdf - Which of the following is true regarding a strategic plan - Models for writers 13th edition - Advantages and disadvantages of probation and parole - Do blue tongue lizards hibernate in winter - Ojala no sea demasiado tarde cuando te des cuenta - Difficult concepts - Prepare a diagram 0 dfd for new century - Halal kfc in wolverhampton - Diana v state board of education 1970 - Laura hughes sex offender shuffle - Ap stats exam study guide - Capsim human resources - Bad tv reception at night - Electricity meter box australia - Investment center managers are usually evaluated using performance measures - Statistic home work - 95a queens road connells point - Deliverable 6 - Corporate Memo on Ethical and Legal Concerns - Pratt and whitney service bulletin 1001 - Reading note and answer questions - Cmis 330 srs - Barbarian at the gate stock meaning - Children’s Health Fund and National Breast Cancer Coalition (Due 48 hours) - Mordialloc beach primary school - My Sister's Keeper: Ethics Paper - Assignment - Zero plagiarism - Network Management - Eastern creek waste management centre - Anti-parallel diode clipping circuit - Powerpoint Should Consist Of 15 Slides. Rubric Is Attached .PLEASE FALLOW THE RUBRIC - Enable flash so all content renders in mindtap - Experiment 1 heart valves and pumps - Faw toyota changchun engine co ltd - Sex education in schools pros and cons essay - Project part 3 - Measuring mass lab 3 answers - MKT- 345 Web assign. 1 - Nutrition - 1500 words essay 18 hrs - Bsc final year project - Siemens per meter symbol - Los estudiantes de la universidad virtual estudian - Weybourne beach car park - Please choose one of the topics - Vacuum forming design guidelines - Price pfister f wk1 68 - South canyon fire map - World War 2 - El police rd to melba tunnel - Essay - Khan academy balancing equations - Absolute location of asia - Accounting Question - Guhan subramanian harvard business school - Eco 550 week 5 problem set - I need a discussion answered for my Marketing in a Global environment and 2 respond to 2 other classmate - Social work role play scenarios - Responsibility center example in healthcare - Internal conflict in the story of an hour - Campbell soup co v wentz - Capstone project