A simple portfolio demo application showing integration between the Dojo Toolkit and the Lightstreamer JS Client
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
LICENSE
README.md
screen_dojo_portfolio.png
screen_dojo_portfolio_large.png

README.md

Lightstreamer - Portfolio Demo - HTML (Dojo Toolkit) Client

The Portfolio Demo simulates a portfolio management: it shows a list of stocks included in a portfolio and provide a simple order entry form. Changes to portfolio contents, as a result of new orders, are displayed on the page in real-time. In addition to that, the Full Version of the Portfolio Demo also shows, for each stock in the portfolio, the current price, updated in real-time from a market data feed.

This project includes a web client front-end for the Lightstreamer - Portfolio Demo - Java Adapter, showing the integration between the Dojo Toolkit and the Lightstreamer JavaScript Client library.

Live Demo

screenshot

View live demo

Note. Real-Time simulated Portfolio data is received from the Lightstreamer Server deployed at http://push.lightstreamer.com.

Details

The demo shows how to use: the Lightstreamer JavaScript Client library, the Dojo Toolkit, the LightstreamerStore 1.0 for Dojo integration package, the dgrid widget library and the DojoX Charts library, together.

Known Bugs

  • If the user inputs any value in the dgrid and an update for that rows arrives from the store, the user's value is overwritten.
  • If the user inputs any value and then presses + (to buy) or - (to sell) immediately after, the quantity field appears still empty and the first click fails.

Install

If you want to install a version of this demo, pointing to your local Lightstreamer Server instance, follow the steps below.

  • The the Dojo Toolkit Portfolio Demo, needs both the PORTFOLIO_ADAPTER, from the Portfolio Demo, and the QUOTE_ADAPTER, from the Stock-List Demo (see Lightstreamer - Stock-List Demo - Java Adapter). As a prerequisite, the full version of the Lightstreamer - Portfolio Demo - Java Adapter has to be deployed on your local Lightstreamer Server instance. Please follow the instructions in Install the Portfolio Demo to install it.
  • Download this project.
  • Build a file to be named lightstreamer_namespace.js with the online generator and put it in the src folder of the project.
    Be sure to include the LightstreamerClient, Subscription, ConnectionSharing, and StatusWidget modules and to use the "Use AMD with namespaced names" version.
  • Download the Dojo Toolkit and copy the dojox folder from the package to the src folder of the project. The demo requires the Dojo Toolkit v.1.8 or higher.
  • Using the CommonJS Package Manager install dgrid, dijit, and lightstreamer-store in the src folder of the project; dependencies for these packages will be automatically resolved by the cpm process:
    • > cpm install dgrid 0.3.8
    • > cpm install dijit
    • > cpm install lightstreamer-store
  • Deploy this demo on the Lightstreamer Server (used as Web server) or in any external Web Server. If you choose the former:
    • create the folders <LS_HOME>/pages/DojoPortfolio and copy here the contents of the /src folder of this project.
    • The client demo configuration assumes that Lightstreamer Server, Lightstreamer Adapters, and this client are launched on the same machine. If you need to target a different Lightstreamer server, please edit js/lsClient.js and change accordingly the line:
      var lsClient = new LightstreamerClient(protocolToUse+"//localhost:"+portToUse,"FULLPORTFOLIODEMO");
  • Open your browser and point it to: http://localhost:8080/DojoPortfolio/portfolio.html

Build

It is suggested to compress the dojo/dojox/dijit files in a single js source file to minimize startup times:

Head for the Dojo Web Builder and select the following packages:

  • dijit.layout.BorderContainer
  • dijit.Dialog
  • dijit.registry
  • dojox.charting.Chart
  • dojox.charting.StoreSeries
  • dojox.charting.axis2d.Default
  • dojox.charting.plot2d.Default
  • dojox.charting.themes.Claro
  • dijit.form.ToggleButton
  • dojo.store.Memory
  • dojo.store.Observable
  • dojo.parser
  • dojo.domReady
  • dijit.layout.ContentPane
  • dijit.form.Button
  • dojox.collections.Dictionary
  • dojox.collections.ArrayList
  • dojox.gfx.svg
  • dijit.form.NumberTextBox
  • dijit.form.CurrencyTextBox
  • dojo.number
  • dijit.form.NumberSpinner
  • dijit.form.FilteringSelect
  • dijit.form.Button
  • dijit.TitlePane

Then click the "build" button and wait. Once the builder is done, a zip file will be dowloaded; copy the files/folders from the archive in the src/dojo foloder and reload the demo.

See Also

Lightstreamer Adapters Needed by This Client

Related Projects

Lightstreamer Compatibility Notes

  • Compatible with Lightstreamer JavaScript Client library version 6.0 or newer.
  • Compatible with Dojo Toolkit v.1.8 or newer.