Description:
VertexFX Bridge Liquidity Provider (LP) API is used for implementing a new LP in the VertexFX Bridge application, all what you need is developing your own LP DLL over the provided API with name prefix of VFX, then adding its reference in the bridge in order to be supported in VertexFX Bridge.
Using VertexFX Bridge API.
To have a new LP DLL that can be used in VertexFX Bridge, you have to build your own DLL which have a class of name “LP” that inherits from VertexFXLP class. Then override the needed functions as described below.
When finishing your LP DLL, you may test it using VertexFX LP Tester Appliucation.
Important Notes:
- In your LP class constructor you have to call:
MyBase.New(“YOUR LP DESCRIPTION”, Boolean) |
Boolean:
- True if your LP supports multiple accounts trading at the same session.
- False: if your LP does not support multiple accounts trading at the same session.
- Also you have to define the needed parameters for your LP, which will be sent to you over the Initialize method
AddParameter(“PARAMETER NAME1”, “INITIAIL VALUE1”) AddParameter(“PARAMETER NAME2”, “INITIAIL VALUE2”) AddParameter(“PARAMETER NAME3”, “INITIAIL VALUE3”) |
An so on. See the below example:
Example:
Public Sub New()
MyBase.New(“VertexFX”, False) AddParameter(“Username”, “”) AddParameter(“Password”, “”, True) AddParameter(“Server”, “”) AddParameter(“Port”, “”) m_oClient = New CVertexFXClientAPI End Sub |
Settings must be applied
- Whenever you are ready to connect, after initialization, set,
MyBase.Initialized = True |
- When you are connected, set,
MyBase.IsConnected = True |
- When you are disconnected, set,
MyBase.IsConnected = False |
- Whenever your LP is ready to execute orders. You don’t have to set it as False, because the Bridge will do that.
MyBase.Ready = True |
Methods to cal in Order Cycle.
MyBase.NewMarketOrderServerResponse |
MyBase.NewMarketOrderDealerResponse |
MyBase.NewLimitOrderServerResponse |
Those methords are explianed in the Order Cycle Below.
Whenever you don’t want to receive new orders until finishing some process or after finishing the current order. (not recommended, because it will slow down the bridge), set,
MyBase.Busy = True |
The bridge will set the Busy to false whenever you call:
MyBase.NewMarketOrderServerResponse |
Whenever you cannot login due to reason, such as invalid username and password
MyBase.CouldNotLogin(Reason As String) |
Methods you have to Override.
Public Overrides Function ValidateParameter(ByVal Parameter As String, ByVal Value As String) As Boolean |
It will return true if the Parameter value is valid.
Parameters:
- Parameter: the parameter name that is set in AddParameter method called in the constructor
- Value: the value that should be validated
Example:
Public Overrides Function ValidateParameter(ByVal Parameter As String, ByVal Value As String) As Boolean Select Case Parameter Case “Username” Return Value <> “” Case “Password” Return Value <> “” Case “Server” Return Value <> “” Case “Port” Return Value <> “” And IsNumeric(Value) Case Else Return True End Select End Function |
Public Overrides Sub Initialize() |
This procedure will be called once by the bridge, when creating new instance of your LP. Use this method to set parameters for your LP like username, password, server ip, etc..
You can access parameter value using this function:
MyBase.Parameter(“PARAMETER NAME”) |
Example:
Public Overrides Sub Initialize() m_oClient.SetLoginInfo(MyBase.Parameter(“Username”), MyBase.Parameter(“Password”), MyBase.Parameter(“Server”), MyBase.Parameter(“Port”)) MyBase.Initialized = True End Sub |
Public Overrides Sub Connect() |
Here you have to implement the connection procedure for your LP
Example:
Public Overrides Function Connect() As CTransResult m_oClient.Login() Return New CTransResult(True) End Function |
Public Overrides Sub Disconnect() |
Here you have to implement the disconnection procedure for your LP
Example:
Public Overrides Function Disconnect() As CTransResult m_oClient.Disconnect() Return New CTransResult(True) End Function |
Public Overrides Function SymbolsCount() As Long |
Return the symbols count, that will be used to fill the symbols for this LP.
if your LP does not support this value, you can return 0, in this case you have to set the symbol manually in the bridge, instead of selecting it from combo
Example:
Public Overrides Function SymbolsCount() As Long Return m_oClient.SymbolsCount End Function |
Public Overrides Function Symbol (ByVal Name As String) As CLPSymbol |
Returns an object of type CLPSymbol for the symbol of this name
Example:
Public Overrides Function Symbol(ByVal Name As String) As CLPSymbol Dim Sym As VertexFXClientAPI.COSymbol Sym = m_oClient.SymbolByName(Name) If Sym Is Nothing Then Return Nothing Else Return New CLPSymbol(Sym.Name, Sym.Bid, Sym.Ask) End If End Function |
Public Overrides Function Symbol (ByVal Index As Integer) As CLPSymbol |
Returns an object of type CLPSymbol for the symbol of this Index
Example:
Public Overrides Function Symbol(ByVal Index As Integer) As CLPSymbol Dim Sym As VertexFXClientAPI.COSymbol Sym = m_oClient.SymbolByIndex(Index + 1) ‘ Because our API starts from 1! If Sym Is Nothing Then Return Nothing Else Return New CLPSymbol(Sym.Name, Sym.Bid, Sym.Ask) End If End Function |
Public Overrides Function NewMarketOrder(ByVal BuySell As OperationTypeEnum, ByVal Amount As Double, ByVal LPSymbolID As String) As CTransResult |
This is used to make a new market order with your LP.
Parameters:
BuySell | Buy or Sell |
Amount | Amount to be traded |
LPSymbolName | Symbol name |
LPAccountID | Account ID |
BOOrderID | This ID should be returned when you receive the server response for the order in calling: |
MyBase.NewMarketOrderServerResponse |
Example: