Showing posts with label Marketiva Platform. Show all posts
Showing posts with label Marketiva Platform. Show all posts

Sunday, November 21, 2010

Streamster™ API Trading Methods

Once the SOAP object is created, Streamster API exposes a number of methods you can invoke to communicate with Streamster from your script or application. The following section explores available trading methods and related structures.

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.

SOAP_SINGLE_ELEMENT_ARRAYS));

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

?>

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

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 Forex"
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)

ChangeOrder
ChangeOrder changes certain parameters of a pending order. The ChangeOrder method has one parameter, an "Order" structure, which specifies the ID of the order to be changed and the new parameters of the order.

The following fields in the Order structure are valid and used when calling the ChangeOrder method:
  • OrderID: Contains the ID of the order to be changed
  • 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; when empty, Exit Stop Loss parameter will be reset for the position
  • ExitTarget: Optional; when empty, Exit Target parameter will be reset for the position
  • Text: Sets the Text parameter of the position

All other fields in the Order structure are ignored when the ChangeOrder method is called.

NOTE: If any of the above fields are left empty, a default value will be assumed, not the previous value associated with the order. For example, if ChangeOrder is invoked with ExitStopLoss field left empty, the Exit Stop Loss value will be reset - it will not have the value as it was before the call.

Sample - PHP: The following code changes an order.

SOAP_SINGLE_ELEMENT_ARRAYS));

$order -> OrderID = "CR82JA01D";
$order -> Price = 8756.24;
$order -> PriceType = "LIMIT";
$order -> ExitTarget = 8765;
$order -> Quantity = 10;
$order -> DurationType = "GTD";
$order -> Duration = date("c", time() + 3600);
$order -> Text = "test order from my script";

$api -> ChangeOrder($order);

?>

Sample - Visual Basic: The following code changes an order.

Dim api As StreamsterApi = New StreamsterApi

Dim o As Order = New Order

o.OrderID = "K82LVC9DR"
o.Price = 8756.24
o.PriceSpecified = True
o.PriceType = "LIMIT"
o.ExitTarget = 8765
o.ExitTargetSpecified = True
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.ChangeOrder(o)

CancelOrder
CancelOrder cancels an order with a given Order ID. The CancelOrder method has one parameter, an "OrderID" string which specifies the order to be canceled. The CancelOrder method has no return value.

Sample - PHP: The following code cancels an order.

SOAP_SINGLE_ELEMENT_ARRAYS));

$api -> CancelOrder("Z4AEVG7Z0");

?>

Sample - Visual Basic: The following code cancels an order.

Dim api As StreamsterApi = New StreamsterApi

api.CancelOrder("Z4AEVG7Z0")


ChangePosition
ChangePosition changes certain parameters of an open position. The ChangePosition method has one parameter, a "Position" structure, which specifies the ID of the position to be changed and the new parameters of the position.

The following fields in the Position structure are valid and used when calling the ChangePosition method:
  • PositionID: Contains the ID of the position to be changed
  • ExitStopLoss: Sets the Exit Stop Loss parameter; when empty, Exit Stop Loss parameter will be reset for the position
  • ExitTarget: Sets the Exit Target parameter; when empty, Exit Target parameter will be reset for the position
  • Text: Sets the Text parameter of the position

All other fields in the Position structure are ignored when the ChangePosition method is called.

NOTE: If any of the above fields are left empty, a default value will be assumed, not the previous value associated with the order. For example, if ChangePosition is invoked with ExitStopLoss field left empty, the Exit Stop Loss value will be reset - it will not have the value as it was before the call.

Sample - PHP: The following code changes a position.

SOAP_SINGLE_ELEMENT_ARRAYS));

$position -> PositionID = "B2HN72VL3";
$position -> ExitStopLoss = 3.20;
$position -> ExitTarget = 3.50;
$position -> Text = "hello world";

$api -> ChangePosition($position);

?>

Sample - Visual Basic: The following code changes a position.

Dim api As StreamsterApi = New StreamsterApi

Dim p As Position = New Position

p.PositionID = "B2HN72VL3"
p.ExitStopLoss = 3.20
p.ExitStopLossSpecified = True
p.ExitTarget = 3.50
p.ExitTargetSpecified = True
p.Text = "hello world"

api.ChangePosition(p)

ClosePosition
ClosePosition closes a position with a given Position ID. The ClosePosition method has one parameter, a "PositionID" string which specifies the position to be closed. The ClosePosition method has no return value.

Sample - PHP: The following code closes a position.

SOAP_SINGLE_ELEMENT_ARRAYS));

$api -> ClosePosition("B2HN72VL3");

?>

Sample - Visual Basic: The following code closes a position.

Dim api As StreamsterApi = New StreamsterApi

api.ClosePosition("B2HN72VL3")

Sunday, November 14, 2010

API Retrieval Methods - GetPositions

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.

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
GetDesks
GetDesks method returns an array of "Desk" structures. Each Desk structure in the returned array describes one desk on your account, including the name of the desk, the amount available on the desk, and the currency in which this amount is available.

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

SOAP_SINGLE_ELEMENT_ARRAYS));

$r = $api -> GetDesks();
if(property_exists($r, "Desk")) {
foreach($r -> Desk as $n => $Desk) {
echo "Name: " . $Desk -> Name;
echo ", Currency: " . $Desk -> Currency;
echo ", Amount: " . $Desk -> Amount;
echo "\n";
}
}

?>

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

Dim api As StreamsterApi = New StreamsterApi

Dim ad As Desk()
Dim d As Desk

ad = api.GetDesks()

For Each d In ad
Console.WriteLine("Name: " & d.Name & ", Currency: " & d.Currency &
", Amount: " & d.Amount)
Next


GetBars
GetBars method retrieves an array of bars for a specified instrument and period. Each bar in the returned array of bars contains price at a specific point in time.

NOTE: Only bars from any open Charting windows in Streamster can be retrieved. If you wish to retrieve bars from your script for a specific instrument and period, you have to make sure that this instrument/period is shown in one of Streamster's Charting windows.

The GetBars method has three parameters: instrument, period and a flag for options.

First parameter of the GetBars method is a string that specifies the instrument for which bars will be retrieved. The second parameter, Period, specifies the required period such as "5 Minutes", "15 Minutes", "30 Minutes", "Hourly", "4 Hours", "Daily", "Weekly", or "Monthly". The third parameter is a string that determines the order in which bars are returned: a blank string if bars are to be returned in descending order or a string "f" (as in "flip") for ascending order.

Each bar in the returned array of bars has the following fields: BarDateTime, Open, High, Low, Close and Volume.

Sample - PHP: The following code retrieves 5-minute EUR/USD bars and shows them all.

SOAP_SINGLE_ELEMENT_ARRAYS));

$r = $api -> GetBars("EUR/USD", "5 minutes", "f");

if(property_exists($r, "Bar")) {
foreach($r -> Bar as $n => $Bar) {
echo $Bar -> BarDateTime . " " . $Bar -> Open . " " . $Bar -> High .
" " . $Bar -> Low . " " . $Bar -> Close . "\n";
}
}

?>

Sample - Visual Basic: The following code retrieves 5-minute EUR/USD bars and shows them all.

Dim api As StreamsterApi = New StreamsterApi

Dim ab As Bar()
Dim b As Bar

ab = api.GetBars("EUR/USD", "5 minutes", "")

For Each b In ab
Console.WriteLine(b.BarDateTime & " " & b.Open & " " & b.High &
" " & b.Low & " " & b.Close)
Next

GetLastMessage
GetLastMessage retrieves the last error or warning message displayed in Streamster, if any. The GetLastMessage method returns a blank string if there were no messages after the previous GetLastMessage call.

Sample - PHP: The following code shows the last error or warning message.

SOAP_SINGLE_ELEMENT_ARRAYS));

$r = $api -> GetLastMessage();

if($r != "") {
echo($r);
}

?>

Sample - Visual Basic: The following code shows the last error or warning message.

Dim api As StreamsterApi = New StreamsterApi

Dim s As String

s = api.GetLastMessage()

If s <> "" Then Console.WriteLine(s)

Wednesday, August 18, 2010

Getting started with Streamster

Streamster basics, download and installation
Novativa Streamster™ is the proprietary software utilized by Marketiva to deliver financial information and trading services to its clients. Streamster was designed and developed by Novativa Corporation.

Streamster can be used on Windows 98, Me, 2000, XP and Vista. Please check the download section for a detailed information as the list of operating systems changes. All of the information and service provided by Marketiva is delivered via Streamster software that can be downloaded from:


In order to install Streamster, you need to double click on the executable downloaded from the link above and follow an easy to use installation wizard. Streamster icon will then be placed on your desktop, which you can double-click to launch this program.


Connecting to the Streamster Server
To use Streamster, you must be connected to the Internet. You can use either a dial-up connection with a phone-based modem, a broadband connection such as DSL or cable modem, or a LAN (local area network) with Internet access. Streamster is capable of connecting to the Streamster Server whenever there is an Internet connection present. If your Internet Explorer works properly, Streamster should work as well.

To connect to the Streamster Server:
  • Double-click the Streamster icon on your desktop or start menu.
  • Type in your user name.
  • Type in the password.
  • Click Connect.

Upon connecting, Streamster will take between 5 and 60 seconds to download the start-up data.

Understanding security
Streamster uses industry-standard 128-bit SSL (secure sockets layer) to encrypt the communication between you and the Streamster Server. Streamster protects your privacy by encrypting any and all data received and sent between Streamster and the Streamster Server, and by verifying the identity of the Streamster Server prior to any communication.

Troubleshooting connectivity
Because Streamster uses SSL (secure sockets layer) to communicate with Streamster Server, it is necessary that your Internet connection supports SSL. If you are using a dial-up or a broadband connection, you will be able to use SSL. However, if your computer is behind a company firewall, it might be possible that network administrators have disabled SSL. If you are unable to connect to the Streamster Server, please ask your network administrators to enable SSL by allowing TCP communication on port 443.

Streamster will work with a proxy server if your Internet Explorer is configured to use one. To check or configure your proxy settings, please open Internet Explorer, select Internet Options from the Tools menu and then click Connections.

Common connection errors in Streamster
Error: Please check your network connection and server address, and try again. (0x80342af9).

This error message is usually seen if the user has installed a download accelerator or a newer version of Norton Antivirus application on his computer. To resolve this issue and enable connection to the Streamster server, simply disable the download accelerator application before connecting to the Streamster server.

IMPORTANT: This or similar error messages can also be seen if the user is sitting behind a personal or corporate firewall that does not let communication on SSL port (number 443). Please contact your security administrator, as this port should normally be open for outbound traffic.

Error: Server security certificate is invalid or expired.

This error message is usually seen if the system date and time are not correctly set (due to BIOS upgrade or battery failure) on your computer. To resolve this issue and enable connection to the Streamster server, simply update your system date and time.

Special Windows 98 requirements
Microsoft Windows 98 is an older operating system that does not support a high level of encryption and related services by default. You will need to download and install the so-called "Active Directory Client" (dsclient.exe). This program adds necessary components to Windows 98 installation and can be downloaded from many web sites, including:


After downloading this file, please run and install it and proceed with the installation of the software as usual.

Sunday, October 04, 2009

Forex, Funds, Indexes, Commodities

Forex Market
Foreign Exchange (Forex) is by far the largest market in the world, in terms of cash value traded, and includes trading between large banks, central banks, currency speculators, multinational corporations, governments, and other financial markets, institutions and entities. Forex traders simultaneously buy one currency and sell another and currencies are always priced and traded in pairs. There is no central physical exchange where Forex transactions occur since currency trading is freely carried out between counterparties, in person, by phone or online.

Current Forex Rates
Our Forex rates are based on current average interbank trading activity. Each instrument has bid price (for you to sell), offer price (for you to buy), last price (average of bid and offer), change from daily open price, highest and lowest daily prices and price update time-stamp.


Funds Market
Investment funds are offered by various institutions, investment banks, financial firms and other entities, and fund shares are purchased and sold through centralized exchanges or in direct retail sale. Funds are often structured to target specific geographic regions, specific industries or investment styles. Fund investors are typically advised to hold their shares for at least one year to offset initial charges and potential drawdowns in fund share prices. Funds are considered long-term investments and are normally not associated with speculative and day-trading.

Current Fund Rates
Our Fund rates are based on Fund pricing models (e.g. net asset value, preset percentage). Each instrument has bid price (for you to sell), ask price (for you to buy), last price (average of bid and ask), change from daily open price, annual yield (profit in the last 365 days), price update time-stamp and currency the prices are quoted in.

Market Indexes
Market index is a representation of value of a set of securities that constitute certain market sector or industry, have similar market capitalization, or are listed on the same exchange. Indexes often serve as barometers against which financial or economic performance is measured. Various methods are utilized to determine index values, some of them favoring market capitalization, others market share or price of a security. Major international market indexes are commonly published in media as indicators of economic trends in various parts of the world.

Current Index Rates
Our Index rates are based on current index values provided by various exchanges and financial institutions. Each instrument has bid price (for you to sell), ask price (for you to buy), last price (average of bid and ask), change from daily open price, highest and lowest daily prices and price update time-stamp.

Commodities Market
Commodities are basic resources and raw or primary products such as metals, energy and agricultural products. These resources and products are traded on commodities exchanges and over-the-counter markets, in which they are bought and sold in standardized contracts. Open auction, which involved traders meeting face-to-face in trading pits, was the primary method of trading before introduction of today prevalent electronic trading systems. Participants in commodities trading range from farming cooperatives hedging against a poor harvest to oil companies and market speculators.

Current Commodity Rates
Our Commodity rates are based on current prices quoted on largest commodity exchanges. Each instrument has bid price (for you to sell), ask price (for you to buy), last price (average of bid and ask), change from daily open price, highest and lowest daily prices, price update time-stamp and currency the prices are quoted in.

Available Instruments
Marketiva provides trading services in Forex, Funds, Indexes, and Commodities instruments listed on instruments page. Please select Commodity in [Type] field and click Filter Instrumentsbutton to get the list with detailed information on the instruments.