subject

Divergence Monitor Many automated trading systems continuously consume market data, then react when certain specific conditions are met. One such interesting condition occurs when the prices of two highly- correlated stocks diverge. In this exercise, you will implement part of a system that monitors for instances where the prices of two such stocks drift apart. You are provided with a skeleton implementation of the Price Divergence Monitor class. • The constructor takes in a threshold. • The method RegisterPair will be called by the owner of this class each time it wants your class to start monitoring a new pair of correlated stocks. o Multiple pairs can (and will be registered -- you need to continue to monitor all registered pairs. • The method UpdatePrice will be called by the owner of this class whenever the price of a stock changes. o When the price of a stock that is part of a registered pair changes, you should check whether that new price differs from the price of the other stock in the pair by more than the threshold. If it does, you should call the Report Divergence method of your class, which has already been implemented for you. Clarifications: • Differences of exactly the threshold should not be reported. • If you have not yet received a price for a product, you should not report a divergence. • If the same pair is registered multiple times, ignore the duplicates. Tip: Use print statements to view input for test cases, and use custom input to test your code! 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 13 using namespace std; 14 15 16 int timestamp = 0; 17 vector eventOutput; 18 19 20 class PriceDivergenceMonitor 21 { 22 public: 23 PriceDivergence Monitor (int threshold); 24 void Register Pair(const string& stockOne, const string& stockTwo); 25 void UpdatePrice (const string& stockName, int newPrice); 26 private: 27 void ReportDivergence (const string& updatedStockName, int updatedStockPrice, const string& otherStockName, int other StockPrice); 28 // todo: add member variables, if needed 29 30 }; 31 32 33 PriceDivergenceMonitor::PriceDiverg enceMonitor(int threshold) 34 { 35 // todo: complete this constructor as needed 36 } 37 38 39 40 /* The method Register Pair will be called by the owner of this class each time it wants your class to start monitoring a new pair of correlated stocks. */ void PriceDivergenceMonitor:: Register Pair(const string& stockOne, const string& stockTwo) { // todo: complete this method } 41 42 43 44 45 46 47 48 49 The method UpdatePrice will be called by the owner of this class whenever the price of a stock changes. When the price of a stock that is part of a registered pair changes, you should check whether that new price differs from the price of the other stock in the pair by more than the threshold. If it does, call the ReportDivergence method with the appropriate parameters. */ void PriceDivergenceMonitor:: UpdatePrice (const string& stockName, int newPrice) { // todo: complete this method } void PriceDivergence Monitor::ReportDivergence (const string& updatedStockName, int updatedStockPrice, const string& > otherStockName, int otherStockPrice)... 50 51 52 53

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 13:30
Write lines of verse that rhyme to remember the following information: acid rain is a type of air pollution caused by chemicals in the air.
Answers: 1
question
Computers and Technology, 22.06.2019 18:00
Suppose an astronomer discovers a large, spherical-shaped body orbiting the sun. the body is composed mostly of rock, and there are no other bodies sharing its orbit. what is the best way to categorize this body? a. planet b. moon c. comet d. asteroid
Answers: 1
question
Computers and Technology, 22.06.2019 22:30
I'll mark brainliest if answered right! with which feature or menu option of a word processing program can you make an image like this? you can get this image using the option of a word processing program.
Answers: 1
question
Computers and Technology, 23.06.2019 03:30
Ihave a singular monitor that is a tv for my computer. recently, i took apart my computer and put it back together. when i put in the hdmi cord and booted the computer to see if it worked, the computer turned on fine but the screen was blue with "hdmi no signal." i've tried everything that doesn't require buying spare parts, any answer is appreciated!
Answers: 1
You know the right answer?
Divergence Monitor Many automated trading systems continuously consume market data, then react when...
Questions
Questions on the website: 13722360