How to integrate FYERS API Bridge with Excel using VBA coding?

FYERS API Bridge can be integrated with Excel and to Algo trade from Excel, you can code in VBA to for sending signals in FYERS API Bridge in excel. You need to create a TCP client as given below.

Read this article to understand how FYERS API Bridge works?

To create a TCP client

  1. Add a new form to the project, and name it frmClient.
  2. Change the caption of the form to a TCP Client.
  3. Add a Winsock control to the form and name it tcpClient.
  4. Add two TextBox controls to frmClient. Name the first txtSend, and the second txtOutput.
  5. Draw a CommandButton control on the form and name it cmdConnect.
  6. Change the caption of the CommandButton control to Connect.
  7. Add the code below to the form.

Important: Ensure that you change the value of the RemoteHost property to the friendly name of your computer.

 Private Sub Form_Load()
 ' The name of the Winsock control is tcpClient.
 ' Note: to specify a remote host, you can use
 ' the IP address (ex: "127.0.0.1") 
 tcpClient.RemoteHost = "RemoteComputerName"
 tcpClient.RemotePort = 30001
 End Sub
Private Sub cmdConnect_Click()
     ' Invoke the Connect method to initiate a
     ' connection.
     tcpClient.Connect
 End Sub
Private Sub txtSend_Change()
     tcpClient.SendData txtSend.Text
 End Sub
Private Sub tcpClient_DataArrival _
 (ByVal bytesTotal As Long)
     Dim strData As String
     tcpClient.GetData strData
     txtOutput.Text = strData
 End Sub

Source.

Example String to send to the port -“9”, “LE”,”SBIN”,”L”,””,”290″,”7″,”EQ”,””

Was this article helpful?


Related Articles