Computers and Technology
Computers and Technology, 28.08.2020 01:01, kalag9478

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

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 02:00, floydsidney1119
Think about some of the most memorable and forgettable games ever created. they can be games that were discussed in this unit or otherwise. what are some of the consistent factors that made certain games memorable to you? what were some of the consistent factors that made certain games forgettable to you? why? explain.
Answers: 1
image
Computers and Technology, 22.06.2019 03:30, rebekah2503
Identify at least three types of characteristics that you were asked about as you the computer identify a fruit.
Answers: 3
image
Computers and Technology, 22.06.2019 13:30, ashleypere99
Jane’s team is using the v-shaped model for their project. during the high-level design phase of the project, testers perform integration testing. what is the purpose of an integration test plan in the v-model of development? a. checks if the team has gathered all the requirements b. checks how the product interacts with external systems c. checks the flow of data in internal modules d. checks how the product works from the client side
Answers: 1
image
Computers and Technology, 23.06.2019 06:00, ashleyd198308
Respond to the following in three to five sentences. select the workplace skill, habit, or attitude described in this chapter that you believe is most important for being a successful employee.
Answers: 1
Do you know the correct answer?
We say a portfolio matches the benchmark when the market value percentage of each asset in the portf...

Questions in other subjects: