WSO2 StockTrader, Python Installation Guide


WSO2 StockTrader is an online stock trading sample application with functionality equivalent to the Microsoft .NET Stock Trader sample benchmark application and IBM WebSphere's Trade 6.1 sample application. WSO2 StockTrader is powered by WSO2 WSF/PHP , WSO2 WSF/Ruby, WSO2 WSF/Perl, WSO2 WSF/Python, WSO2 WSF/Spring and WSO2 WSAS and implements the application in PHP, Ruby, Perl, Python, Spring and Java. It serves to illustrate interoperability between .NET, PHP, Ruby, Perl, Python, Spring and Java in deploying high-performance, scalable service oriented applications.

Note: This version of Python Stock Trader can only be installed in Linux.

Prerequisite

  1. Python

    Download and install Python 2.5 or more. If you are in debian based Linux distro you can use the command "sudo apt-get intall python python-dev" to install python. When you install Python from binary package,remember to install development files as well. 
  2. Django 0.96 or newer

    You can download django source and binary releases from here or if you are in debian based Linux distribution use the command "sudo apt-get install python-django" to install Django.
  3. WSO2 WSF/Python

    Install WSO2 WSF/Python. You can download it from here. Version should be 1.0.0 alpha or more. Please follow the README.INSTALL file to install.
  4. .NET Stock Trader 2.0

    You can download it from here.
  5. Enable TCP/IP Protocols of MSSQL server

    Open “SQL Server Configuration Manager” from Start->Programs->Microsoft SQL Server 2005->Configuration Tools-> SQL Server Configuration Manager. Enable TCP/IP and disable Named Pipes from protocols of your MSSQL server. (Note that, in following picture, MSSQLSERVER is the name of the SQL server. In your case, the name might be different)


    Open TCP/IP Properties by double clicking “TCP/IP”. Set “Listen All” to “Yes” in Protocol tab.



    From IP Address tab, disable “TCP Dynamic Ports” by leaving it blank and give a valid “TCP Port” so that MSSQL server will listen in that port. (We have used port 1433 in order processor services, so it is better to use that port)


    Similarly, enable TCP/IP from SQL Native Client Configuration and disable Named Pipes. Also, check whether the port is set correctly. (Port should be 1433)




    After finishing above settings, restart MSSQL Server.

Installing Python Stock Trader

Download Python Stock Trader from here and unzip it.
  1. Installing Trader Client
    Go inside trader_client directory. Edit request_processor.py and change the LOG_DIR to point to the location of the log file, LOG_LEVEL to the log level that you prefer, WSFC_HOME to point to WSFC installation directory. Edit urls.py and change the 'document_root' of the line (r'^site_media/(?P.*)$', 'django.views.static.serve', {'document_root': '/home/milinda/wso2/stock_trader/media'}) to point to directory where stock_trader/media will reside.  To run the server, execute 'python manage.py runserver YOUR_IP:PORT' command insde the trader_client directory.

Endpoint Addresses

These are the default endpoint addresses
  1. Trader Client
    http://localhost:8000/index