Home
Account Center
Services

Streamster API

The pages referenced below describe how to use the Streamster API to create applications that interface with the Streamster trading platform. Applications using the Streamster API can retrieve various data from the platform, execute and modify orders and positions, and perform a variety of related actions.

To open and read a particular page, please click on its title.



3.1. SendOrder

SendOrder method sends a new order. It is an equivalent to clicking a New button in the Orders window in Streamster and then filling out the form and clicking OK. The SendOrder method has one parameter, an "Order" structure which contains details of the new order. The meaning of fields in the Order structure is the same as in the Send Order form in Streamster.

The following fields in the Order structure are valid and used when calling the SendOrder method:

Instrument: Name of the instrument (for example, EUR/USD), a required field

Side: BUY (Default) or SELL

PriceType: MARKET (Default), LIMIT or STOP

Price: Required field when PriceType parameter is set to LIMIT or STOP

DurationType: GTC (Default), GTD or IOC

Duration: Required when DurationType parameter is set to GTD (Good Till Date)

Quantity: Required field

QuantityType: FULL (Default) or PARTIAL

ExitStopLoss: Optional

ExitTarget: Optional

Desk: Name of the desk to use for the order, a required field

Currency: Required if there is more than one currency on the specified desk

Text: Optional

The SendOrder method has no return value - if an order is successful, it would normally appear in the Orders window shortly. If any parameter is invalid, an exception will be raised (as in all other Streamster API methods).

Sample - PHP: The following code sends a basic order.

<?php

$api = new SoapClient ("http://127.0.0.1:8018/service.wsdl",
    array('features' => SOAP_SINGLE_ELEMENT_ARRAYS));

$api -> SendOrder(array(
    "Instrument" => "EUR/USD",
    "Desk" => "Virtual Currencies",
    "Quantity" => 10
));

?>

The following code creates an order variable, fills out most of its fields and sends an order.

<?php

$api = new SoapClient ("http://127.0.0.1:8018/service.wsdl",
    array('features' => SOAP_SINGLE_ELEMENT_ARRAYS));

$order -> Instrument = "Dow Jones";
$order -> Side = "BUY";
$order -> Price = 8756.24;
$order -> PriceType = "LIMIT";
$order -> ExitTarget = 8770;
$order -> Desk = "Testing";
$order -> Currency = "EUR";
$order -> Quantity = 10;
$order -> DurationType = "GTD";
$order -> Duration = date("c", time() + 3600);
$order -> Text = "test order from my script";

$api -> SendOrder($order);

?>

Sample - Visual Basic: The following code sends a basic order.

Dim api As StreamsterApi = New StreamsterApi

Dim o As Order = New Order

o.Instrument = "EUR/USD"
o.Desk = "Virtual Currencies"
o.Quantity = 10
o.QuantitySpecified = True

api.SendOrder(o)

The following code sends an order with lots of optional parameters.

Dim api As StreamsterApi = New StreamsterApi

Dim o As Order = New Order

o.Instrument = "Dow Jones"
o.Side = "BUY"
o.Price = 8756.24
o.PriceSpecified = True
o.PriceType = "LIMIT"
o.ExitTarget = 8770
o.ExitTargetSpecified = True
o.Desk = "Testing"
o.Currency = "EUR"
o.Quantity = 10
o.QuantitySpecified = True
o.DurationType = "GTD"
o.Duration = DateAdd("d", 1, Now())
o.DurationSpecified = True
o.Text = "test order from my script"

api.SendOrder(o)


Send us your comments and any suggestions you might have about the Streamster API. We look forward to receiving your input and improving content on this page to help you utilize the API to its full extent.