Question: Assume that every order is successfully executed. Complete the following function in the code editor to determine the profit and / or loss for the
Assume that every order is successfully executed. Complete the following function in the code editor to determine the profit andor loss for the Komodo Dragon Tradin each stock that it either bought or sold over the course of the trading day.
I Cparam initialprice The price of all stocks at the beginning of the day, before any price updates are published.
eparam orders The sequence of buy and sell orders to be executed.
I eparam feed The exchange feed of price updates to various stocks.
epre ep initialprice
I epre ep orders is not empty, and is sorted in ascending order by timestamp.
I epre ep feed is not empty, and is sorted in ascending order by timestamp.
I epre ep The set of all timestamps among orders in ep orders and price updates in ep feed contains no duplicates.
I ereturns A collection see below with the endofday profits and losses of each stock for which at least one order
II was executed. Stocks for which a price update was published but no orders were executed should be excluded from the
III return value.
auto profitsAndLosses int initialPrice, const std: :vectorrder &orders, const std:vectorapnl
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
