Deliver real-time stock quotes and market data with PubNub
Does it follow best practices?
Evaluation — 98%
↑ 1.81xAgent success when using this tile
Validation for skill structure
A trading platform wants to let users set custom price alerts on stocks. When a stock hits a user's target price (either rising above or falling below a threshold), the user should receive an instant notification. The platform already streams live stock quotes through PubNub, so the alert evaluation should happen server-side as quotes flow through, minimizing latency.
The system has two parts: a client-side alert manager that lets users create and delete alerts and listen for triggered notifications, and a server-side PubNub Function that intercepts quote messages, evaluates them against stored alert conditions, and fires notifications to the right users. Alerts should support multiple condition types beyond simple price thresholds, including percentage change and volume spikes. Once an alert fires, it should not fire again for the same condition until reset.
Build both the client-side alert management module and the server-side PubNub Function.
Produce the following files:
alert-manager.js -- A client-side JavaScript module that:
alert-function.js -- A PubNub Function (server-side) that:
package.json -- Dependencies needed
No additional files are required.