Bloomberg | SSE | virtual onsite | System Design

I was asked to design a rule based alert system.
Rules can be configured like below:

  1. If price of A stock goes higher than a threshold then send alert
  2. If price of A stock goes lower than a threshold then send alert.

Apart for the system design. I gave below approach for implementing alert trigger logic.(that I could think of at that moment)

keep the rules with sorted value of price threshold.
then for each price change do a binary search to trigger all the rules above and below that point.

please suggest any better approach.

Comments (4)