From this point in the book, we will look at the implementation code, and then show how we can test it effectively. Note, however, that this does not mean writing the code first, followed by the unit test. The TDD process is still test first, followed by the implementation. It is the test case which will drive the implementation strategy. We are showing the implementation code first, only because it makes it easier to understand the testing concepts that will follow. All this code was originally written test first!
The rule classes keep track of the rules that the user wants to track and they can be of different types. For example, send an alert when a stock crosses a value, or matches a trend.
Here is an example of a
class PriceRule: """PriceRule is a rule that triggers when a stock price satisfies a condition (usually greater...