This article is mainly for developers who uses our DotNet Library.
Developers while using our DotNet library at some point may encounter the below questions?
- What is difference between Kite/Upstox class and Bridge class?
- When we are able to place order using Kite/Upstox class, then why we need Bridge to place orders?
- Is there any benefit using Bridge?
1. Order Request Functions:
It’s true that you can place orders using Kite/Upstox class, but there are some differences in placing orders from Bridge class. The order request functions (Place/Cancel/Modify/Exit) of Bridge class accepts the below additional parameters.
IsLive : Boolean
StgyCode : String
IsAsync : Boolean
If set True, then order will be placed in OMS else order will be logged as Paper Trade. You can simulate real-time profit and loss for your trading system using Paper Trade. With this you can thoroughly test your trading system performance in terms of profit and loss before you go live and investing capital. This paper trade is as good as real trade (uses Bid/Ask to assign fill price) except for slippages.
Why can’t we just use the back-test results to assess the performance of trading system or in other words why we need Paper Trade when we have back-test results?
We can guarantee that back-test results will never/ever match in real time. Because
- None of the historical data available in the market is accurate. If the data itself not accurate, then how can be the back-test result. If you want to confirm this fact, collect data from different vendors and back-test a system with the collected data keeping every parameters same.
- Trade price calculated during back-test is not accurate as it is calculated on LTP, not on best bid/ask. Because none of the historical data have best bid/ask field.
- The lowest time frame for historical data is 1-minute, which has just 4 values (OHLC), but there may be 100’s of prices within that time, and the real trade might have filled at any price.
- Wrong coding practices : assigning wrong values to trade price. Example: assigning open price as trade price in a crossover strategy will give good back-test result, but in real, the trade might have happened above open price in case of BUY and vice versa for SELL.
- Wrong trading systems: here the trading system itself is wrong. It won’t going to work in real-time. Example: using future bars (like zigzag, peak, trough etc) in a system will give huge and enormous back-test result. But it will never work in real-time, because you can’t go to the past and buy/sell at your desired price.
That’s said, If you have back-tested a system with last one month data and the test return is 15%, then there is no guarantee that the real/live return would also be ~15%.
But if you have done Paper Trade in a system for one month and the paper return is 15%, then you can be sure that the real/live return would also be ~15% (except for slippages), because you are doing paper trading in real-time with best Bid/Ask.
If set true then order will be placed in background. A good example is closing/cancelling orders at square off time. At square off time, one may need to pass multiple requests all at once, with regular class, this will make your application unresponsive because all requests are processed in main thread. But when you pass order request using Bridge with IsAsync set to true, all request will be processed in background thread, so your application will remain responsive.
It is a 2 character alpha numeric string used to simulate trading system wise MTM/Position details for a symbol. Assume you are running two trading system (Ex: Supertrend and MA crossover) in the same symbol (Ex: Axisbank). If you place order using regular class, then the MTM/Position details you get is combined of both trading systems, but when you place order using Bridge class, you will get MTM separately, so you can check which system is performing best and which one is worst.
Other than the above, multiple order restriction is applied in Bridge class, but with regular class you have to write code to restrict multiple orders.
Throttling is applied in Bridge class, so even multiple orders are fired at once, all will be placed one by one with delay. If you place multiple orders using regular class, some of the orders may be rejected by API server for exceeding throttle, which may lead to disastrous (current throttle is 5 request/second).
2. Order Firing from 3rd Party TA Software’s:
Say if you want to fire order from AmiBroker, then you can not simply call the PlaceOrder functions of regular class in AFL. Because before calling PlaceOrder, you should have initialized regular class and have done login from AFL, but that is not possible. But with Bridge, the login is done in another application (Hello Kite/Upstox) and only the order request is passed to Hello Kite/Upstox from AFL through Bridge.
Supported TA Software’s:
- Microsoft Excel
- Any Windows Application which supports COM
3. Other Benefits and Features:
- Get Extended price fields like VWAP, Total Buy/Sell quantity in AmiBroker which are not available.
- Email alerts for Orders and Positions
- Previous Day Open/High/Low/Close/Volume/Open Interest data
- Annual and Daily Volatility data
- Average Range and Volume