Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are carrying out the automation of the following investment strategy in Python. An initial investment amount of $50,000 is used to acquire Stock A.

You are carrying out the automation of the following investment strategy in Python. An initial investment amount of $50,000 is used to acquire Stock A.

Every month, you are prepared to transact a monthly amount of $1,000. The average price of Stock A in the portfolio, is defined as the net amount of cash put into the portfolio divided by the total number of units of Stock A in the portfolio.

The market price of Stock A, is defined as the observed trading price of Stock A. If > , you will sell $1,000 worth of Stock A in the portfolio to realise some

profits. Else, if > , you will buy $1,000 worth of A from the market.

(a) For Month 2, show clearly that the units of stocks sold is 9.8 units and the average price of the stocks in the portfolio is $99.46. To simplify your calculation, you can assume that you can hold fractional units of stocks.

(b) Given the following initialisation in Python for your examination, design and write down Python code to calculate the units of A purchased with the given initial investment amount. Store the results in a Python list.

init_invt = 50000

monthly_invt = 1000

init_price = 100

To simplify your calculation, you can assume that you can hold fractional units of stocks.

(c) Given the following Python list of the market price of the stock,

prices = [80, 102, 84, 41, 74, 55, 32, 77, 92, 40, 91, 26]

use a Python for loop to implement the investment strategy by composing suitable data structures. Include a print statement in your code and report the final observed average price of A in the portfolio.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Biology Science For Life With Physiology

Authors: Colleen Belk, Virginia Maier

6th Edition

0134555430, 978-0134555430

Students also viewed these Finance questions