The pages referenced below describe how to use Streamster™ API, which can be used to create applications that interface with Novativa Streamster™. Applications using the Streamster API can retrieve various data from Novativa Streamster, execute and modify orders on the market and perform a variety of related actions.
Introduction to Streamster™ API
Streamster API exposes its functionality via the industry standard SOAP protocol. SOAP is widely supported on practically every programming platform, including PHP, Visual Basic, C#, C++, Java and many other languages and platforms.
To use Streamster API, an application connects to the SOAP service which is built into Novativa Streamster. To enable Streamster API and Streamster's SOAP service, log on to your account and click the Settings button. Under "Advanced", tick the "Enable web service API" box and click OK. Windows Firewall will then ask you to allow Streamster to accept connections on port 8018 - click the "Keep Blocking" button, which will prevent other computers on internet or your network from accessing Streamster API.
Once enabled, Streamster API is ready to service any requests coming from your computer. It is very important to note that requests coming from any computer other than yours will be always rejected, even if you allow Windows Firewall access to port 8018 from internet or any other computer or network. This is to prevent others on internet from accessing Streamster API on your computer and account. Note that there is no option in Streamster allowing circumvention of this protection.
With Streamster API enabled, you can use languages such as PHP and Visual Basic to run samples shown in the remainder of this document, or your own applications. For each Streamster API function you will see samples in PHP and Visual Basic. If you intend to use another language or platform, conversion of the sample code is usually very straightforward.
Using API from PHP
PHP supports SOAP and Streamster API very well. Installing PHP on your computer is simple - download and install the Windows binaries from the PHP.net site. PHP version 5 or later is required. Some PHP versions on Windows do not have SOAP enabled by default - you can enable the SOAP extension by editing the PHP.INI file and uncommenting the extension=php_soap.dll line.
To perform a simple PHP test, create a PHP file named "test.php" and edit it in Windows Notepad. Paste the following code into it:
SOAP_SINGLE_ELEMENT_ARRAYS));$quote = $api -> GetQuote("EUR/USD");echo $quote -> Last;?>
Test the above PHP script by running "php test.php" and it should simply display the last price of EUR/USD.
To test for critical errors (for example, when Streamster is not started at all, when method parameters are invalid, etc), you can use the standard PHP exception handling.
Using API from Visual Basic
Using Streamster API from Visual Basic is simple because it natively supports SOAP web services. There are numerous ways to consume a web service from Visual Basic, but the simplest is to add a "Web Service Reference" to your Visual Basic project. The address of the Streamster API Web Service is http://127.0.0.1:8018/service.wsdl and this is what needs to be specified when adding the web service reference to your Visual Basic project.
Once the reference is added to your project, using Streamster API is as simple as using any other Visual Basic object. For example, try the code below:
Dim api As StreamsterApi = New StreamsterApiDim q As Quote = api.GetQuote("EUR/USD")Console.WriteLine ("Last = " & q.Last)
If your Visual Basic project is a Windows Forms application, you can change the last line to Label1.Text = q.Last or similar.
Depending on your version of Visual Basic, you will need to make sure you add a "Web Service Reference", not a "Service Reference". If you add a "Service Reference", the name of the Streamster API class will be "StreamsterApiClientInterface" instead of just "StreamsterApi" so examples shown in this document would have to be updated accordingly in this case.
After Streamster API web service reference is added to your Visual Basic project, it is also necessary to add Streamster API web service reference to the list of "Imported Namespaces" in your Visual Basic project. This is necessary so that you will not have to prefix each Streamster API type with a web service reference name, which can be tedious.
To find out how to add a web service reference to the list of "Imported Namespaces" in your project, please consult the Visual Basic help system.