Coding Lab | Nurturing Future Leaders in Technology

View Original

#CodingLabStudents: Surya, 14, Raffles Institution

Surya Nayar, 14, is no ordinary student. At his young age, he can count Python and C++ programming skills under his belt. This savvy student wrote his own stock rating algorithm after attending a Masterclass on Data Analytics with us. Here, he shares with us his journey in programming:Q: What gave you the idea for this program?

I got the idea a few years back when a friend of my parents was showing me the software he used to trade stocks. That got me thinking about whether the software could eventually replace human traders and deliver profits. So I started researching algorithmic trading (the process whereby the computer executes trades on its own) and familiarizing myself with stock markets in general. I also read up about Fintech (financial technology) to explore was already commercially available.

In December 2018, I signed up for the Data Analytics workshop at Coding Lab, knowing its relevance in the real world. At the workshop, I saw how sentiment analysis of tweets and newspaper headlines could give me a good overview of what people, or the market, felt about a particular company’s stock prices, thus giving me a new idea about how to go about the program, albeit at a rudimentary level.

I signed up for the Data Analytics workshop at Coding Lab, knowing its relevance in the real world.

Meet Surya, 14

Q: What were some considerations you had to factor in when making this program?

Firstly, and perhaps most importantly, was my experience (or rather, lack of it). I had used Python in the past to develop programs, but I had never developed anything in this vein. This really affected what I was able to do with my code – I could not, for example, execute real transactions or forecast whether the stock price is going to go up or down. All I could do was analyze the sentiment about a company’s stocks at one point of time and try to advise the program’s user accordingly – but even this was not perfected. Knowing that I was inexperienced made me avoid making things too complicated, and also allowed me to be realistic with myself regarding my program’s abilities.

Another consideration was the time frame. The workshop only lasted for five days, and I had to complete the program within that time frame. This was quite a tight timeframe, so I practiced during and outside of the workshop, manipulating characters in the code we were given to see what effect it would have on the overall program, and writing more code to complete the program. With the time limit hovering over me, I really couldn’t do much else, or else I would risk having an incomplete program. This time constraint put things into perspective in terms of what I could and could not do.

Q: What were some challenges you faced when developing the program?

I didn’t face many challenges when developing the program, except for some parts of the debugging process. Debugging is the process of locating errors in and rectifying your code after the program fails to execute what it is supposed to. When I was writing my own code, I frequently encountered errors with the for loops I was using, but after debugging, these were minor imperfections which I got rid of efficiently – so I wasn’t too frustrated.

As a coder, I submit to debugging as a compulsory ritual one must perform, in order for the code to be truly perfect.

Surya, on a Holiday to Egypt

Q: How did your Coding Lab mentors guide you for this project?

For this project, my mentor was Ms. Mona Tan. She helped in almost every way possible. She taught me how to use sentiment analysis on tweets and news articles, which was indispensable for my project. A lot of the code that I ended up using in my program was partially borrowed from what she wrote, including the names of the variables. She was always ready and willing to help whenever I faced a problem, such as debugging long-winded or inefficient code, my occasionally-shaky understanding of the material covered in the workshop - I deeply appreciate her constant support. Lastly, since I was unable to get approval as a Twitter developer in time for the workshop, I ended up using her authorization keys in order to access developer features in Twitter – a pre-requisite for the project, without which I wouldn’t be here answering these questions.

My vision is to be as complete as possible, with a graphical user interface (GUI) and full forecasting. I also want to draw on real-life market data and use machine learning to predict stock price behavior.

Surya's Algorithmic Stock Rater

Q: Are you working on any other projects/programs in the meantime?

For a start, I’m working to evolve the project that I developed in the workshop - My vision is to be as complete as possible, with a graphical user interface (GUI) and full forecasting. I also want to draw on real-life market data and use machine learning to predict stock price behavior. Additionally, I want to implement a feature where the program could scrape the web and build a database of events which may cause stock prices to rise or fall – for example, when Apple announces a new iPhone in September, the program should know that stock prices are likely to rise and use that information to better advise users.

For general programming, - to be honest - I haven’t done as much as I had hoped to this year. I got into competitive programming relatively recently and I go for classes at Coding Lab for the National Olympiad in Informatics (NOI). During the classes, I solve as many problems as I can, but as the problems get harder, it takes a longer time for me to solve them, so I end up doing much less than I intended to. Outside of class, I don’t code much, but I plan to finish reading my book on data structures and algorithms, during my upcoming holiday in India. I have created accounts on multiple competitive programming websites such as TopCoder, CodeForces, CodeChef and dunjudge.me. In 2019, I am really hoping to up my programming game.

Q: What advice would you give to young coders who are new to coding?

#1: Start off simple and aim small. You don’t have to know how to make an entire game, full of spaceships and complex 3D objects right at the start. My first ever program was in Scratch, and it was quite simply a game where you pressed the right arrow multiple times to move a car up a mountain - That was it! A lot of young coders are ambitious, which is good, but it also means that they tend to set unrealistic expectations of themselves and what they can achieve. If you start off simple and work step by step, you’re much less likely to be disheartened earlier on. This doesn’t, however, mean that you shouldn’t challenge yourself – just don’t bite off more than you can chew. One of the biggest shocks for me as a beginning ‘coder’ was in 2017, when I was unable to code a simple program that identified prime numbers and non-prime numbers despite me having ‘coded’ for the last few years. Later on, I realized it was because I was aiming so high initially, that I never got around to solving simpler, more real problems.

There is no such thing as perfection in coding – your code can always be made cleaner, more efficient, or just better – but as you code more and more, you’ll eventually realize how the same problem can be solved in an even better manner, and you can get as near to perfection as possible.

#2: Practice as much as you can. Coding is built on practice and repetition. It’s a muscle, and like all other muscles, it must be trained for it to grow. Nobody can become Mark Zuckerberg without coding dozens of horrible websites first and then eventually coding Facebook. It doesn’t matter if you’re wrong, but you should correct yourself quickly and make a note to yourself not to repeat the same mistakes. There is no such thing as perfection in coding – your code can always be made cleaner, more efficient, or just better – but as you code more and more, you’ll eventually realize how the same problem can be solved in an even better manner, and you can get as near to perfection as possible. As an example: When one learns sorting, one usually starts with the easy-to-understand bubble sort (which, however, is a rather slow and inefficient algorithm that sorts numbers) – as your understanding evolves, you understand more complex and efficient sorting algorithms, such as merge sort.

Surya, 14, is a student at Raffles Institution. He started off with our basic Python (S101) course in 2017 and has since progressed to S121 and C++ programming.