Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE WRITE PYTHON CODE FOR THE FOLLOWING Billions of shares of stock, or fractions of ownership in aTable 1 : Stock information. business, are traded

PLEASE WRITE PYTHON CODE FOR THE FOLLOWING
Billions of shares of stock, or fractions of ownership in aTable 1: Stock information. business, are traded on the stock market every day. Over half of all adults in the United States own stocks and 1.2 billion people worldwide invest in the stock market. Many people invest in stocks to increase their wealth and to increase their earnings beyond their salary. If the business that you own stock in does well, then your stock value will increase and you will make money. An individual who owns stock can sell their shares, or a fraction of their shares, to get cash that can be used for a down payment on a home, to buy a new car, or for any other purchase. However, when you sell stock, you have to pay both a transaction fee and tax on the money you gain. If you own many different stocks, you have to decide which stocks and how much to sell to make sure you have enough cash for your purchase. In this question, we will use linear optimization to decide which shares of stock and how many you need to sell in order to have enough cash to make your purchase, and to maintain a strong portfolio of stocks.
Suppose that, last year, you purchased 150 shares of eight different stocks, for a total of 1,200 shares. Table 1 lists the stocks that you purchased, the price you purchased them for last year, the current price, and the price estimate for next year.
If you sell any shares, you have to pay a transaction cost of 1% of the amount transacted. In addition, you must pay a capital-gains tax at the rate of 30% on any capital gains at the time of the sale. For example, suppose that you sell 100 shares of a stock today at $50 per share, which you originally purchased for $30 per share. You would receive $5,000. However, you would have to pay capital-gains taxes of 0.30\times ($5,000-$3,000)= $600, and you would have to pay $50 in transaction costs (1% of $5,000). Therefore, by selling 100 shares of this stock, you would have a net cash flow of $5,000 $600 $50= $4,350.
Note that for this question, none of the stocks decreased in value since the time of purchase, so we do not have to deal with capital losses.
(a) You would like to sell enough shares of stock today to generate $10,000 to use as part of a down payment on a new home. You need to decide how many shares of which stocks to sell in order to generate $ 10,000, after taxes and transaction costs, while maximizing the estimated value of your stock portfolio next year. You will
formulate this question as a linear optimization problem.
(i) Describe the decision variables for this problem. How many are there?
(ii) We will assume for this problem that you can not sell more shares of stock than you own, and you can not buy additional shares. How should you constrain the values of the decision variables to account for this?
(iii) Write out the objective function of this problem in terms of your decision variables.
(iv) In addition to the upper and lower bounds on your decision variables, you need to add one constraint to your model to make sure you get $10,000 in cash from selling your stocks, after taxes and transaction costs.
Write down this constraint in terms of your decision variables.
(b) Set-up and solve this problem with Pyomo. Make sure to maximize your objective, include a constraint for the amount of cash you generate, and upper and lower bounds for the values of your decision variables.
(i) What is the optimal solution? Give the values of the decision variables and the objective function value.
(ii) As an investor who is seeking to have a diverse portfolio, are you happy with this solution? Why or why not?
(c) Suppose you would like to keep at least 75 shares of each of your eight stocks. Adjust the formulation so that you sell no more than 75 shares of each stock, and solve the problem again.
(i) What is the new optimal solution? Give the values of the decision variables and the objective function value.
(ii) What type of investor might prefer this solution over the previous one? What type of investor might prefer the previous solution over this one?
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Samsung Galaxy S23 Ultra Comprehensive User Manual

Authors: Leo Scott

1st Edition

B0BVPBJK5Q, 979-8377286455

More Books

Students also viewed these Databases questions

Question

b. What is rs for Firm U? For Firm L?

Answered: 1 week ago

Question

Writing a Strong Introduction

Answered: 1 week ago