Regulated and exchange-listed investment company. SM ®

Home
Open Account
Account Center
Services
Resources

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.



2.4. GetPositions

GetPositions method returns an array of "Position" structures. This array corresponds directly to the Positions window in Streamster. Each Position structure in the returned array contains one position with its associated fields as displayed in Streamster. GetPositions returns an array of Position structures which contain only fields available in Streamster - if you wish to retrieve any fields not currently shown in Streamster's Positions window, you have to add them by clicking the Columns button.

Sample - PHP: The following sample retrieves all positions and lists them.

<?php

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

$r = $api -> GetPositions();
if(property_exists($r, "Position")) {
    foreach($r -> Position as $n => $PositionInfo) {
        echo "\tPosition " . $n . "\n";
        foreach($PositionInfo as $field => $value) {
            echo "\t\tField: " . $field . " = " . $value . "\n";
        }
    }
}

?>

Sample - Visual Basic: The following sample retrieves all positions and lists them.

Dim api As StreamsterApi = New StreamsterApi

Dim ap As Position()
Dim p As Position

ap = api.GetPositions()

For Each p In ap
    Console.WriteLine("")
    Console.WriteLine("Position:")

    Console.WriteLine("PositionID: " & p.PositionID)
    Console.WriteLine("Desk: " & p.Desk)
    Console.WriteLine("Instrument: " & p.Instrument)
    Console.WriteLine("Side: " & p.Side)
    Console.WriteLine("OpenPrice: " & p.OpenPrice)
    Console.WriteLine("Currency: " & p.Currency)
    Console.WriteLine("Quantity: " & p.Quantity)
    Console.WriteLine("Points: " & p.Points)
    Console.WriteLine("Profit: " & p.Profit)
    Console.WriteLine("ExitStopLoss: " & p.ExitStopLoss)
    Console.WriteLine("ExitTarget: " & p.ExitTarget)
    Console.WriteLine("Entered: " & p.Entered)
    Console.WriteLine("Exited: " & p.Exited)
    Console.WriteLine("Status: " & p.Status)
    Console.WriteLine("Text: " & p.Text)
    Console.WriteLine("ClosePrice: " & p.ClosePrice)
    Console.WriteLine("Interest: " & p.Interest)
Next


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.

Live Support