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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 15:00, miracle9704
Atool that matches persoal skills qualities interests and talets to a career is called a
Answers: 1
image
Computers and Technology, 24.06.2019 13:30, elviaortiz402373
Which of the following is not a “fatal four” event?
Answers: 2
image
Computers and Technology, 24.06.2019 18:00, Pfaith8617
Explain the circumstances for which the interquartile range is the preferred measure of dispersion. what is an advantage that the standard deviation has over the interquartile range? choose the correct answer below. a. the interquartile range is preferred when the distribution is symmetric. an advantage of the standard deviation is that it increases as the dispersion of the data increases. b. the interquartile range is preferred when the data are not skewed or no have outliers. an advantage of the standard deviation is that it uses all the observations in its computation. c. the interquartile range is preferred when the distribution is symmetric. an advantage of the standard deviation is that it is resistant to extreme values. d. the interquartile range is preferred when the data are bell shaped. an advantage of the standard deviation is that it is resistant to extreme values. e. the interquartile range is preferred when the data are skewed or have outliers. an advantage of the standard deviation is that it uses all the observations in its computation. f. the interquartile range is preferred when the data are bell shaped. an advantage of the standard deviation is that it increases as the dispersion of the data increases.
Answers: 2
image
Computers and Technology, 24.06.2019 22:00, dixks
According to your study unit, what is the main reason that improved human relations skills may improve your grades?
Answers: 1
You know the right answer?
Divergence Monitor Many automated trading systems continuously consume market data, then react when...

Questions in other subjects:

Konu
Mathematics, 04.03.2021 23:20
Konu
Mathematics, 04.03.2021 23:20