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 03:30
Jessie has received a contract to build a real-time application for a baker. however, the baker doesn't want to invest too much money. his only requirement is that he wants the customers to know which cupcakes are available at what time and in what quantity. so his core requirement is that the details of product should be in real time. what platform can jessie use to develop this application?
Answers: 1
question
Computers and Technology, 23.06.2019 17:00
In which of the following ways can using test-taking tips you? a. you can focus on the information that you need to study. b. you will see the answers to the test. c. you will study more. d. you will be less organized.
Answers: 1
question
Computers and Technology, 24.06.2019 08:30
@josethesolis i need can anyone text me and follow me
Answers: 1
question
Computers and Technology, 24.06.2019 14:00
When creating a field in a table, you must set the to determine what type of data the field can store. field property data type field type data property
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: 13722361