KotakNet Bridge |
Excel, AmiBroker and Other Bridge users who just want to place orders from their TA software can use KotakTrader as a frontend to receive bridge requests.
Installing KotakTrader is simple, download the setup file from the below link and run as Administrator
https://howutrade.in/app-data/?productcode=kotaknet
Users can refer the Bridge code samples to get started
Bridge Docs: Bridge
Early Binding (Recommended)
To call Bridge functions from VBA, you need to add Reference 'Bridge For KotakNet'
In VBA Editor, Menu -> Tools -> References
From the available references select 'Bridge For KotakNet'
Declare a global Bridge Object in a module
Public Bridge As New Bridge
Dim Resp As String 'Place Order Resp = Bridge.PlaceRegularOrder("NSE", "ITC", "BUY", "MARKET", "NRML", 2, 0, 0) 'Cancel Regular Order Resp = Bridge.CancelRegularOrder("13805896989") 'Get Order Status ordstatus = Bridge.GetOrderStatus("13805896989")
Late Binding
For late binding, just create Bridge object and call the required functions
'Create Bridge Object Dim Bridge As Object Set Bridge = CreateObject("KotakNet.Bridge") Dim Resp As String 'Place Order Resp = Bridge.PlaceRegularOrder("NSE", "ITC", "BUY", "MARKET", "NRML", 2, 0, 0) 'Cancel Regular Order Resp = Bridge.CancelRegularOrder("13805896989") 'Get Order Status ordstatus = Bridge.GetOrderStatus("13805896989")
![]() |
---|
To call functions from Excel cell, you need to wrap the required Bridge functions as UDF with same syntax in VBA |
To call Bridge functions, you just need to create a Bridge object and call the required functions
//Create Bridge object bridge = CreateStaticObject("KotakNet.Bridge"); //Place Order resp = bridge.PlaceRegularOrder("NSE", "ITC", "BUY", "MARKET", "NRML", 2, 0, 0); //Cancel Regular Order resp = bridge.CancelRegularOrder("13805896989"); //Get Order Status ordstatus = bridge.GetOrderStatus("13805896989");
Open Trust Center : Office Button --> Excel Options --> Trust Center
Open Trust Center Settings : Trust Center --> Trust Center Settings
Macros Settings: Select ‘Enable all macros’
ActiveX Settings: Select ‘Enable all controls without restriction’ and uncheck ‘Safe mode’
External Content: Select ‘Enable All Data Connections’ and ‘Enable Automatic Update for all workbook links’
![]() |
---|
In real case scenario, you need to add static variables (wherever applicable) to remove redundant calls |
![]() |
---|
Do not download macro enabled excel files from untrusted sources. Macro enabled excel files are used to spread viruses and trojans. If need to download, then scan the downloaded file with your Anti virus |