subject

We say a portfolio matches the benchmark when the market value percentage of each asset in the portfolio matches the market value percentage of each asset in the benchmark. Your challenge is to write a program that determines the transactions necessary to make a portfolio match a benchmark, assuming the total market value of the portfolio stays the same. BackgroundA portfolio is a collection of assets such as stocks and bonds. A portfolio could have 10 shares of Vodafone stock, 15 shares of Google stock and 15 shares of Microsoft bonds. A benchmark is also just a collection of assets. A benchmark could have 15 shares of Vodafone stock, 10 shares of Google stock and 15 shares of Microsoft bonds. The market value of a stock isshares * priceThe market value of a bond isshares * (price + accrued interest) * 0.01A transaction is when you "buy" or "sell" a particular asset. For instance, you can decide to buy 5 shares of Vodafone stock which, given the portfolio described above, would result in you having 15 shares of Vodafone stock. An asset’s market value percentage can be calculated by dividing the market value of the asset by the total market value of every asset in the portfolio or benchmark. For example, given the portfolio described above and assuming all assets have a price of 5 and accrued interest is 0.05, the market value percentage of Vodafone would be(10 * 5) / ( (10 * 5) + (15 * 5) + (15 * (5 + 0.05) * 0.01) )Inputs and OutputsYou will receive a string in the following format Portfolio:Benchmark where Portfolio & Benchmark each are in the same format. Here is the format: Name, AssetType, Shares, Price, AccruedInterest where each asset within Portfolio or Benchmark is separated by '|' symbol. The output for the transactions is TransactionType, Name, SharesAssumptionsShares & Price are positive decimalsThere will always be at least 1 asset present in the Portfolio and BenchmarkA particular asset will only be a stock or a bond, but not bothThe final trades should be rounded to the nearest decimalsThe trades should be sorted in ascending order based on the names of the assetsInput:Vodafone, STOCK,10,50,0|Google, STOCK,15,50,0|Microsoft, BOND,15,100,0.05:Vodafone, STOCK,15,50,0|Google, STOCK,10,50,0|Microsoft, BOND,15,100,0.05Output:BUY, Vodafone,5SELL, Google,5Test 1Test InputDownload Test InputGoogle, STOCK,10,50,0|Microsoft, STOCK,15,50,0|IBM, BOND,15,100,0.05:IBM, BOND,20,100,0.05|Google, STOCK,15,50,0|Microsoft, STOCK,10,50,0.05Expected OutputDownload Test OutputBUY, Google,5BUY, IBM,5SELL, Microsoft,5Test 2Test InputDownload Test InputVodafone, STOCK,10,50,0|Google, STOCK,15,50,0|Microsoft, BOND,15,100,0.05:Vodafone, STOCK,15,50,0|Google, STOCK,10,50,0|Microsoft, BOND,15,100,0.05Expected OutputDownload Test OutputSELL, Google,5BUY, Vodafone,5

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 06:00
The width of a piece of rectangular land is 5m shorter rhan 1/3 of its length .find the width of the land if the length is 60m,150m.
Answers: 1
question
Computers and Technology, 22.06.2019 15:30
To increase sales, robert sends out a newsletter to his customers each month, letting them know about new products and ways in which to use them. in order to protect his customers' privacy, he uses this field when addressing his e-mail. attach bcc forward to
Answers: 2
question
Computers and Technology, 24.06.2019 13:00
If you add the following to the query grid in an access query, what is it called? salestaxamt: [salestaxrate]*[totalsale] formula calculated field total calculation
Answers: 2
question
Computers and Technology, 25.06.2019 01:30
What controls can be found on the file tab of microsoft word
Answers: 1
You know the right answer?
We say a portfolio matches the benchmark when the market value percentage of each asset in the portf...
Questions
question
Mathematics, 10.12.2020 01:10
question
English, 10.12.2020 01:10
question
Mathematics, 10.12.2020 01:10
question
English, 10.12.2020 01:10
question
Mathematics, 10.12.2020 01:10
question
Mathematics, 10.12.2020 01:10
Questions on the website: 13722360