• Dragostin Kozhuharov

Coding and Trading in 2020

One of the goals I set for myself for last year was to improve my coding skills. Some years ago, I started doing courses on python, javascript, html and css, but I didn’t finish them. I want to use these skills for my trading – to do backtesting, automation and risk management.


One of the main problems I had with python was that I didn’t understand the setting up of environments, installing packages and a lot of the great functionality it has. When I was coding in python, I didn’t have the knowledge on how to monitor my code for mistakes in a proper way and to monitor my output. With javascript, html etc, you see how the website you create changes, when you make a change. That was one of the main reasons I found python more difficult when it came to more complex operations during my initial attempts to learn it.


I decided from an early point that I better learn the language from the developer perspective, rather than only it’s applications in finance and trading. I figured it will be easier to do the latter once you have a solid foundation. Thus, I selected courses for data analysis and development as a start, with finance specific courses coming at a later point.


The first course I did was a freecodecamp course which as the name suggests is free. You can see it on here https://www.youtube.com/watch?v=rfscVS0vtbw . The course was short but introduced a lot of the main concepts and gave decent examples on how to apply them. I found myself more confident on installing packages and some other features which I hadn’t used that much before. I was still not feeling like I understood what I was doing.


At that point I found myself using the www.tradingview.com backtesting capabilities. I managed to navigate and learn pynescript (their coding language for backtesting) to a point where I could test some of my strategies. It is an easy language to learn, if you have coding experience. It was also frustrating in the beginning. I remember that the first backtest took me more than half a day to develop. I was shouting at the computer at some point, as the code kept crashing. I knew I was close to cracking it, but the frustration grew the closer I got.


I went downstairs and started watching tv. As most times in life, when you are resting, or not doing anything intellectually challenging, you have that eureka moment. I jumped from the sofa and raced upstairs to my computer. A couple of tweaks here and there and behold – my first backtest was completed.


I was so happy and impressed with myself that I shared the results and news with all of my trader friends.


That was short-lived – I realized that in order to backtest with more data on smaller timeframes (smaller than daily chart), pynescript and tradingview would not be sufficient.


I gave up on coding and backtesting for a while. That is until I saw that freecodecamp had a new course on python. I jumped on the bandwagon again – I hoped that this time things would be different.


Oh and they were…


The new course (here is the link: https://www.freecodecamp.org/news/python-for-everybody/ ) is called Python for everybody. It was created by Dr. Charles Severance (or Dr. Chuck) and it is one of the best coding courses out there. I tried a few in my lifetime, and even though my testimonial might not be the most revered one, I am happy to give it. For the first time I felt that I knew and understood what I was doing. That is in installing packages, setting up environments and coding in a way that would let me correct mistakes early. Not to mention the big examples of Python’s usability. Interacting with APIs, object-oriented programming, scraping webpages, building web browsers and so much more.


If you are looking to start your coding journey for whatever reason you may need it, and you pick Python as the language you want to learn, I think you should start with this course. It’s entertaining and it will get you hooked on coding. If you decide on another language – all of the freecodecamp courses and tutorials are good starts.


I finished the year by completing the coding challenges in the end of the course. I am now in the process of building my own trading algorithms by interacting with APIs. I am also planning to build my own backtesting software with optimization tools. The plan is to keep doing python courses and challenges and use it to become an even better trader. Who knows maybe I can code other types of software as well?


The point is – it’s never a bad time to start learning and to have some coding knowledge. Even if it’s basic(as in beginner).


The goal for 2021 is to finish automating most of my trading. Even if I do manual trades, they are going to be based on backtested strategies and optimisations done by my programs.

5 views0 comments