StockWatch Developers: Nimrod Hagay Hagai Barkan Supervisors: Assaf Solomovitch Viktor Kulikov June 2009 Overview StockWatch is a website (ASP .NET) which provides a User centric interface for managing stock portfolios , supply stock technical analysis (based on www.American-bulls.com web site) , Live market data and news. Project Goals StockWatch should use advanced technologies such as AJAX , ASP.NET , JavaScript and Online data management APIS. StockWatch should be User friendly , attractive and quickly responsive. StockWatch should provide free technical analysis combined with real-time data and news feeds. StockWatch should relay on stable data sources. Main features Multiple Users System Real Time Quotes Rich presentation layer Google Portfolios API User Portfolios Stocks Grading Various News Feeds Admin Management Technologies ASP.NET 3.5 ASP.NET 3.5 AJAX extension. Microsoft SQL. C# (.NET framework 3.5). Google spreadsheets API (C#). JavaScript YUI – Yahoo User Interface Google Visualizations Google Ajax Feed API What have we learned ? 1. ASP.NET – We have purchased the ability to build web sites using that technology. 2. AJAX – How to enhance a web site and give the user a good user experience. 3. SQL – Build and query our database. 4. C# - The code behind language of our web site. 5. JavaScript – Using it in order to reduce page reloads and pass some runtime job to the client side. 6. Using Advanced user interface and data APIS – such as Google spreadsheets , YUI , Google AJAX feed API and more… ASP.NET Server side & Client side Web Pages – Static & Dynamic data Code behind model Built-In controls View-State Master Page Membership & Security (Users & Roles) AJAX (Asynchronous JavaScript and XML) • • • • • Group of interrelated web development techniques used on the client-side to create interactive web applications. can retrieve data from the server asynchronously in the background without interfering with the display and behavior of the existing page. XMLHttpRequest object – Xml / pre-formatted HTML / plain text / JSON are being sent to the server and back. JavaScript code handles the dynamic data display. We used the following controls : AutoCompleteExtender , TextBoxWatermarkExtender ModalPopupExtender , TabContainer ,AnimationExtender & UpdatePanel. SQL SQL (Structured Query Language) is a database computer language designed for the retrieval and management of data in relational database management systems , database schema creation and modification, and database object access control management. We used SQL through SqlDataSource & Dataset controls in order to update and query data on our stocks table. 3-Layers Design AJAX ASP.NET Google visualizations YUI Google Spreadsheets API SqlDataSource Yahoo web service Layer 0 - Data sources Yahoo finance Yahoo Web Service Stock page Google finance Google Spreadsheets Google Portfolios API Portfolios page American Bulls StockParser StockWatch DB Database – Layer 0 Google spreadsheet – Layer 0 Auto updates data Easy API for querying and updating data Layer 1 - DAL • Google Portfolios API - User portfolios are saved on A Google spreadsheet in order to get real time data. The API Provides an easy interface managing user’s portfolios. • SqlDataSource – allows us to access and manipulate data in an ASP.NET page without using ADO.NET classes directly. • Yahoo web service – provides an easy access to Yahoo finance real time data. Layer 2 – Business logic – the whole picture 1 LogHandler +DoHandleError() : void +LogError() : void +WriteToDefaultLog() : void PasswordRecovery (Page) #Page_Load() : void ProblemPage (Page) #Page_Load() : void QueryPage (Page) #Page_Load() : void #StocksGridView_SelectedIndexChanged() : void 1 0..* #createAccountBtn_Click() : void SignIn (Page) 1 #Page_Load() : void -SubmitBtn_Click() : void 1 PortfoliosPage (Page) #Page_Load() : void 1 AutoComplete (WebService) +EvaluateStockRate() : string +UrlToXml() : void +GetComplitionList() : String[] Default (Page) 1 #Page_Load() : void -LoadSpecialStocks() : void -AddSpecialTable() : void #SignInBtn_Click() : void FeedBack (Page) GooglePortfoliosExtension Globals GooglePortfolioControl (WebControl) #Page_Load() : void +ViewTransactionStrip() : bool +ViewManageStrip() : bool +ViewLinkToPortfolio() : bool +ViewNewsPanel() : bool +RequestedPortfolio() : string #okCreateBtn_Click() : void #DeletePortfolioBtn_Click() : void #renameBtn_Click() : void #AddToPortfolioBtn_Click() : void #RemoveTransaction_Click() : void #goToPortfolioPage_Click() : void #updateUserPortfolio() : void 1 +AddNewTransaction() : bool +RemoveTransactions() : bool +GetWorksheetUrl() : string +GetUserPortfolios() : String[] +AddPortfolio() : bool +DeletePortfolio() : bool +RenamePortfolio() : bool 1 +Application_Start() : void +Application_End() : void +Application_Error() : void +Session_Start() : void +Session_End() : void #CommitSql_Click() : void #clearFilter_Click() : void #UserSqlGoBtn_Click() : void #UserSqlClrBtn_Click() : void #FilesDownloadProgressBar_RunTask() : void #DBUpdateProgressBar_RunTask() : void +GradeProgressBar_RunTask() : void +UpdateDataSet() : void «uses» Global Register (Page) «interface» IGooglePortfoliosExtension +AddNewTransaction() : bool +RemoveTransactions() : bool +GetWorksheetUrl() : string +GetUserPortfolios() : String[] +AddPortfolio() : bool +DeletePortfolio() : bool +RenamePortfolio() : bool ManagementPage Stock +Close : string +Market : string +Change : string +Status : string +Symbol : string +Name : string +BullsUrl : string +StockGrade : string +IsInPortfolio : bool +IsInGoogleSheet : bool +GradeTimeStamp : DateTime +LivePrice : string +LiveVol : string +LiveMktCap : string +LiveAvgVol : string +LiveHighPrice : string +LiveLowPrice : string +LiveChange : string +FixName() : string +Stock() 1 YahooQuoteWebService (WebService) «uses» +GetQuoteWithIDS() : String[] «uses» 1 StockControl (WebControl) #SetInfo() : void 1 MasterPage (Page) 1 #Page_Load() : void -searchBtn_Click() : void 1 StockPage (Page) #Page_Load() : void -PrepareStock() : bool Layer 2 – Business logic – Users management & security StockWatch uses ASP.NET Built-in Users Management mechanism. The mechanism generate memberships data tables in the database. Built-in User controls offer easy login (Login control) , registration (CreateUserWizard) , Password recovery and Dynamic content according to the user state (LoginView control). Roles management – StockWatch uses the roles mechanism in order to distinguish between Admin user (management page) and regular user. Layer 2 – Business logic – News feeds StockWatch collect news feeds from Yahoo finance , Google finance & Msn money. News feeds are dynamic according to the presented stock or stocks in current portfolio. News feeds are being displayed using Google feed Ajax API. (client side). Layer 2 – Business logic – American Bulls data parsing Everyday at 2 am a data parsing process gets data from American Bulls web pages. The process has 3 stages : ◦ Page download ◦ Data parsing and saving into data base ◦ Grading process: Grade = (Stock hits / Stock predictions) The information for the stock grade is based on predictions results history from American bulls. Layer 3 – Presentation layer What do we expect from a modern web site? 1. To be visually appealing 2. To be responsive and easy to use Layer 3 – Presentation layer – Design Technologies 1. Master Pages – give the site one constant look and feel. 2. Custom controls for better code reuse and modularity. 3. CSS to create a modern design that is also interchangeable. Layer 3 – Presentation layer – AJAX We used Ajax auto complete control for symbol search, this control use Web Service function. The use of Web Service helps the System run smoothly, and enhance the system performance. Update Panel : Layer 3 – Presentation layer – Google Visualization Dynamic News Feeds Google Table Thank you ! Any questions ?