Home

Design and Simulation of an Agent-based stock trader

image

Contents

1. try Y Statement st connection createStatement String sql SELECT Symbol FROM knowledge WHERE goal ResultSet rs st executeQuery sql if rs next System out println rs getString 1 return true else return false catch SQLException sqlex sqlex printStackTrace System out printlin Desire SQL error n return false Symbol 64 Intention java package agent import java util import java sql public class Intention private Connection connection public Intention Connection x this connection x public String selectPlan int bresult try Statement st connection createStatement String sql SELECT Plan FROM BPmap WHERE UpLimit gt bresult and LowLimit lt bresult ResultSet rs st executeQuery sql if rs next String s rs getString 1 System out println Intention planl s return s else return fail catch SQLException sqlex sqlex printStackTrace return fail Money java package stockpg impo impo rt java util rt java sql 65 r public class Money P P P public Money Connection x public int manager String act rivate String connection ID new Str show new S double amoun if act equ amount else if ac amount else System ou System out
2. rows ServletException IOException tpSession session req getSession false ring userID String session getValue session getId ring action req getParameter action ring symbol req getParameter symbol ring ss req getParameter shares ng shares Long parseLong ss ring sprice req getParameter price uble price Double parseDouble sprice der o new Order connection userID ring or new String o orderpost action symbol shares price rintWriter output res getWriter S setContentType text html utput println html body output println lt center gt lt table gt lt tr gt lt td BGCOLOR A0B8C8 gt lt b gt lt font face Arial size 3 gt Online Stock Agent font font 52 size l gt Order Manager lt font gt lt b gt lt td gt lt tr gt lt table gt lt center gt lt hr gt lt br gt output println h3 or lt h3 gt lt br gt output println lt hr gt lt center gt lt table gt lt tr gt lt td gt lt a Lf href ht tp localhos t 8080 quotes html gt Get Quotes lt a gt lt td gt lt td gt lt a href s rvl t RecomServlet gt Recommend lt a gt lt td gt lt td gt lt a h Withdraw lt a gt lt ref servl t MoneyServlet gt Deposit amp td gt lt td gt lt a for ref s lt td gt lt a h rvl
3. super init config try Class forName sun jdbc odbc JdbcOdbcDriver connection DriverManager getConnection URL catch Exception e e printStackTrace connection null public void doGet HttpServletRequest reg HttpServletResponse res throws ServletException IOException HttpSession session req getSession false String userID String session getValue session getId if userID null Show show new Show connection userID Vector holdstocks show holdstocks double holdmoney show holdmoney PrintWriter out res getWriter res setContentType text html out println html body lt center gt lt table width 60 gt tr BGCOLOR A0B8C8 gt lt td align center gt lt b gt lt font face Arial size 3 gt Online Stock Agent lt font gt lt b gt lt td gt lt tr gt lt table gt lt center gt lt hr gt lt br gt lt center gt lt h2 gt userID s Account Details lt h2 gt lt center gt lt br gt if holdstocks isEmpty 43 out println h3 You do not have any stocks lt h3 gt else ShowHoldStocks s new ShowHoldStocks holdstocks out println h3 You have stocks lt h3 gt lt center gt lt table border width 40 gt lt tr gt lt b gt lt th gt Stock Name lt th gt lt th gt Shares lt th gt lt b gt lt tr gt for
4. lt tr gt lt td gt lt b gt lt I gt lt font face Arial size 1 gt Thank you for using Online Stock Agent font I b td tr lt tr gt lt td gt You have been successfully logged out lt td gt lt tr gt lt tr gt lt td align center gt lt font face Arial size 1 gt lt b gt lt a href http localhost 8080 main html gt Return to Online Stock Agent lt a gt lt b gt lt font gt lt br gt You may neet to log in again lt td gt lt tr gt lt table gt lt center gt lt body gt lt html gt output close public String getServletInfo return The Logout Servlet lets a client logout 47 MoneyServlet java im im im im im im pu po po po po po po bl p p P i java io javax servlet javax servlet http java util 7 java sql EE ERLITT SFT STR t stockpg c class MoneyServlet extends HttpServlet ivate Statement statement null ivate Connection connection null ivate String URL jdbc odbc ASTdb super init config try Class forName sun jdbc odbc JdbcOdbcDriver connection DriverManager getConnection URL catch Exception e e printStackTrace connection null public void doGet HttpServletRequest reg HttpServletRespons public void init ServletConfig config throws ServletException res thro
5. Details lt a gt lt td gt href se History lt a gt lt td gt lt tr gt lt table gt lt font face Arial gt lt a href se rvle rvle ref servle t OrderServlet gt Make an Order lt a gt lt td gt t AccountInfServlet gt Account td a lt t TradeHistoryServlet gt Trade t LogoutServlet gt Sign Out lt a gt lt font gt lt center gt output println lt body gt lt html gt output close o processOrder public void destroy try connection close catch Exception System err println ew d or endsWith processing Problem closing the database public String getServletInfo return The Order Servlet manages buying or selling stocks 53 RecomServlet java im im im im im im pu po po po po po po bl Do O O O i java io javax servlet javax servlet http java vial 7 java sql Etc tr SFT TA t agent c class RecomServlet extends HttpServlet ivate Statement statement null ivate Connection connection null ivate String URL jdbc odbc ASTdb ivate Agent RecomAgent public void init ServletConfig config throws ServletException super init config try Class forName sun jdbc odbc JdbcOdbcDriver connection DriverManager getConnection URL catch
6. public String perform String goal if D achievable goal int b B getBelief goal if b 11111 return Belief sensor error else String p I selectPlan b return p else return Unachievable goal 62 Belief java Desire gt Believes package agent import java util import java sql public class Belief private Connection connection public Belief Connection x this connection x public Connection getConnect return connection Get believes according to the desire public int getBelief String goal try Statement st connection createStatement String sql SELECT FROM knowledge WHERE Symbol goal wm ResultSet rs st executeQuery sql boolean more rs next if more int sum 0 ResultSetMetaData rsmd rs getMetaData for int i 2 i rsmd getColumnCount i 1st element Symbol sum rs getInt i System out printin sum sum return sum else return 11111 false flag catch SQLException sqlex sqlex printStackTrace System out println Desire SQL error Mn return 11111 false flag 63 Desire java package agent import java util import java sql public class Desire private Connection connection public Desire Connection x this connection x public boolean achievable String goal
7. 5 Developing a BDIM agent needs to derive classes for each of agent s plan and belief from the relevant BDIM base classes JAM Agents are composed of five primary components such as a world model a plan library an interpreter an intention structure and an observer Huber 99 JAM uses text based files to specify the agent s beliefs goals and plans To implement a JAM agent a user has to write appropriate primitive functions in Java and specify the agent s BDI in JAM files JACK offers Class Interface Method Syntactic and Semantic extensions of Java implemented as Java plug ins to support an agent oriented development environment JACK 99 Especially JACK uses the Database class as its data storage device to describe an agent s beliefs Then the Database class is fully integrated with other JACK classes However JACK has its own extended syntax different from Java To build a JACK agent a user has to understand the JACK structure very well but it is not easy All of these works are based on Java JACK uses DB nicely for belief however it does not support dynamic manipulation of desire and intention while our work does Even though JAM provides a way to manipulate BDIs neither JAM nor BDIM supports well dynamic manipulation of BDIs not like ours In their works once agents are built by users then they are fixed during runtime In other words users cannot modify them dynamically at runtime Users have to redefine and recomp
8. t catch if if boolean success 57 output close return SQLException sqlex System err printin ERROR sqlex printStackTrace return Problems with finding an entry pswd2 equals pswdl output println lt H3 gt Please reset your password lt H3 gt output close return mw mw email equals firstName equals lastName equals output println H3 Please click the back button and fill all fields H3 output close return in mim insertIntoDB U lastName userID firstName pswdl ml UT oap we email other if success output print lt H2 gt Thank you firstName for registering lt H2 gt lt br gt lt center gt lt font face Arial size t 1 gt lt b gt _ lt a href http localhost 8080 main html gt Login Online Stock Agent lt b gt lt font gt lt center gt else output print lt H2 gt An error occurred Please try again later lt H2 gt output close private boolean insertIntoDB String stringtoinsert try statement connection createStatement statement execute INSERT INTO client userID password lName fName email other VALUES stringtoinsert statement close catch Exception e System err println ERROR Problems with a
9. JDBC and Access are used In this report we emphasize how to develop the BDI based agents in the project 1 2 using the Java programming language and how to make an agent based application more intelligent and flexible The next section we introduce some background about agent oriented programming with BDI concepts explains some basic concepts used in our work and compare our work with the related works In the Section 3 we describe the architecture of our prototype application Agent based Stock Trader AST constructed based on the BDI agent concepts In the Section 4 we show our implementation scheme of AST with the Java codes The AST is a just small example program by which we describe our nice implementation scheme of the BDI agent concept using Java with the help of database Therefore we describe how we can nicely implement the BDI agents while showing how we can implement a BDI agent based application like AST The Section 5 shows an example session of AST With a nice user interface each session just shows how much the AST system is applicable while using the BDI agents described technically in the previous sections Finally we conclude with future work and references 2 BACKGROUND OF BDI AGENT An agent is a software entity that has some degree of intelligence and autonomy It is a high level system component which is capable of having goals that it needs to be accomplished From the traditional definitions agent
10. the agent will check whether it can handle If so its corresponding desire will be achieved by executing proper plans defined in its intention If not it may delegate it to other agents for help It can be implemented by message exchange among multi cooperative agents even though our current system is not implemented in this way The following code shows the Agent class for the AST application Agent java package agent import java util import java sql public class Agent public Belief B public Desire D public Intention I constructor public Agent Connection x D new Desire x B new Belief x I new Intention x agent performance controller public String perform String goal 20 if D achievable goal int b B getBelief goal if b gt 11111 1111 means False flag return Belief sensor error else String p LselectPlan b return p j j else return Unachievable goal An agent always starts from the behavioral description named perform in this application perform String gaol A desire is passed to the application through the string goal String goal The desire class checks whether the current goal is achievable or not by D achievable goal If it is achievable the system gets the current environment through the belief by B getBelief goal Unless the current belief is not available its pla
11. 6 3 1 THe Architecture OF AST san ar 6 33 The BDI Gon epts n AST Au y 4 How To Implement BDE Agent anna a a u RI Aree tid 9 4 1 Agent Based Programming Language sese 9 4 2 How To Implement BDI Agents ccc cee cc ence eee ee eee e eee enneene es 9 4 3 How To Program BDI Agents ics casas ar 15 Sr Example SESSIONS rs aan SERO E aa A E a IS a ATARE 21 54 Loon PNY oerte a r teureren 21 2 2 agio SELVICES ea 21 25 3 StOCK QUO LAN ON ee ves tio past E ESEE E E s pus toltvo pam priu qe 22 5 4 Stock Trading Recommendation sess 23 5 9 Posting An Order i aso eere RR Oe E ERAN NUES ERRERLEVEA ER USER QUE CE aufs 25 5 6 Account Details and Trading History esee 25 6 Conclusions en PRI Tei NE E VERE AE EaI RU ek dan RR ERR ERE a EXAM TI 28 ds Acknowledgments 2 3 29 SH References een len 30 Nis Ie MPH TELE 32 Appendix 1 Agent based Stock Trader AST User Manual 32 Appendix 2 ASTdb Access Database near Bi ends 37 Appendix 3 SoUICe codes sungen 39 List of Figures le THe Architecture of AST decus er OR EOD ee 6 2 Proactive Reactive BDI Agents an k e XY Ea Y AER ERE YR 10 SoBDI Neent Runtime Conttol a oet d ee 15 ALANS Package SIUCIUEes oer ren east AE REA olen 33 vi List of Tables TBD Wapping Table odor reso eod ee a dU E Ro EXER See VERTU QR R ROO RU LUE EUNT 10 2 AST Database Contents u ee FEE ERRASSE EUN 11 3 AST Database Knowl
12. RF ct ct r td center table tr d ALIGN RIGHT NOWRAP gt lt b gt lt font face Arial gt User ID lt font gt lt b gt lt td gt d gt lt input name login size 20 maxlength 32 gt lt td gt lt tr gt r gt d ALIGN RIGHT NOWRAP gt lt b gt lt font face Arial gt Password lt font gt lt b gt lt td gt d gt lt input name password type password size 20 maxlength 32 gt lt td gt lt tr gt r td ALIGN CENTER COLSPAN 2 NOWRAP gt lt input type submit lue Login gt lt td gt lt tr gt table gt lt center gt lt td gt lt tr gt AN A A A AAA NS ED CEE SER Gh chuc Gt lt table gt lt center gt form lt body gt lt html gt 39 40 lt register html gt lt doctype html lt html gt lt head gt lt meta http e 8859 1 gt lt meta name A lt meta name P q G ublic w3c dtd html 4 0 transitional en gt uiv Content Type content text html charset iso uthor content XinFeng gt ENERATOR content Mozilla 4 73 en Win98 I Netscape title Register Form lt title gt lt head gt lt body gt lt hl gt Registration Form lt h1 gt lt hr gt lt form action http localhost 8080 servlet RegisterServlet method post gt lt center gt lt table WIDTH 94 gt lt tr gt lt td gt lt b gt lt font size 2 gt Create Your Account lt font gt lt b gt lt td gt l
13. action amount PrintWriter output res getWriter res setContentType text html output println lt html gt lt body gt output println lt center gt lt table gt lt tr gt lt td BGCOLOR A0B8C8 gt lt b gt lt font face Arial size 3 gt Online Stock Agent font font Size 1 Money Manager lt font gt lt b gt _ lt td gt lt tr gt lt table gt lt center gt lt hr gt lt br gt if mr 1 output printin lt h3 gt You just action amount lt h3 gt lt br gt else output println lt h3 gt Error happenned Would you please try it later lt h3 gt lt br gt 49 Show show new Show connection userID double balance show holdmoney output println center h3 Your total balance is balance lt h3 gt lt center gt lt br gt output println lt hr gt lt center gt lt table gt lt tr gt lt td gt lt a href http localhost 8080 quotes html gt Get Quotes lt a gt lt td gt lt td gt lt a href servlet RecomServlet gt Recommend lt a gt lt td gt lt td gt lt a href servlet MoneyServlet gt Deposit amp ithdraw lt a gt lt td gt lt td gt lt a ref servlet OrderServlet gt Make an Order lt a gt lt td gt lt td gt lt a href servlet AccountInfServlet gt Account etails lt a gt lt td gt lt td gt lt a ref servlet TradeHistoryServlet gt Trade istory lt a gt lt td gt
14. p rivate Connection connection rivate Show show ID String userID X ing userID how x userID double bucks show holdmoney alsIgnoreCase Deposit bucks t equalsIgnoreCase Withdraw bucks who about amount lt 0 t printin nAction was act rintln amount amount try Statement st connection createStatement String sql UPDATE client SET cash amount WHERE userID ID int rs st executeUpdate sql st close if rs 1 System out println nUpdate successful n return 1 else System out println nUpdate failed n return 1 catch SQLException sqlex sqlex printStackTrace return 1 r 66 Order java Post orders package stockpg import java util import java sql public class Order rivate Connection connection rivate Show show rivate String ID rivate double money rivate long num rivate long OrdNo 1 rivate String act rivate String stock rivate long shrs rivate double price rivate int hm CT O 0 0 0 O O O O O public Order Connection x String userID connection x ID new String userID show new Show x userID public String orderpost String act String stock long shrs double price this act new String act this stock new String stock this shrs shrs this price price Stateme
15. the BDI mapping table we use several database tables with Java classes like the following The related Java codes are shown in the next section The following table Table 2 shows the AST database contents Table 2 AST Database Contents AST Database Table Name Content Client Clients personal information and account balance Holding What kinds and how many stocks clients own Orders All orders clients posted and the agent processed Knowledge Agent s knowledge Desire belief values and a synthesis value of belief values BPmap Shows what plan will be chosen according the certain condition It is good to be able to manipulate BDIs dynamically for the BDI based agent system Belief can be dynamically changed to represent current environment Desires can be set and changed to new ones at run time based on current situations such as belief Intentions can be changed updated or newly added to achieve a current desire However it is hard to manipulate BDIs directly and dynamically well using Java To solve this the 12 belief values can be stored in a file or database table and can be manipulated dynamically at run time For this AST application belief was stored in a database table with which stock agents can consult and update dynamically In the AST the desire is also stored and manipulated dynamically in a database table Both desire and belief are stored at the Knowledge table in th
16. throws SQLException boolean more rs next ResultSetMetaData rsmd rs getMetaData Vector rows new Vector if more System out println No trade history return rows do rows addElement getNextRow rs rsmd while rs next return rows 74 private Vector getNextRow ResultSet rs ResultSetMetaData rsmd throws SQLException Vector curRow new Vector for int i l i lt rsmd getColumnCount i switch rsmd getColumnType i case Types VARCHAR urRow addElement rs getString i reak ypes INTEGER rRow addElement new Long rs getLong i Case reak ypes DOUBLE rRow addElement new Double rs getDouble i reak default DATETIME System out println Type was rsmd getColumnTypeName i Case TAHOTAHTATA curRow addElement rs getDate i return curRow Show current stock price and other information public Vector getCurInf String stock Statement st try Al st connection createStatement java util Date ud new java util Date SimpleDateFormat formatter new SimpleDateFormat M dd yy Here is a bug when month gt 9 String dateString formatter format ud System out println format time dateString String sql SELECT FROM quotes WHERE Symbol stock U AND Date LIKE dateString System o
17. to its knowledge base and finds whether a certain goal can be achieved or not by achievable String goal If the goal is achievable the main 17 agent program will select proper plans under proper situation based on belief The following program shows the Desire class for the AST application Desire java package agent import java util import java sql public class Desire private Connection connection public Desire Connection x constructor this connection x public boolean achievable String goal try 1 Statement st connection createStatement String sql SELECT Symbol FROM knowledge WHERE Symbol goal ResultSet rs st executeQuery sql if rs next 1 System out printIn rs getString 1 return true j else return false j catch SQLException sglex sqlex printStackTrace System out printIn Desire SQL error return false j j add a new goal ir delete a goal eoe Theoretically we can build an intention class to list a set of plans the agent prepares for possible goals Each plan is represented as a method in the intention class 18 which is a behavioral representation to describe how to achieve a goal under a particular situation represented by a set of states in the belief representation However Java does not support dynamic configuration mapping of a combination of plans which are suitable for the BDI agent concept The
18. 60 3 gt lt tr BGCOLOR A0B8C8 gt lt td align center gt lt b gt lt font face Arial size 3 gt Online Stock Agent lt font gt lt b gt _ lt td gt lt tr gt lt table gt lt center gt lt hr gt lt br gt lt center gt lt h2 gt userID s Trade History lt h2 gt lt center gt lt br gt if trade isEmpty out println lt h3 gt You do not have any trade history lt h3 gt else ShowTradeHistory s new ShowTradeHistory trade out println lt h3 gt You have trade history lt h3 gt lt center gt lt table border width 80 gt for 60 lt tr gt lt b gt lt th gt No lt th gt lt th gt Action lt th gt lt th gt Stock Name lt th gt lt th gt Shares lt th gt lt th gt Paid US lt th gt lt th gt Order Time lt int i 0 th th Deal b tr i s stockName length i out println tr td i td td s action i Weal A A S O lt out println lt table gt lt center gt lt br gt lt b gt Note the last column Deal successful td td LIGN right s shares i lt td gt lt td LIGN right gt s paid i lt td gt lt td gt rdtime i td tr s stockName i lt td gt lt td lt td gt lt td gt s dealli lt b gt Yes means order is No means order is unsuccessful En lt br gt null means order is w
19. Design and Simulation of an Agent based Stock Trader by Xin Feng Master of Computer Science University of North Dakota 2002 A Project Submitted to the Graduate Faculty of the University of North Dakota in partial fulfillment of the requirements for the degree of Master of Science Grand Forks North Dakota May 2002 This report submitted by Xin Feng in partial fulfillment of the requirements for the Degree of Master of Science from the University of North Dakota has been read by the Faculty Advisor under whom the work has been done and is hereby approved Lbr h Permission Title Design and Simulation of an Agent based Stock Trader Department Department of Computer Science Degree Master of Science In presenting this report in partial fulfillment of the requirements for a graduate degree from the University of North Dakota I agree that Department of Computer Science shall make it freely available for inspection I further agree that permission for extensive copying for scholarly purposes may be granted by the professor who supervised my work or in his absence by the Chairperson of the Department Signature Mae ZG Date OS fer 2002 iii Table of Contents LIST OLE ID DES ERU La Er accent c DU eot rM ed vi List of Tables iiio eei un eR RR A et RO Er ARR een vii P Norge c UV viii T Iatroduclioti 9t seat Rea ca laa a E ty tnt leben 1 2 Background or BDI A gent aaa een erstehen 3 CC amos UM EU
20. Details Trade History Sign Out 5 4 Stock Trading Recommendation The recommendation service provides a recommendation to buy hold or sell for a certain stock Actually the expert agent does the background work Once a user selects a stock and clicks on the Recommend button this stock name will be sent to the expert BDI Agent as a goal through the servlet program Then the expert BDI Agent achieves the goal by perform String goal just as we described in the previous sections It checks its desire and current belief to select and execute a suitable plan Finally the expert BDI Agent sends back its achievement the recommendation of the stock to the interface through the servlet program Both Knowledge and BPmap tables Table 2 are related to this session Once the agent performs a certain function needed to get an appropriate recommendation the system shows the result This is the corresponding answer from the export agent With this particular example the AST system recommends the user to hold the ORCL stock continuously Note Above recommendation is not responsible for your profit or loss Get Quotes Recommend Deposit amp Withdraw Make an Order Account Details Trade History Sign Out 25 5 5 Posting An Order Here the user can post his stock order buy or sell stocks and the order management agent will process it for the user The order will be either successful or fail based on the sever
21. Exception e e printStackTrace connection null public void doGet HttpServletRequest req HttpServletResponse res throws ServletException IOException T ttpSession session req getSession false tring userID String session getValue session getId un U rintWriter out res getWriter res setContentType text html out println lt html gt lt body gt lt center gt lt table gt lt tr gt lt td BGCOLOR A0B8C8 gt lt b gt lt font face Arial size 3 gt Online Stock Agent lt font gt lt font size 1 gt Recommend lt font gt lt b gt lt td gt lt tr gt lt table gt lt center gt lt hr gt lt br gt out println form method postaction servlet RecomServlet gt lt center gt lt SELECT NAME sn gt lt OPTION VALUE N DJIN 2Dow lt OPTION VALUE IXIC gt Nasdaq lt OPTION VALUE SPC gt S amp P 500 lt OPTION VALUE ORCL gt Orcal lt OPTION VALUE YHOO gt Yahoo lt SELECT gt lt INPUT TYP VALUE Recommend gt lt center gt lt form gt Gl submit out println lt hr gt lt center gt lt table gt lt tr gt lt td gt lt a href http localhost 8080 quotes html gt Get 54 Quotes lt a gt lt td gt lt td gt lt a href servlet RecomServlet gt Recommend lt a gt lt td gt lt td gt l
22. Value session getId user output println lt html gt lt body gt output println center table width 60 gt 45 lt tr BGCOLOR A0B8C8 gt lt td align center gt lt b gt lt font face Arial size 3 gt Online Stock Agent font b lt td gt lt tr gt lt table gt lt center gt lt hr gt lt br gt output printin lt h3 gt Welcome user you can have services h3 br output println UL else outpu output p output c statemen lt LI gt lt a href http localhost 8080 quotes htm1 gt Get Quotes lt a gt lt LI gt lt a href servlet RecomServlet gt Recommend lt a gt lt LI gt lt a href servlet MoneyServlet gt Deposit amp Withdraw lt a gt lt LI gt lt a href servlet OrderServlet gt Make an Order lt a gt h d lt LI gt lt a href servlet AccountInfServlet gt Account details lt a gt lt LI gt lt a href servlet TradeHistoryServlet gt Trade History lt a gt lt UL gt lt hr gt lt center gt lt font face Arial gt lt a href servlet LogoutServlet gt Sign Out lt a gt lt font gt lt center gt t printin lt H2 gt Incorrect Login Please try again lt h2 gt lt center gt lt font size 1 gt lt a href http localhost 8080 main html gt Login lt a gt lt ont gt lt center gt lt br gt lt H2 gt If you are
23. YHOO 1 0 1 1 1 1 z X APPENDIX 3 Source Codes lt main html gt lt doctype html public w3c dtd html 4 0 transitional en html head meta http equiv Content Type content text html charset iso 8859 1 gt meta name Author content XinFeng gt meta name GENERATOR content Mozilla 4 73 en Win98 I Netscape title Welcome to Online Stock Agent lt title gt lt head gt lt body gt lt center gt lt table gt lt tr gt lt td BGCOLOR A0B8C8 gt lt b gt lt font face Arial gt lt font size 3 gt Welcome to Online Stock Agent lt font gt lt font gt lt b gt lt td gt lt tr gt lt table gt lt center gt lt hr gt lt p gt lt form action http localhost 8080 servlet LoginServlet method post gt lt center gt lt table WIDTH 94 gt lt tr gt lt td BGCOLOR DCDCDC gt lt b gt lt font face Arial gt lt font size 1 gt I m a New er lt font gt lt font gt lt b gt lt td gt lt tr gt e un r gt lt td ALIGN CENTER gt lt b gt lt font face Arial gt lt font size 1 gt lt a ef http localhost 8080 register html gt Register lt a gt lt font gt lt font gt lt lt td gt lt tr gt r td td tr r gt lt td BGCOLOR DCDCDC gt lt b gt lt font face Arial gt lt font size 1 gt I m ready registered lt font gt lt font gt lt b gt lt td gt lt tr gt K ct AOA OBA V
24. a New User Please lt a href http localhost 8080 register html gt REGISTER lt a gt first lt H2 gt rintln lt body gt lt html gt lose t close catch SQL System e Sqlex pr return Exception sqlex rr println ERROR Problems with finding an entry intStackTrace public void destroy try connecti on close catch Exception e System e rr println Problem closing the database public String getServletInfo return The Login Servlet gives a login client services 46 LogoutServlet java import java io import javax servlet import javax servlet http import java util import java sql public class LogoutServlet extends HttpServlet public void doGet HttpServletRequest req HttpServletResponse res throws ServletException IOException T ttpSession session req getSession false session invalidate PrintWriter output res getWriter res setContentType text html output println lt html gt lt head gt lt title gt Logout lt title gt lt head gt lt body gt lt center gt lt table width 60 gt lt tr bgcolor a0b8c8 gt lt td align center gt lt b gt lt font face Arial size 3 gt Online Stock Agent lt font gt lt b gt lt td gt lt tr gt lt table gt lt hr gt lt br gt lt table width 90 gt
25. account details ca 44 LoginServlet java import java io import javax servlet import javax servlet http import java util import java sql public class LoginServlet extends HttpServlet private Statement statement null private Connection connection null private String URL jdbc odbc ASTdb super init config try Class forName sun jdbc odbc JdbcOdbcDriver connection DriverManager getConnection URL catch Exception e e printStackTrace connection null public void init ServletConfig config throws ServletException public void doPost HttpServletRequest req HttpServletResponse res throws ServletException IOException String user pswd user req getParameter login pswd req getParameter password PrintWriter output res getWriter res setContentType text html if user equals pswd equals output println H3 Please click the back button and fill in User ID and Password H3 output close return try String query SELECT FROM client where userID user AND password pswd statement connection createStatement ResultSet rs statement executeQuery query boolean success rs next if success HttpSession session req getSession true session put
26. aiting out println lt hr gt lt center gt lt table gt lt tr gt lt td gt lt a href ht tp localhos t 8080 quotes html gt Get Quotes lt a gt lt td gt lt td gt lt a href s rvl t RecomServlet gt Recommend lt a gt lt td gt lt td gt lt a h Withdraw lt ref s T ref a gt lt rvl servlet MoneyServlet gt Deposit amp td gt lt td gt lt a t OrderServlet gt Make an Order lt a gt lt td gt lt td gt lt a h ref Details lt a gt lt td gt href se History lt a gt lt td gt lt tr gt lt table gt lt font face Arial gt lt a href se rvle rvle servlet AccountInfServlet gt Account lt td gt lt a t TradeHistoryServlet gt Trade t LogoutServlet gt Sign Out lt a gt lt font gt lt center gt out println lt body gt lt html gt out close public void destroy try connection close catch Exception System err println e Problem closing the database public String getServletInfo return The TradeHistory Servlet shows a client s trade history 61 Agent java package agent import java util import java sql public class Agent public Belief B public Desire D public Intention I public Agent Connection x D new Desire x B new Belief x I new Intention x
27. al reasons such as the availability of the stock in the market to buy and the availability of the funds to buy the stock and etc In our system we simply use the random function to decide an order successful or fail since we cannot access to the real stock market The related tables in the database are Client Holding and Orders Table 2 hip Nocshoit EO00 servet OrderS ervet Gt You have 47000 0 cash available in your account Action Symbol of Shares Price USS esa C Sell Sum Note If you don t hava enough cash to buy of shares above buy as many as possible You only can sell as many as possible 4 of shares stocks that you are holding Get Quotes Recommend Deposit amp Withdraw Make an Order Account Details Trade History Sign Out S 6 Account Details and Trading History The account detail option in the main menu can be selected to see the user s account in detail It shows what stocks and how much money the user owns The tables Client and Holding Table 2 relate to this session xin s Account Details You have stocks Stock Name Shares ORCL 100 YHOO 145 Your money balance is 47000 0 Get Quotes Recommend Deposit amp Withdraw Make an Order Account Details Trade History Sign Out A user may select the trading history option to see his all trade history in the current past which includes successful deals unsuccessful
28. connection userID do uble b sb holdmoney PrintWriter out res getWriter res setContentType text html out println lt html gt lt body gt lt center gt lt table gt lt tr gt lt td BGCOLOR A0B8C8 gt lt b gt lt font face Arial size 3 gt Online Stock Agent lt font gt lt font size 1 gt Order Manager lt font gt lt b gt lt td gt lt tr gt lt table gt lt center gt lt hr gt lt br gt out println h3 You have b cash available in your account lt h3 gt lt br gt out println form method post action servlet OrderServlet gt lt center gt lt table width 70 gt _ lt tr gt lt th gt lt b gt lt font size l gt Action lt font gt lt b gt lt th gt _ lt th gt lt b gt lt font size 1 gt Symbol lt font gt lt b gt lt th gt lt th gt lt b gt lt font size 1 gt of Shares lt font gt lt b gt lt th gt lt th gt lt b gt lt font 51 size 1 gt Price US lt ont gt lt b gt lt th gt lt tr gt tr td input type radio name action value buy checked gt Buy lt br gt lt input type radio name action value sell gt Sell lt td gt lt td gt lt input name symbol size 20 gt lt td gt lt td gt lt input name shares size 20 gt lt td gt lt td gt lt input name price size 20 gt lt td gt lt tr gt lt tr gt lt t
29. d align center colspan 4 gt lt input type submit value Submit gt lt td gt lt tr gt lt tr gt lt td colspan 4 gt lt b gt Note lt b gt lt br gt If you don t hava enough cash to buy lt b gt of shares lt b gt above buy as many as possible lt br gt You only can sell as many as possible of shares stocks that you are holding lt td gt lt tr gt lt table gt lt center gt lt form gt lt hr gt lt center gt lt table gt lt tr gt lt td gt lt a href http localhost 8080 quotes html gt Get Quotes lt a gt lt td gt lt td gt lt a href servlet RecomServlet gt Recommend lt a gt lt td gt lt td gt lt a href servlet MoneyServlet gt Deposit amp Withdraw lt a gt lt td gt lt td gt lt a href servlet OrderServlet gt Make an Order lt a gt lt td gt lt td gt lt a href servlet AccountInfServlet gt Account Details lt a gt lt td gt lt td gt lt a href servlet TradeHistoryServlet gt Trade History lt a gt lt td gt lt tr gt lt table gt lt center gt lt center gt lt font face Arial gt lt a href servlet LogoutServlet gt Sign Out lt a gt lt font gt lt center gt out println lt body gt lt html gt out close public void doPost HttpServletRequest req HttpServletResponse res th H oO on rm nn un un K MI o ct ct ct Q ct ct ct
30. dding new entry e printStackTrace return false 58 return true public void destroy try connection close catch Exception e System err println Problem closing the database im im im im im im pu 59 TradeHistoryServlet java show client s trade history action stocks shares paid ordtime deal port java io port javax servlet port javax servlet http port java util port java sql port stockpg my package blic class TradeHistoryServlet extends HttpServlet private Statement statement null private Connection connection null private String URL jdbc odbc ASTdb public void init ServletConfig config throws Servlet Exception super init config try Class forName sun jdbc odbc JdbcOdbcDriver connection DriverManager getConnection URL catch Exception e e printStackTrace connection null public void doGet HttpServletRequest req HttpServletResponse res throws ServletException IOException HttpSession session req getSession false String userID String session getValue session getId if userID null Show disp new Show connection userID Vector trade disp trade PrintWriter out res getWriter res setContentType text html out println lt html gt lt body gt lt center gt lt table width
31. deals and deals in processing VIE xin s Trade History You have trade history No Action Stock Name Shares Paid USS Order Time Deal 0 Buy YHOO 100 135 21 6 12 00 10 30 00 AM Yes 1 Bu ORCL 100 78 55 6 14 00 Yes 2 Buy YHOO 100 100 0 Mon Jun 19 12 49 15 CDT 2000 Yes 3 Bw YHOO 45 100 0 Mon Jun 19 14 06 05 CDT 2000 Yes 4 Sel YHOO 100 145 0 Mon Jun 19 14 21 19 CDT 2000 No 5 sd YHOO 100 145 0 Mon Jun 20 14 27 10 CDT 2000 No 100 145 0 Mon Jun 21 14 34 33 CDT 2000 Ye Note In the last column Deal Yes means order is successful No means order is unsuccessful null means order is waiting Get Quotes Recommend Deposit amp Withdraw Make an Order Account Details Trade History Sign Out 27 The fund manager handles both deposit and withdraw for the user Your balance is 47000 0 Amount US 6 CONCLUSIONS Agent based computing is emerged as a new computing paradigm The BDI model is one of the powerful techniques to describe autonomous intelligent agents In this report we have presented a stock trading application based on intelligent agents using the BDI model One of the merits of this work is to show how nicely we can use the object oriented language Java to implement the BDl agent based application The Java programming language does not support any construct for the BDl agent concepts However in our work the agent and its belief desire and intention are programm
32. e for its belief The getBelief String goal function accesses the belief knowledge base based on the current goal getBelief String goal and performs some mathematical and stochastic equations to calculate the exact current environment surrounding the goal Even though in this example application we use a just simple summation formula in the real application any heuristic formula can be used to diagnose the exact case and stock market 16 Belief java package agent import java util import java sql public class Belief private Connection connection public Belief Connection x this connection x public Connection getConnect return connection Get believes according to the desire public int getBelief String goal try 1 Statement st connection createStatement String sql SELECT FROM knowledge WHERE Symbol goal ResultSet rs st executeQuery sq boolean more rs next if more int sum 0 ResultSetMetaData rsmd rs getMetaData for int i 2 i lt rsmd getColumnCount i 1st element Symbol sum rs getInt 1 System out printIn sum sum return sum A value of belief synthesis j else return 11111 11111 is the false flag catch SQLException sqlex sqlex printStackTrace System out println Desire SQL error n return 11111 A false flag j j update believes of the desire Ma s The Desire class accesses
33. e AST database To map the corresponding plans in the intention dynamically based on both the current goal defined in the desire and the current environment based on the belief another table BPmap has been used in the AST system The table Client holds clients account information The table Holding keeps the information of stocks owned by clients The table Orders keeps the information of orders which clients post and the AST agent should process Among contents in the AST database the table Knowledge is the most important table to manipulate the BDI information dynamically The following table Knowledge shows a knowledge base for desire and belief Table 3 Table3 AST Database Knowledge Table Definition AST BDI Knowledge Field Name Data Type Description Symbol Text Stock name A Number World economy B Number US economy C Number Financial markets and institutions E Number Others F Number Buy or sell market Belief Number The result of analysis of A F 13 The stock name Symbol is a kind of desire to get any recommendation on its stocks through the stock market for stock exchange either selling or buying For example the Symbol may hold desire that represents a certain stock of company such as ORCL Oracle YHOO Yahoo IBM IBM MS Microsoft and etc The knowledge A through F represents its belief that represents the current environment surr
34. e following BDI mapping table Table 1 that includes current states of belief desires to achieve and its corresponding intentions By using this BDI mapping table we can manipulate dynamically belief desire and intention at runtime We can also show mapping among them and we can change their mapping dynamically at runtime 10 Table 1 BDI Mapping Table Belief Desire Intention Bi Di Ii Bk Dk Ik A proactive BDI agent acts based on a goal scans beliefs finds an intention based on them and achieves the goal by executing the intention Figure 2a A reactive BDI agent reacts based on belief finds a goal and its intention based on it can also affect its belief Figure 2b DeLoach also mentioned about a goal directed behavior DeLoach 99 for proactive agents Reactive BDI agent Proactive BDI agent ale D pC nenion gt Figure 2 2a amp 2b Proactive Reactive BDI Agents 11 The AST application starts by initiating a certain goal defined in the desire definition Based on specific belief an intention is chosen to achieve the goal based on current states of belief There may be several sophisticated plans for each intention Each plan triggers the event handler to achieve the goal based on behavioral description in each plan An intention consists of a combination of one or more plans In our current implementation we use only one plan for each intention To implement the concept of
35. ed as Java classes Its information of desire belief and intention are stored in a database and updated dynamically at runtime as the environment changes Therefore in our work we show how nicely we can use the Java programming language to program the BDI agent based application by using a database to implement the knowledge base for BDIs We also show how we can manipulate BDIs dynamically at runtime without having any trouble while Java does not support any runtime knowledge management Our work also shows how we can implement a real world application like stock trading using the BDI agent model to represent the real world problem more naturally in a better way The Java Servlet programming technique on the Internet has been used to implement our prototype system 28 7 ACKNOWLEDGMENTS This work has been partially supported by the EPSCoR IIP Seed Grant 4709 0701 in summer 2001 29 1 2 3 4 5 6 7 8 REFERENCES Agent Oriented Software Pty Ltd JACK Intelligent Agents User Guide http www agent software com au 1999 Bratman Michael E Intention Plans and Practical Reason Harvard Univ Press 1987 also by CSLI Publication 1999 Busetta Paolo and Ramamohanarao Kotagiri The BDIM Agent Toolkit Design Technical Report 97 15 Department of computer Science The University of Melbourne Australia 1997 http www cs mu oz au publications tr_db TR html Busetta Paol
36. edge Table Definition eseeeeeeee 12 4 Sample Values in Knowledge Table ccc cece cee ce cece eee ee eee e ne ee nena eee enes 13 5 Bpmap Table Definition criera t ru ni 14 6 Sample Values in Bpmap Table sa asia 14 TeChent Table DEMHON uec err a Iv Saya aus ME ER E Eien 37 8 Orders Table Definition sensi edee sot HR 37 9 Holdinge Fable DetinittOth is sedes ie pip ieai an E Oe pa eade ae 38 10 Sample Data in ASTdb mdb for MS Access 2 22cssessesssssessensseenenen een 38 vil ABSTRACT In this report we introduce a noble implementation scheme of the Belief Desire Intention BDI model to be used in an agent based application using Java The example prototype system is the Agent based Stock Trader AST that is a stock trading expert based on intelligent agents Agents in AST are based on the Belief Desire Intention BDI model in artificial intelligence This report proposes how to program the BDI based agents using the Java programming language and how to make an agent based application more intelligent and flexible This study contributes new implementation scheme of the BDI agents in the Java programming language useful on many applications This work also shows how nicely implement the BDI agents with Java while manipulating BDIs intelligently and dynamically at runtime Using our concepts and implementation scheme the internet based application like stock trading can be more intelligent and f
37. et of basic services For example a new client can register and open an account after logging in the client can get a set of services such as deposit withdraw money buy sell stocks check stock prices check his account detail and trading history AST also facilitates the service of recommendation based on its knowledge base Since we cannot access to the real stock market we just simply simulate one by building an AST database Figure 4 presents the structure of AST package and contents 2 Requirements e Operating System This release has been tested on the following platforms Windows 95 98 e JDK Install JDK1 1 8 or up version http java sun com products jdk 1 2 install windows html e JSWDK1 0 1 Download and install JSWDK1 0 1 at http java sun com 32 ASTpackage 39 Readme User manual Money ASTdb Access database Order ShowHoldStocks AccountInfServlet ShowTradeHistory LoginServlet main html LogoutServlet MoneyServlet register html OrderServlet Quotes html RecomServlet RegisterServlet TradeHistoryServlet Agent Belief Desire Intention Figure 4 ASTpackage Structure e Environment variables l Add the full path of the JDK bin directory where the java command is located to the PATH variable To do so click Start Run and enter Sysedit Open and edit the AUTOEXEC BAT file and add or change the PATH statement Add the tools jar from the JDK l
38. gt fields are required lt td gt lt tr gt lt tr gt lt td ALIGN CENTER gt lt input type submit value Submit gt lt td gt lt tr gt lt table gt lt center gt lt from gt lt body gt lt html gt 41 lt quotes html gt lt doctype html public w3c dtd html 4 0 transitional en gt lt html gt lt head gt lt meta http equiv Content Type content text html charset iso 8859 1 gt lt meta name Author content xinfeng gt meta name GENERATOR content Mozilla 4 73 en Win98 I Netscape gt lt title gt Online Stock Agent Quotes lt title gt lt head gt lt body gt lt center gt lt table WIDTH 60 gt tr BGCOLOR A0B8C8 gt td ALIGN CENTER gt lt b gt lt font face Arial gt lt font size 3 gt Online Stock Agent lt font gt lt font gt lt b gt lt td gt lt tr gt lt table gt lt center gt lt hr gt lt center gt lt h2 gt Stock Quotes from Yahoo lt h2 gt lt center gt lt form method get action http finance yahoo com q target _blank gt Enter one lt b gt or more lt b gt ticker symbols or you may lt a href http finance yahoo com 1 target blank look up the symbol lt a gt by company name lt br gt lt input type text name s size 30 gt lt input type submit value Get Quotes gt lt select name d gt lt option value vl selected gt Basic lt option value v2 gt DayWatch lt opt
39. h the corresponding plans are selected Both Plan and PlanChoice are to choose plans defined in the AST intention which can be selected by a certain rules defined in the AST system based on the current goal desire and the current situation belief The following table shows some example values for each column in BPmap table Table 6 Table 6 Sample Values in BPmap Table Values in Bpmap LowLimit UpLimit Plan PlanChoice 3 3 Hold 4 The Plan may have recommendation values for stock exchange such as Strongly Sell Moderate Sell Hold Moderate Buy or Strongly Buy The PlanChoice holds the identification number for each plan defined in the AST intention definition Theoretically we may have one or a combination of plans However to make this example simple we use only one plan as a recommendation value 15 4 3 How To Program BDI Agents The stock trading agent can be created by defining its own Belief Desire and Intention classes The agent has its own main controller whose control structure is shown in Figure 3 Intended goal BDI agent main controller Desire Determination False True Ask others for Belief Determination help False True Exception handling Intention Determination False True Exception handling Selected plan Figure 3 BDI Agent Runtime Control The following code is the Belief class to access and update the knowledge bas
40. he data source ASTdb Click OK to dismiss the dialog e Copy HTML files Copy main html quotes html and register html from the Appendix 3 to the directory jswdk 1 0 1 webpages e Install servlet classes Copy all contents in ASTpackage code directory to the directory jswdk 1 0 1 webpages WEB inf servlet 4 Operation procedure e Start server To start the server open the directory with Windows Explorer and double click on STARTSERVER BAT in JSWDK1 0 1 directory If this does not work you can try opening a DOS window and running it from there e Start user interface To start the user interface open your web browser Either Internet Explorer or Netscape Navigator will be fine Use your browser to access the following address http localhost 8080 main html Then the main user 36 interface which is login entry will be brought to user You can start to test AST and monitor the server window If you test AST from a remote computer you have to find out the IP address or domain name DN of the server computer that you have installed AST application in Then you access to the IP address or DN of the server instead of localhost e Stop server To stop the server open Windows Explorer and double click on STOPSERVER BAT in JSWDK1 0 1 directory If this doesn t work you can try opening a DOS window and running it from there S Features and Deficiencies The AST system starts with the entry form of user login The registered users
41. ib directory file to your CLASSPATH variable Save AUTOEXEC BAT and close it Restart your computer 34 3 Copy servlet jar from JSWDK1 0 1 lib directory file to your JDK extensions directory the directory c jdk1 2 2 jre lib ext on windows e Microsoft Access To execute this application you need to have a database system like Microsoft Access ODBC for MS Access database is provided with windows system You need to set up the AST database file as described in the following section 3 Install AST e Register AST database AST database named ASTdb mdb contains five tables To connect to the database an ODBC Data Source must be registered with the system through the ODBC Data Sources option in the Windows Control Panel 1 Double click this option to display the ODBC Data Source Administrator dialog 2 Select the User DSN tab is selected then click ADD to display the Create New Data Source dialog 3 Select Microsoft Access Driver and click Finish Then the ODBC Microsoft Access 97 Setup dialog appears 4 Click on Select button to display the Select Database dialog Use this dialog to locate and select the ASTdb mdb file on your system Click OK to return to the ODBC Microsoft Access 97 Setup dialog 35 5 Enter the name ASTdb in the Data Source Name text field Enter a description 6 Click OK to dismiss ODBC Microsoft Access 97 Setup dialog 7 Notice that the ODBC Data Source Administrator dialog now contains t
42. ile them if a modification is needed In our work we have built a BDI agent directly in Java with the help of database so that a user can handle the BDI agent dynamically by manipulating the relations among the agent s belief desire and intention defined in the BDI knowledge base at runtime 3 DESIGN OF AST 3 1 The Architecture of AST The following figure shows the conceptual overview of the AST system Three tiered design is considered to make the AST system components portable and flexible Figure 1 Interface users Web Page Servlet Controller send goal return result Figure 1 The Architecture of AST The whole system consists three tiers The first tier is the Servlet Controller which is a link between users and BDI agents It provides user interface and dynamically 7 generates corresponding web pages It includes all kinds of objective servlets that perform different functions such as registration deposit withdraw money buy sell stocks check stock prices check account status and trading history or give recommendations through BDI agent The second tier consists of the BDI agents which are the core part of AST business The third tier is a data access layer where all information about the AST system such as the BDI agent s beliefs and the knowledge base are stored In AST we use relational database to represent the beliefs and the knowledge base When a user asks to find the recommendation of a specific stock
43. int i 0 i lt s stockName length i out println lt tr gt lt td gt s stockName i td td ALIGN right gt s shares i lt td gt lt tr gt out println lt table gt lt center gt lt br gt out println lt h3 gt Your money balance is lt h3 gt lt center gt lt b gt lt b gt holdmoney lt center gt lt hr gt Add other links out println lt center gt lt table gt lt tr gt lt td gt lt a href http localhost 8080 quotes html gt Get Quotes lt a gt lt td gt lt td gt lt a href servlet RecomServlet gt Recommend lt a gt lt td gt lt td gt lt a href servlet MoneyServlet gt Deposit amp Withdraw lt a gt lt td gt lt td gt lt a href servlet OrderServlet gt Make an Order lt a gt lt td gt lt td gt lt a href servlet AccountInfServlet gt Account etails lt a gt lt td gt lt td gt lt a D href servlet TradeHistoryServlet gt Trade History lt a gt lt td gt lt tr gt lt table gt lt font face Arial gt href servlet LogoutServlet gt Sign Out lt a gt lt font gt lt center gt out println lt body gt lt html gt out close public void destroy try connection close catch System err println Exception e Problem closing the database public String getServletInfo return The AccountInfo Servlet shows a client s
44. ion value v4 gt Fundamentals lt option value t gt Detailed lt option value 1y Chart option value r gt Research lt select gt lt form gt lt br gt lt hr gt lt center gt lt table gt lt tr gt lt td gt lt a href http localhost 8080 quotes html gt Get Quotes lt a gt lt td gt lt td gt lt a href servlet RecomServlet gt Recommend lt a gt lt td gt lt td gt lt a href servlet MoneyServlet gt Deposit amp amp Withdraw lt a gt lt td gt lt lt lt td gt lt a href servlet OrderServlet gt Make an Order lt a gt lt td gt td gt lt a href servlet AccountInfServlet gt Account Details lt a gt lt td gt td gt lt a href servlet TradeHistoryServlet gt Trade History lt a gt lt td gt lt tr gt lt table gt lt center gt lt center gt lt font face Arial gt lt a href servlet LogoutServlet gt Sign Out lt a gt lt font gt lt center gt lt body gt lt html gt 42 AccountInfServlet java Shows client s account information stocks shares money import java io import javax servlet import javax servlet http import java util import java sql import stockpg my package public class AccountInfServlet extends HttpServlet rivate Statement statement null rivate Connection connection null rivate String URL jdbc odbc ASTdb FOG g public void init ServletConfig config throws ServletException
45. kpg import java util public class ShowTradeHistory public String action public String stockName public int shares public double paid public String ordtime public String deal public ShowTradeHistory Vector v int SIZE v size System out println number of records is SIZI action new String SIZE stockName new String SIZE shares new int SIZE paid new double SIZE ordtime new String SIZE deal new String SIZE Gl for int n 0 n v size n Vector r new Vector r addElement v elementAt n Enumeration enum r elements StringBuffer buf new StringBuffer while enum hasMoreElements buf append enum nextElement buf deleteCharAt 0 buf deleteCharAt buf length 1 String str new String buf StringTokenizer strtok new StringTokenizer str action n strtok nextToken stockName n strtok nextToken StringBuffer sbl new StringBuffer sbl append strtok nextToken sbl delete 0 1 shares n Integer parseInt sbl toString StringBuffer sb2 new StringBuffer sb2 append strtok nextToken sb2 delete 0 1 paid n Double parseDouble sb2 toString ordtime n strtok nextToken deal n strtok nextToken
46. lexible vii 1 INTRODUCTION With the introduction of Internet online investment comes true and lots of online brokers appear But compared with traditional brokerages most of online brokerages will not call clients with a hot stock tip or track clients down to tell clients one of your securities is in trouble and you should sell So we propose to create an Agent based Stock Trader AST that is intelligent to facilitate the service of recommendation It means the AST can give clients some useful recommendations and help clients to make right decisions just like traditional agents The AST has its own knowledge base It can continue learning new knowledge at run time and keep updating its knowledge base This online agent also provides a set of basic services such as new clients registration open an account deposit withdraw money buy sell stocks check stock prices check account status and trading history Since we cannot access to the real stock market we just simply simulate one by building the stock database However the concept and implementation scheme used in this project can be applicable to the real world problem The procedure and methodology is based on object oriented analysis and design to develop this agent oriented program The theoretical Belief Desire Intention BDI model of artificial intelligence is used to implement the online agent s intelligence Three tiered design is considered HTML Java Servlet JSWDK
47. lt tr gt lt table gt lt font face Arial gt lt a ref servlet LogoutServlet gt Sign ut a font center output println lt body gt lt html gt output close D m oy rss public void destroy try connection close catch Exception e System err println Problem closing the database public String getServletInfo return The Money Servlet manages money deposit and withdraw im im im im im im pu O po po po po po po bl p p P j j j pQL CDCTTP ETE 50 rderServlet java ava io avax servlet avax servlet http java util 7 java sql rt stockpg ic class OrderServlet extends HttpServlet rivate Statement statement null rivate Connection connection null rivate String URL jdbc odbc ASTdb super init config try Class forName sun jdbc odbc JdbcOdbcDriver connection DriverManager getConnection URL catch Exception e e printStackTrace connection null public void doGet HttpServletRequest req HttpServletRespons th Ht st public void init ServletConfig config throws ServletException res rows ServletException IOException tpSession session req getSession false ring userID String session getValue session getId Show sb new Show
48. may login with their user Ids and passwords The new user may register into the system with a unique id After successful login a list of services regarding online stock trading that AST can provide appears Currently the prototype system provides six services such as getting quotes recommendation for stock trading deposit withdraw order placement account details and trading history Getting Quotes service is borrowed from Yahoo due to the limitation of accessing to a real stock market database The same reason for order service we use a random function to process an order during a time period Recommendation service is based on the BDI agent which runs dynamically according to the manipulation of its knowledge base and the BDI mapping table APPENDIX 2 ASTdb Access Database ASTdb Access Database contains 5 tables The details are shown at Table 2 p 11 The definitions of Knowledge Table and Bpmap Table are shown at Table 3 p 12 and Table 5 p 14 The other tables definitions are shown at the following tables Table 7 Client Table Definition Field Name Data Type Description UserID Text User Id primary key Password Text Password Lname Text last name Fname Text First name Email Text email address Other Text other information Cash Number Double money on the account Table 8 Orders Table Definition Field Name Data Type Description OrdNum Number int Order
49. n based on history information or stock is different Agent itself can autonomously decide which plan will be executed according its current situation at runtime The BDI knowledgebase helps this dynamic decision and manipulation 4 HOW TO IMPLEMENT BDI AGENTS In this section we describe how to implement agents based on the BDI agent concept using Java 4 1 Agent Based Programming Language Agent based programming is a new programming paradigm that has been arisen from research in distributed artificial intelligence Unfortunately we have no proper agent based programming language to implement the BDI agent concept well We have decided to use the Java programming language to implement encapsulation of agents However Java does not support the BDI agent concept Therefore we have to devise some mechanism to support the BDI concept on Java We discuss here how to implement the BDI agents using Java with knowledge base 4 2 How To Implement BDI Agents Java is a fully object oriented platform independent language and has a sufficient standard class library including network programming facilities It provides a natural way to develop internet based or web based applications Agent based applications can be also developed in Java Maybe it is not natural but it seems to be suitable In AST we use a relational database to represent an agent s belief including the agent s knowledge base and the environment states We have designed th
50. n is chosen to achieve the given goal using the information of belief I selectPlan b S EXAMPLE SESSIONS Here we show some example sessions using AST 5 1 Login Entry The AST system starts with the entry form of user login The registered users may login with their user Ids and passwords The new user may register into the system This session is related to the table Client in the database Table 2 Here is a snapshot of the entry login form Register I m a New User I m already registered User ID Password FT tes 5 2 Basic Services After successful login a list of services regarding online stock trading that AST can provide appears Currently the prototype system provides six services such as getting 21 22 quotes recommendation for stock trading deposit withdraw order placement account details and trading history D Welcome xin you can have services Get Quotes Deposit amp Withdraw Account details Trade History 5 3 Stock Quotation The selection of the stock quote option brings the user to the stock quotation menu We borrow the Stock Quotes from Yahoo Yahoo 00 due to the limitation of accessing to a real stock market database Stock Quotes from Yahoo Enter one or more ticker symbols or you may look up the symbol by company name e s Get Quotes Recommend Deposit amp Withdraw Make an Order Account
51. nt st money show holdmoney num show checkhold stock if act equalsIgnoreCase Buy double total shrs price if money 0 no money cannot buy return No money available can t buy any stocks if money lt total no enough money this shrs int money price if act equalsIgnoreCase Sell if num 1 donot have this stock cannot sell it return You don t have this stock can t sell it else if num lt shrs donot have so many shares this shrs num only can sell holding shares 67 try st connection createStatement String sqll SELECT MAX OrdNum FROM orders ResultSet rsl st executeQuery sqll if rsl next OrdNo rsl getLong 1 1 java util Date ud new java util Date hm ud getHours 60 ud getMinutes String sql INSERT INTO orders OrdNum userID Action Symbol Shrs Paid OrdTime VALUES OrdNo Ty em p ID 4 t back a oP decstock this shrs price ud tostrling 4 5 int rs st executeUpdate sql if rs 1 return Your order is posted successfully and is processing else return Your order post is UNsuccessful catch SQLException sqlex sqlex printStackTrace return Update datebase SOL fail public void processOrder int temphm do java util Date temp new java util Date temphm temp ge
52. number primary key UserID Text User id primary foreign key Action Text Sell or Buy Symbol Text Stock name Shrs Number int The shares of the stock Paid Number Double The price of each share OrdTime Text The time of an order pasted Deal Text Wait or Yes or No 37 38 Table 9 Holding Table Definition Field Name Data Type Description UserID Text User Id primary key foreign key Symbol Text stock name Shrs Number int Shares We give some sample data in AST access database which are shown in the following table Table 10 Sample Data in ASTdb mdb for MS Access userID password LName Name Email other cash p 5 on OrdNum seriD Action symbol shes feai OrdTime Dea I xin buy YHOO 100 IO Thu Sep 06 14 35 11 PDT 2001 2 xin buy YHOO 300 1O Thu Sep 06 14 43 25 PDT 2001 Yes 2 3 xin sell YHOO 100 20 Wed Jan 30 11 32 55 PST 2002 No gt 4 xin sell YHOO 100 20 Wed Jan 30 11 39 10 PST 2002 Yes o 5 xin buy forcl 100 10 Wed Jan 30 11 45 34 PST 2002 No 6 xin buy Jorcl 200 10 Wed Jan 30 11 52 42 PST 2002 Yes 7 xin sell Jorcl 100 15 Wed Jan 30 15 16 14 PST 2002 Yes 8 xin buy IBM 100 100 Wed Jan 30 15 20 47 PST 2002 Yes LowLimit UpLimit Plan PlanChoice a 1000 10 Strong Sell 1 E 10 3 Miderate Sell 2 m 3 3 hold 3 3 10 Miderate Buy 4 10 1000 Strong Buy 5 g Symbol D a ORCL 2 2
53. o and Ramamohanarao Kotagiri An architecture for Mobile BDI Agent Mobile Computing Track ACM SAC 98 7 8 1998 DeLoach Scott A Multiagent Systems Engineering A Methodology and Languages for Designing Agent Systems http en afit af mil ai publications Conference aois 99 MaSE AOIS99 htm 1999 Franklin Stan and Graesser Art Is it an Agent or just a Program A Taxonomy for Autonomous Agents http www msci memphis edu franklin AgentProg html Also in the Proc of the 3 International Workshop on Agent Theories Architectures and Languages Springer Verlag 2 7 1996 Huber Marcus J JAM A BDI theoretic Mobile Agent Architecture Proc Of the Autonomous Agents 99 Seattle USA 236 243 1999 30 31 8 Jo Chang Hyun Agent based Programming Language APL ACM SAC 2002 Conference Madrid Spain 27 31 March 2002 9 Petrie Charles J Agent Based Engineering the Web and Intelligence http www cdr stanford edu NextLink Expert html also appeared in the IEEE Expert December 1996 10 Yahoo Stock Quotes http finance yahoo com 2000 APPENDICES APPENDIX 1 Agent based Stock Trader AST User Manual APPENDIX 2 ASTdb Access Database APPENDIX 3 Source Codes APPENDIX 1 Agent based Stock Trader AST User Manual Readme doc 1 Introduction Agent Based Stock Trader AST is an Internet based application project using BDI agent concepts in Java programming language AST provides a s
54. ort java sql blic class RegisterServlet extends HttpServlet rivate Statement statement null rivate Connection connection null p p private String URL jdbc odbc ASTdb public void init ServletConfig config super init config throws ServletException mw mw try Class forName sun jdbc odbc JdbcOdbcDriver connection DriverManager getConnection URL catch Exception e e printStackTrace connection null public void doPos t HttpServletRequest req throws ServletException IOException String userID pswdl pswd2 email userID req g pswdl req ge pswd2 req ge mail req g firstName re lastName req other req get tParameter Parameter pwdl Parameter pwd2 Parameter Email getParameter getParameter Parameter other login Q tead s getWriter PrintWriter output r text html res setContentType try String query SELECT FROM client wher firstName FirstName LastName HttpServletResponse r lastName userID 4 CUD 4 rm r use statement connec ResultSet rs stat ment boolean inuse rs next if inuse output printin ELK LHBS nu tion createStatement xecuteQuery query lt H3 gt User Id is already used please r S other S
55. ounding its stock Its belief holds the values that represent the current status of environment such as world economy US economy financial markets and institutions other factors and buy sell market The final field Belief holds the value that we can get from the analysis of the belief factors A F by applying certain mathematical and stochastic equations In summary the Symbol keeps the value of current goal desire the values from A to F keep the current environment belief and the value of Belief is synthesized from the values of A through F The following table shows possible values for the table Knowledge Table 4 Table 4 Sample Values in Knowledge Table Values in Knowledge Symbol A B C D E F Belief YHOO 1 0 1 1 1 1 3 The following table shows the table BPmap that describes the mapping to the corresponding plans defined in the intention from the information based on the current environment defined in the belief Table 5 Therefore it is a kind of mapping table from belief to intention 14 Table 5 BPmap Table Definition Bpmap Field Name Data Type Description LowLimit Number Lower limit of belief UpLimit Number Upper limit of belief Plan Text Corresponding plan PlanChoice Text Choice of a plan The condition fields LowLimt and UpLimit represent the lower limit and upper limit of the value of belief from whic
56. println Show trade error test error Vector dt new Vector return dt A client holds what and how many stocks public Vector holdstocks Statement st ResultSet rs try st connection createStatement String sql SELECT Symbol Shrs FROM holding WHERE userID WU E ID stet rs st executeQuery sql return displayResult rs catch SQLException sqlex sqlex printStackTrace Vector dt new Vector return dt 70 Check a client has how many shares of a certain shock public long checkhold String stock try Statement st connection createStatement String sql SELECT Shrs FROM holding WHERE userID ID U AND Symbol stock ResultSet rs st executeQuery sql if rs next return rs getLong 1 else return 1 donot have this stock catch SQLException sqlex sqlex printStackTrace return 1 sql error A client has how much money public double holdmoney Statement st ResultSet rs try st connection createStatement String sql SELECT cash FROM client WHERE userID ID rs st executeQuery sql rs next return rs getDouble 1 may return 0 catch SQLException sqlex sqlex printStackTrace return 1 sql error private Vector displayResult ResultSet rs
57. r gt 4 symbol rs lt center gt lt br gt lt br gt lt b gt Note Above recommendation is not responsible for your profit or loss lt b gt output println lt hr gt lt center gt lt table gt lt tr gt lt td gt lt a href http localhost 8080 quotes html gt Get Quotes lt a gt lt td gt lt td gt lt a href servlet RecomServlet gt Recommend lt a gt lt td gt lt td gt lt a href servlet MoneyServlet gt Deposit amp Withdraw lt a gt lt td gt lt td gt lt a ref servlet OrderServlet gt Make an Order lt a gt lt td gt lt td gt lt a href servlet AccountInfServlet gt Account Details lt a gt lt td gt lt td gt lt a href servlet TradeHistoryServlet gt Trade History lt a gt lt td gt lt tr gt lt table gt lt font face Arial gt lt a href servlet LogoutServlet gt Sign Out lt a gt lt font gt lt center gt output println lt body gt lt html gt D 55 output close public void destroy try connection close catch Exception e System err println Problem closing the database public String getServletInfo return The Order Servlet manages buying or selling stocks im im im im im pu 56 RegisterServlet java port java io port javax servlet port javax servlet http port java utlil p
58. refore in our current implementation we use an intention mapping table BPmap in the database to store a set of rules that explain how to dynamically select a suitable plan under a particular situation performed by the selectPlan function Then the agent can dynamically access and monitor its belief through JDBC and SQL statements The following program shows its Intention class Intention java package agent import java util import java sql public class Intention private Connection connection public Intention Connection x this connection x public String selectPlan int bresult try Statement st connection createStatement String sql SELECT Plan FROM BPmap WHERE UpLimit gt bresult and LowLimit lt bresult ResultSet rs st executeQuery sql if rs next 1 String s rs getString 1 System out printIn Intention plan s return S yelse return fail catch SQLException sqlex sglex printStackTrace return fail j 19 update the mapping table We may also have methods to update plans by which we can update the mapping values in the mapping table BPmap table It is a good idea to have a proper programming language to update plans dynamically and more naturally Finally we can create an agent class by declaring its own belief desire and intention from their definitions When a goal is sent to an agent through the desire
59. s have the following properties autonomous perceptive pro active and cooperative DeLoach 99 Agents may have their autonomy and are not controlled directly by the others The perception of agents allows the communication between the agents and their environments Agents can cooperate with other agents to achieve the common goal Intelligent agents have learning ability so that those agents can learn and adapt to new environment to achieve their goals in the better way while learning Agent computing is a new and active research area today Franklin amp Graesser 96 Petrie 96 To realize the intelligent agent computing effectively a model based on Belief Desire and Intention BDI has been proved as a powerful technique Bratman 87 The Belief in BDI of an agent represents the knowledge about itself and the world outside environment of the BDI agent The Desire in BDI represents a goal that the agent likes to achieve The Intention describes a set of plans to achieve the predefined goal or to react to a specific situation There are many possible ways to support agents based on the BDI model Multi paradigm mixed with object oriented programming BDI concepts and logic programming can be a way to support it Another possibility we found was knowledge 4 base manipulation which database supports specific knowledge domain BDI An embedded language such as a query language embedded in the existing languages is another possible sol
60. t a href servlet MoneyServlet gt Deposit amp Withdraw lt a gt lt td gt lt td gt lt a href servlet OrderServlet gt Make an Order lt a gt lt td gt lt td gt lt a href servlet AccountInfServlet gt Account Details lt a gt lt td gt lt td gt lt a href servlet TradeHistoryServlet gt Trade History lt a gt lt td gt lt tr gt lt table gt lt center gt lt center gt lt font face Arial gt lt a href servlet LogoutServlet gt Sign Out a font center out println lt body gt lt html gt out close public void doPost HttpServletRequest req HttpServletResponse res throws ServletException IOException HttpSession session req getSession false String userID String session getValue session getId String symbol req getParameter sn RecomAgent new Agent connection String rs RecomAgent perform symbol go rintWriter output res getWriter s setContentType text html H output println html body output println lt center gt lt table gt lt tr gt lt td BGCOLOR A0B8C8 gt lt b gt lt font face Arial size 3 gt Online Stock Agent font font size l gt Recommend lt font gt lt b gt lt td gt lt tr gt lt table gt lt center gt lt hr gt lt br gt output println lt h3 gt Recommendation lt h3 gt lt br gt lt cente
61. t td gt lt font size 1 gt Already Have One lt a href main html gt Login lt a gt lt font gt lt td gt lt tr gt lt tr gt lt td ALIGN RIGHT gt lt b gt User ID lt b gt lt td gt lt td gt lt input type text name login value autocomplte off size 20 maxlength 32 gt lt td gt lt tr gt lt tr gt lt td ALIGN RIGHT gt lt b gt Passward lt b gt lt td gt SU SE 3 axlength 32 gt lt lt table gt lt cente lt center gt lt table N lt tr gt lt td gt lt b gt Fi lt tr gt lt td gt lt b gt La S lt tr gt lt td gt lt b gt Ema size 50 gt lt td gt lt lt tr gt lt td gt lt b gt Othe size 50 gt lt td gt lt Cr nr lt td gt lt input type password name pwdl value autocomplete off size 20 maxlength 32 gt lt td gt lt tr gt r td ALIGN RIGHT gt lt b gt Retype passward lt b gt lt td gt d gt lt input type password name pwd2 value autocomplete off size 20 td gt lt tr gt r gt WIDTH 943 gt tr gt lt td gt lt b gt lt font size 2 gt Personal Information lt font gt lt b gt lt td gt lt tr gt st Name b input type text name FirstName gt lt td gt lt tr gt t Name lt b gt lt input type text name LastName gt lt td gt lt tr gt il address amp nbsp lt b gt lt input type text name Email r gt Information lt b gt lt input type text name other r gt lt tr gt lt td ALIGN CENTER
62. t type submit value Submit gt lt td gt lt tr gt lt table gt lt center gt lt form gt lt hr gt lt center gt lt table gt lt tr gt lt td gt lt a href http localhost 8080 quotes html gt Get Quotes lt a gt lt td gt lt td gt lt a href servlet RecomServlet gt Recommend lt a gt lt td gt lt td gt lt a href servlet MoneyServlet gt Deposit amp Withdraw lt a gt lt td gt lt td gt lt a href servlet OrderServlet gt Make an Order lt a gt lt td gt lt td gt lt a href servlet AccountInfServlet gt Account Details lt a gt lt td gt lt td gt lt a href servlet TradeHistoryServlet gt Trade History lt a gt lt td gt lt tr gt lt table gt lt center gt lt center gt lt font face Arial gt lt a href servlet LogoutServlet gt Sign Out a font center out println lt body gt lt html gt out close public void doPost HttpServletRequest req HttpServletResponse res throws ServletException IOException HttpSession session req getSession false String userID String session getValue session getId String action req getParameter action double amount double req getParameter amount String money req getParameter amount double amount Double parseDouble money Money m new Money connection userID int mr m manager
63. tHours 60 temp getMinutes while temphm hm lt 3 deal time 3 minutes try Statement st connection createStatement String dord Random r new Random if Math abs r nextInt 2 0 if act equalsIgnoreCase Buy String updtcash UPDATE client SET cash money shrs price WHERE userID ID int rs11 st executeUpdate updtcash if rs11 1 System out println NnBuy cash update success else System out println NnBuy cash update fail String updthold if num 1 updthold INSERT INTO holding VALUES ID mW oUbstogkk t tshrst the 68 else updthold UPDATE holding SET Shrs num shrs WHERE userID ID AND Symbol Stock tu int rs12 st executeUpdate updthold if rs12 1 System out println MnBuy hold update success else System out printin nBuy hold update fail if act equalsIgnoreCase Sell String updtcash UPDATE client SET cash money shrs price WHERE userID ID int rsupcash st executeUpdate updtcash if rsupcash 1 System out printin nSell cash update succecc else System out println MnSell cash update fail String updthold if num shrs 0 updthold DELETE FROM holding WHERE userID ID AND Symbol s
64. the interface agent will send this goal to the agent through the servlet program Then the corresponding agent will check whether it can fulfill this goal If so it will choose proper plans to achieve the goal through its control structure and return the result If not it may directly ask other agents for help or send a failure message back Finally the interface agent generates the web page from which the user can get the recommendation as a result 3 2 The BDI Concepts in AST Agent based Stock Trader AST is a stock trading expert based on intelligent agents which uses BDI model in artificial intelligence Beliefs in AST specify all kind of stocks information related to that agents know Agents have explicit goals to achieve or events Desires to handle The stock names to get recommendation from expert agents in AST can be goals A set of plans Intentions is applied to describe how agents achieve their goals based on certain beliefs Each plan elucidates how to achieve a goal under varying environments In this report we define a belief as a set of states representing environments a desire as a set of goals and an intention as a set of plans The examples shown in the next sections describe how BDI agents work within AST According to the technical analysis of the history and current information of some stocks one plan will be chosen to give its suggestion to help users However another plan may be used if the decision consideratio
65. tock else updthold UPDATE holding SET Shrs num shrs WHERE userID ID AND Symbol Stock p wet int rsuphold st executeUpdate updthold if rsuphold 1 System out printin nSell hold update success else System out println MnSell hold update fail dord UPDATE orders SET Deal Yes WHERE OrdNum OrdNo else dord UPDATE orders SET Deal No WHERE OrdNum OrdNo int rsdord st executeUpdate dord if rsdord 1 System out printlin nOrder processing successed else System out println MnOrder processing failed st close catch SQLException sqlex sqlex printStackTrace return 69 Show java Show client s trade history and holding package stockpg import java util import java sql import java text SimpleDateFormat public class Show private Connection connection null private String ID null public Show Connection x String userID connection x ID new String userID A client trade history public Vector trade Statement st ResultSet rs try st connection createStatement String sql SELECT Action Symbol Shrs Paid OrdTime Deal FROM orders WHERE userID ID rs st executeQuery sql return displayResult rs catch SQLException sqlex sqlex printStackTrace System out
66. ut println nsql sql ResultSet rs st executeQuery sql return displayResult rs catch SQLException sqlex sqlex printStackTrace Vector dt new Vector return dt S howHoldSt 72 ocks java Shows holding stock record stockName shares pack impo publ p p P age stockpg rt java u ic class ublic St ublic in CF hy ublic Sho int SIZ System ile ShowHoldStocks ing stockName shares wHoldStocks Vector v E v size out println number of records is SIZI GI stockName new String SIZE shares new int SIZE for int n 0 n v size n Vector r new Vector r addElement v elementAt n Enumeration enum r elements StringBuffer buf new StringBuffer while enum hasMoreElements buf append enum nextElement System out println buf buf toString buf deleteCharAt 0 buf deleteCharAt buf length 1 System out println bufnew buf toString String str new String buf StringTokenizer strtok new StringTokenizer str stockName n strtok nextToken StringBuffer temp new StringBuffer temp append strtok nextToken temp delete 0 1 shares n Integer parseInt temp toString 73 ShowTradeHistory java Shows client s trade history Action Symbol Shrs Paid OrdTime Deal package stoc
67. ution to support the BDI agent model Other solution may include distributed computing language models similarly found in distributed computing systems such as JavaSpaces and JINI In this work we have tried to program BDI based agents for an example stocking trading application using the Java programming language Since Java does not support agent programming there was no proper language constructs to program agents To make it worse Java does not have any constructs that support the BDI concept at all and there is no way to program it Therefore we have tried to program BDI based agents using Java classes with database support We show here how to program agents belief desire and intention by using class constructs Stock trading agents create objects for belief desire and intention from the corresponding classes implemented already The desire object finds appropriate an intention object to achieve its goal based on the information of the belief object We have studied not only how to use the Java programming language nicely to build the BDI agent in our online stock trader application but also how to manipulate runtime knowledge dynamically to make agents intelligent using database for BDI knowledge There have been several research and experimental works based on the BDI model extending the Java programming language BDIM Agent Toolkit is implemented as a Java package to provide a prototype of runtime architecture Busetta amp R 97 98
68. ws ServletException IOException HttpSession session req getSession false String userID String session getValue session getId System out println userID userID Show sb new Show connection userID double b sb holdmoney PrintWriter out res getWriter res setContentType text html out println lt html gt lt body gt lt center gt lt table gt lt tr gt lt td BGCOLOR A0B8C8 gt lt b gt lt font face Arial size 3 gt Online Stock Agent lt font gt lt font size 1 gt Money Manager lt font gt lt b gt lt td gt lt tr gt lt table gt lt center gt lt hr gt lt br gt out println lt center gt lt h3 gt Your balance is b lt h3 gt lt center gt lt br gt out println form method post action servlet MoneyServlet gt lt center gt lt table width 70 gt lt tr gt lt td width 50 gt lt b gt lt font size 1 gt Action lt font gt lt b gt lt td gt lt td width 50 gt lt b gt lt font 48 size 1 gt Amount lt font gt US lt b gt lt td gt lt tr gt tr td input type radio name action value deposit checked gt Deposit lt br gt lt input type radio name action value withdraw gt Withdraw lt td gt _ lt td align center gt lt input name amount size 20 gt lt td gt lt tr gt lt tr gt lt td align center colspan 2 gt lt inpu

Download Pdf Manuals

image

Related Search

Related Contents

Parts and Service Manual for Turret Head    CUA User Manual ver 3.3  こ 「レインセンサ一」 機能について ・「レインセンサー」は、水やり予約の  ElastiStor Appliance ESA - A10 - CloudByte ElastiStor Documentation  SPARSEIT++ User Guide - the David R. Cheriton School of  DH100_Digimerge Touch Series_QSG_SP_R1-5fold.indd  GE863-PRO Linux Software User Guide - Glyn High  ULTRASONIC A/C ULTRASONIC A/C  Fonction Memory Viewer Mode d`emploi  

Copyright © All rights reserved.
Failed to retrieve file