Stockwatcher agent is an agent-version of the stockwatcher application which allows users to select a set of stock quotes and check current price, trade volume, today high and low. Particularly, the agent embeds a rule-based inference engine such that it executes clips-like rules. For example, a user can write a notification rule which sends E-mail when stock values become higher or lower than a threshold.
If you're interested only in how to run this stockwatcher agent, click here.
Main contribution of the stockwatcher agent is the agent configuration by rules, which in turn are interpreted by inference engine. Since rules can be written in a number of ways, the configurability of the agent is unlimited.
The stockwatcher agent is a multi-plane agent, having three planes: Update plane, GUI, Inference. You can check the blueprint.
It is responsible for requesting HTML pages containing stock information, parsing them, and retrieving the required information.
It provides a Graphical User Interface.
It has a state associated with a inference strategy, which reads in the rules provided by users, collects facts concerning stock values, and excutes the rules on the facts to trigger actions such as E-mail notification.
The following is a simple rule. It checks wether the dow industrial average index, given as $INDU, goes higher than 12000 points. If it does, send a notification E-mail titled, "Dow Exploding" to email@example.com.
(defrule email (quoteobj (quoteName "$INDU") (currentPrice ?c)) (test (> ?c 12000)) (not (sentmail "firstname.lastname@example.org")) => (assert (sentmail "email@example.com")) (call (fetch Model) set "MailServer" "ector.cs.purdue.edu") (call (fetch Model) set "Sender" "stockwatcher") (call (fetch Model) set "Receiver" "firstname.lastname@example.org") (call (fetch Model) set "Subject" "DOW EXPLODING!!") (call (fetch Model) set "Message" (str-cat "Current Dow is " ?c)) (call (fetch Model) set "NextState" "email"))