Syntax
Public Function NewPosition(AccountIDs As String, BuySells As String, Amounts As String, SymbolIDs As String, PriceS As String, Optional Notes As String = "", Optional TransTag As String = "",Optional UserDefinedDate As String = "") As CallingResultsEnum
Description
To open new position with a specific price for a specific account.After NewPosition method executes the NewOpenPosition event fire.
Parameters
Part |
Description |
AccountID |
Accounts numbers to open a new position for, separated by "," . Value of type String. |
BuySell |
The operation type values separated by "," . Value of type String. 1 for buy type . -1 for sell type. |
Amount |
Lots amounts , separated by "," .Value of type String. |
SymbolIDs |
Symbol identifier for trading, separated by "," . Value of type String. |
PriceS |
The new Position Price ,separated by "," .Value of type String. Ask price if BuySell = 1 Bid price if BuySell = -1 |
Notes |
Custom strings used to mark the taken orders, separated by ",". |
TransTag |
String used to mark your order when the result comes from server. |
UserDefinedDate |
Trade open time , Date in format (DD/MM/yyyy HH:mm:ss).
"" : means now
|
Return Value
Returns value of type CallingResultsEnum ,if the request sent to the server successfully it will return SuccessResult.
Sample
Private WithEvents API1 As CVertexFXBOAPI
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim result As VertexFXBOAPI10.CallingResultsEnum
Dim vAccount As COAccount
Dim vClient As COClient
Dim vSym As COSymbol
Dim AccountID As String
vSym = API1.SymbolByIndex(1,True)
vClient = API1.ClientByIndex(1)
vAccount = API1.AccountByIndex(vClient.ClientID,1)
AccountID = vAccount.AccountID
result = API1.NewPosition(AccountID,1, "1.0",Cstr(vSym.ID),Cstr(vSym.Ask))
MsgBox(result.ToString)
End Sub
Private Sub API1_NewPosResult(ByRef Result As VertexFXBOAPI10.NewOrderResultEnum) Handles API1.NewPosResult
MsgBox(Result.ToString)
End Sub
See Also
VertexFX Backoffice API Index
|