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

Sunday, November 07, 2010

Streamster™ API Retrieval 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 retrieval methods and related structures.

GetQuote
GetQuote method returns a "Quote" structure for a given instrument name. The Quote structure contains fields equivalent to columns in Rates windows in Streamster. GetQuote returns only fields available in Streamster - if you wish to retrieve any fields not currently shown in Streamster, you have to add them by clicking the Columns button.


Sample - PHP: The following sample retrieves a quote for EUR/USD, displays the "Last" field and then lists all available fields.

SOAP_SINGLE_ELEMENT_ARRAYS));

$quote = $api -> GetQuote("EUR/USD");

echo $quote -> Last . "\n";

foreach($quote as $field => $value) {
echo $field . " = " . $value . "\n";
}

?>

Sample - Visual Basic: The following sample retrieves a quote for EUR/USD, displays the "Last" field and then displays all other fields.

Dim api As StreamsterApi = New StreamsterApi

Dim q As Quote
q = api.GetQuote("EUR/USD")

Console.WriteLine("Last: " & q.Last)
Console.WriteLine("Bid: " & q.Bid)
Console.WriteLine("Offer: " & q.Offer)
Console.WriteLine("Change: " & q.Change)
Console.WriteLine("High: " & q.High)
Console.WriteLine("Low: " & q.Low)
Console.WriteLine("Open: " & q.Open)
Console.WriteLine("Close: " & q.Close)
Console.WriteLine("Time: " & q.Time)
Console.WriteLine("Currency: " & q.Currency)
Console.WriteLine("Yield: " & q.Yield)
Console.WriteLine("Ask: " & q.Ask)


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

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

SOAP_SINGLE_ELEMENT_ARRAYS));

$r = $api -> GetOrders();
if(property_exists($r, "Order")) {
foreach($r -> Order as $n => $OrderInfo) {
echo "\tOrder " . $n . "\n";
foreach($OrderInfo as $field => $value) {
echo "\t\tField: " . $field . " = " . $value . "\n";
}
}
}

?>

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

Dim api As StreamsterApi = New StreamsterApi

Dim ao As Order()
Dim o As Order

ao = api.GetOrders()

For Each o In ao
Console.WriteLine("")
Console.WriteLine("Order:")

Console.WriteLine("OrderID: " & o.OrderID)
Console.WriteLine("Desk: " & o.Desk)
Console.WriteLine("Instrument: " & o.Instrument)
Console.WriteLine("Side: " & o.Side)
Console.WriteLine("Phase: " & o.Phase)
Console.WriteLine("PriceType: " & o.PriceType)
Console.WriteLine("Price: " & o.Price)
Console.WriteLine("ActiveQuantity: " & o.ActiveQuantity)
Console.WriteLine("TradedQuantity: " & o.TradedQuantity)
Console.WriteLine("ExitStopLoss: " & o.ExitStopLoss)
Console.WriteLine("ExitTarget: " & o.ExitTarget)
Console.WriteLine("Status: " & o.Status)
Console.WriteLine("PositionID: " & o.PositionID)
Console.WriteLine("Currency: " & o.Currency)
Console.WriteLine("Duration: " & o.Duration)
Console.WriteLine("DurationType: " & o.DurationType)
Console.WriteLine("Quantity: " & o.Quantity)
Console.WriteLine("QuantityType: " & o.QuantityType)
Console.WriteLine("Text: " & o.Text)
Console.WriteLine("Entered: " & o.Entered)
Next

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

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

SOAP_SINGLE_ELEMENT_ARRAYS));

$r = $api -> GetTrades();
if(property_exists($r, "Trade")) {
foreach($r -> Trade as $n => $TradeInfo) {
echo "\tTrade " . $n . "\n";
foreach($TradeInfo as $field => $value) {
echo "\t\tField: " . $field . " = " . $value . "\n";
}
}
}

?>

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

Dim api As StreamsterApi = New StreamsterApi

Dim at As Trade()
Dim t As Trade

at = api.GetTrades()

For Each t In at
Console.WriteLine("")
Console.WriteLine("Trade:")

Console.WriteLine("TradeID: " & t.TradeID)
Console.WriteLine("Desk: " & t.Desk)
Console.WriteLine("Instrument: " & t.Instrument)
Console.WriteLine("Side: " & t.Side)
Console.WriteLine("Phase: " & t.Phase)
Console.WriteLine("Price: " & t.Price)
Console.WriteLine("Quantity: " & t.Quantity)
Console.WriteLine("Executed: " & t.Executed)
Console.WriteLine("Status: " & t.Status)
Console.WriteLine("Currency: " & t.Currency)
Console.WriteLine("Text: " & t.Text)
Console.WriteLine("OrderID: " & t.OrderID)
Next

Thursday, June 03, 2010

General Forex Information

What do I need to do in trading?
Your goal in trading is to buy at a lower price and sell afterwards for a higher price. For example you can buy a market instrument (quantity of 10000) for 1.2349 and sell it later for 1.2458. You will make a profit of 109 (in currency the instrument is denominated in).

What can I trade on the market?
Marketiva provides spot forex trading services in the following currency pairs: EUR/USD, USD/JPY, GBP/USD, USD/CHF, USD/CAD, AUD/USD, NZD/USD, EUR/JPY, EUR/GBP, EUR/CHF, GBP/JPY, AUD/JPY, CHF/JPY, GBP/CHF, EUR/CAD, EUR/AUD, AUD/CAD. There may be other instruments added in the future.

When is the market open for trading?
You can trade from Sunday 17:00 to Friday 17:00 New York local time. Virtual trading is open at all times. The following approximate market schedule is based on New York local time: Japan markets open at 19:00 followed by Singapore and Hong Kong that open at 21:00. European markets open in Frankfurt at 2:00, while London opens an hour later. New York markets open at 8:00 (NYSE opens at 9:00). European markets close at 12:00 and Australian markets start again at 18:00.

Is there an easy way to start trading?
The easiest way to start trading is to click on a market instrument in a price window. When [Send Order] dialog shows up, you can set [Quantity] field to 1 or more (depending on the amount of money you have on currently active trading desk). When you click button, the order will go into the market.