Skip to content

This project contains a simple Python script that shows a minimal client-side implementation of the Lightstreamer Server Text mode Protocol

License

Notifications You must be signed in to change notification settings

Lightstreamer/Lightstreamer-example-StockList-client-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lightstreamer - Basic Stock-List Demo - Python Client

This project contains an example of a Python application that employs the Lightstreamer Python Client library.

screenshot

Details

The example provides a very simple version of the Stock-List Demos, where a single subscription to 12 items is submitted. The updates are then formatted and displayed on the console.

The script shows all the basic steps required to establish an interaction to Lightstreamer Server. More specifically, the code comprises these actions:

  • Connection to Lightstreamer server and session creation
  • Subscription to items with specified fields
  • Notification about real time updates
  • Unsubscription from items
  • Final disconnection

Install

If you want to install a version of this demo pointing to your local Lightstreamer Server, follow these steps:

  • Note that, as prerequisite, the Lightstreamer - Stock- List Demo - Java Adapter has to be deployed on your local Lightstreamer Server instance. Please check out that project and follow the installation instructions provided with it.
  • Launch Lightstreamer Server.
  • Go to http://python.org/download/ and download the appropriate Python (tested since version 3.9) for your OS and follow the instructions to install it on your system. Note that the demo currently can not be launched from IDLE.
  • Install the latest version of the Lightstreamer Python Client library from PyPi: python -m pip install lightstreamer-client-lib

You can now run the Python script simply executing the following commands on different OS:

  • Windows machines:
start python /path/to/example/stock_list_demo.py
  • Linux machines:
python /path/to/example/stock_list_demo.py

or, alternatively, you can make the script executable:

chmod +x /path/to/example/stock_list_demo.py

and then type:

/path/to/example/stock_list_demo.py

The example is configured to connect to http://push.lightstreamer.com:80, but you can easily change these settings modifying the following line:

lightstreamer_client = LightstreamerClient("http://push.lightstreamer.com:80", "DEMO")

to connect to the correct combination of host and port of your Lightstreamer server.

Lightstreamer Adapters Needed by this Demo Client

Related Projects

Lightstreamer Compatibility Notes

  • Compatible with Lightstreamer Python Client SDK 1.0 or newer.
  • Compatible with Lightstreamer Server since version 7.3.2.

About

This project contains a simple Python script that shows a minimal client-side implementation of the Lightstreamer Server Text mode Protocol

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages