Accelerate your Technical Analysis with Angel Broking’s Charts
Retail participation in India’s equity markets has always been on the lower side compared to the developed economies. However, with the ongoing pandemic and ever since it’s outbreak in March 2020, we have been seeing a steady increase in the number of users signing up for this mode of wealth generation. The growth in equity markets participation can also be attributed to the falling interest rates for FD.
With so many people confined to their homes as a result of the COVID-19 pandemic and amidst our efforts to preserve a sense of normalcy and stability in these challenging times, many of us are finding alternative ways to generate a new source of income.
According to a recent analysis from Bloomberg, active investor accounts rose by a record 10.4 million in 2020.
Business Today report says, the number of ‘demat’ accounts, which contain retail investor holdings in securities in electronic format, increased 27% last year to stand at 49.8 million at the end of 2020.
In November 2020, NSE’s ADTV (average daily turnover value) rose 60 % on-year to Rs 66,900 crore according to CNBC.
The brokerage client base has increased by 67% since the outbreak of Covid-19 according to a report published here.
This remarkable uptick in retail participation in the capital markets isn’t just about investment. Over the last year, we have seen retail investors getting more mature with respect to their investment decisions. Participants have started understanding the nuances and importance of market analysis and have developed the skillset to make informed decisions. A new entrant in the market, over time, develops a liking towards either Fundamental or Technical analysis.
We, at Angel Broking, believe in empowering our users with the right set of tools which would aid them in decision making. One such offering, which is an integral part of an advanced trading app is Charts. A feature like Advanced Charts on Trading app, enables the user to perform their technical analysis by leveraging the different tools, studies and indicators which are plotted along with the market data in real time.
Interested in learning more about Technical Analysis and other real world trading strategies? Explore these free learn-at-your-own-pace-tutorials from Angel Broking’s learning platform — Smart Money.
The latest version of Angel Broking’s Android app comes with two charting libraries — ChartIQ and TradingView.
Based on your trading style, you can set either one of them as the default charts for your analysis.
Although both the chart offerings work efficiently, personal preferences could vary. I personally know a few traders who are loyal TradingView users while others prefer ChartIQ. We have had ChartIQ integration since the beginning, so it is apparent that a good chunk of our users would have developed an affinity towards ChartIQ.
At the end of the day, what you see on the chart canvas is a visual representation of the market data. Both the charting solutions provide more or less the same feature set. I will cover the differences between ChartIQ and TradingView’s offerings in a different blog.
Fun Fact: 70% of our users have set TradingView as the default charts.
For a trader or an investor who believes in technical analysis, Charts is the most commonly used tool. When it comes to trading, every second matters and every price action has a meaning associated with it. Technical traders depend a lot on these price actions to build their future trades. For such real time analysis, the efficiency, consistency, and quality of the charting solution are critical. As a brokerage, we strive to provide the best experience possible for our customers so that they end up with profitable trades.
In this post, we’ll look at the problems related to latency we have faced in the chart reading experience. We will also cover the solutions we have implemented to improve the live streaming of market data for our users on charts.
Common problems with Charts Market Data Streaming
Let’s look at the two common issues which we used to observe with our initial implementation — Latency and Response Time Out.
Latency resulted in a slower load time for the charts on the app for our users. Response Time Out resulted in charts not loading on the app for our users
Why performance was a hindrance to our charts offerings?
For any trading application, latency is a big no. If shares for HDFC Bank are trading at 1450 @ 2:32:33 pm and at 1455 @ 2:32:34 pm, even a latency of 1 second can make the data stale. The precision could go into milliseconds as well, when it comes to a trading application. The bottom line is — in a broking business, we cannot afford to have any sort of latency especially when it comes to market data. Charts being one of the most widely used tools for technical analysis, the app induced performance delay could dissuade a seasoned trader from using the charts.
Latency was introduced because of:
On the fly rolling up of market data for higher time frames
Charts data is defined by 5 parameters — Open, High, Low, Close and Volume aka OHLCV. Every timeframe selected on the chart has OHLCV associated with it. The time frames can start from 1min, 2min, 3min and could go up to 30mins, 1 hour, 2 hour and so on. In our initial implementation, we were saving Charts data only for 1min. For all other time frames, we had to calculate the OHLCV data every time there was a request which resulted in unwanted latency on the server side.
Downloading HTML assets from the webview of ChartIQ and TradingView every time a request is made
TradingView and ChartIQ are the leading service providers for Charts. We have integrated with their HTML SDKs to build a webview that is rendered on our mobile app.
The concern with this implementation is that every single time a webview request is made, the HTML assets are downloaded first and then the charts data is rendered. The HTML DOM (Document Object Model) for both these libraries on an average takes around 3s to 4s to load. Once the DOM elements are loaded, charts data is fetched from the server which had a worst turnaround time of around 1s. This load time was dependent on the network connectivity of the user as well. We measured the front end load time of charts on TradingView and ChartIQ independently — on different devices and network coverages. The worst response time for charts used to hover around 6s to 7s. This is a significant delay in a very fast moving environment.
Why did huge data payload result in Request Time Outs?
The initial implementation for charts had a request data payload of 80 bits and a max response data payload of 85kB. NSE sees a daily volume of 30 million ticks in the cash segment and 50 million ticks in the derivatives segment. The historical data for a few stocks can date back to early 2000s as well. So, every time a request is made to fetch the historical data, a payload response of 85kB is generated and the response used to fail when there were multiple requests within a second.
How did we address the concern for latency?
Backend / Server Side Optimization: Since we deal with large-scale time series data we decided to move our backend databases to TimescaleDB which is more stable and robust compared to the traditional RDBMSes. Instead of just saving the charts data (OHLCV data) for the lowest timeframe (1min) and then rolling it up for other time frames, what we did in our new implementation is — we saved the OHLCV data for all the available timeframes separately. This removed the latency that was getting introduced when calculating the OHLCV data for higher timeframes. Watch out for a detailed tech blog that outlines the stack used for making the charts on Angel Broking’s app super fast. To give you a glimpse of the tech stack used — Kafka, Go Lang, Redis Cache, TimescaleDB are a few of the latest technologies used to address the latency related concern.
Frontend / Client Side Optimization: Chart’s data are dynamic in nature, but not its web assets. So the implementation is done in such a way, it avoids the unnecessary network requests for already fetched assets. This caching is handled at the server end. Now at an application level, charts are loaded during the time of app launch instead of requesting it only if the user selects the chart. This caching mechanism has reduced the front end load time from 7s to 1s.
The backend optimization was rolled out in the month of February 2021. The upcoming Android release will have a fix for frontend optimization. What if I say — the charts would get opened in a blink of an eye? Yes, we have managed to achieve that. Keep a check on your play store notifications for app-updates. Wait for the tech blog to understand the stack being used at Angel Broking to solve problems at scale while maintaining a near-zero latency for data processing and rendering.
Watch this space for some exciting updates on the current TradingView and ChartIQ integration - social sharing, multiple charts layout, trade from charts — market depth & trading panel, additional chart types — Renko, Kagi, Line Break, Point & Figure (P & F). We are also working on integrating TradingView with our Web Trading Platform as well.
Angel Broking is an equal-opportunity employer, and we constantly strive to simplify investment opportunities for our users. With more than 4mn+ satisfied users, we are looking for great minds who could come on board and join us in our vision to build the best digital investment platform.