In 2016, all I was reading about was big data, deep learning, artifical intelligence, machine learning, etc… soon I realized I needed to do more than just read about it. So for 2017, I decided it was time to take a deep dive into Machine Learning and see what all the buzz was about.
I haven’t programmed in 20 years but figured now would be a great time to restart. From all the reading I did in 2016 it was clear that the programming language of choice for Machine Learning was Python. I didn’t want to take a bunch of disconnected courses on Coursera and Udacity to learn about Machine Learning, instead I had a project in mind. When I moved to India 12 years ago, it was to launch an algorithm/quant hedge fund and I was the guy tasked with getting all the technology infrastructure (servers, data feeds, leased lines, datacenter access, etc…) in place and then over time I would learn to build trading algorithms. One thing led to another and I never got around to build those models. Over the years, I felt the algo/quant space was over done and it would be tough to get back into it. However there has been a resurgence with all of the new technologies involving Artificial Intelligence entering the space. So that was my goal, learn Machine Learning to trade the stock market.
I spent the first couple weeks of the new year putting together a plan to accomplish the end goal. The first thing was to take an introduction course on Python from Coursera. In parallel I was researching the algo/quant side and understanding what goes into building models, trading models and risk management. Not only did I want to learn about Machine Learning but whatever I did, I wanted to build it like it was going to be a billon dollar asset management company – highly redundant architecture, quality data feeds and top-notch risk management. It soon became clear this was something that was not going to get built over the weekend!
I was able to breakdown the work into 3 stages:
1. Infrastructure – cloud provider, servers, databases, data feeds, trade execution
2. Research trading models – researching and designing algorithms to produce “alpha”
3. Risk management – once the trade is made, constantly monitoring the position and making sure it fits within the risk model that has been designed. Or as they say within the industry Value at Risk (VaR).
This blog post will talk about the infrastructure and some of the technology I learned along the way.
It quickly became apparent that many of the Machine Learning experts were using something called Jupyter which is an open-source platform to share notebooks and run live Python code. It’s like an online version of an IDE (integrated development environment) that programmers use to build applications.
The next thing was to start getting data and lots of data onto the platform that I had built. For all the crap I talk about Yahoo, they have a pretty good finance section to download historical stock data for Indian stocks. Using pandas, a Python data analysis library, I was able to pull down all the price data I needed.
Some of the technologies I learned and implemented along the way:
- Amazon Web Services – the cloud provider
- EC2/Ubuntu – Linux distribution on an EC2 server
- Let’s Encrypt – secure the server with a free SSL cert
- Python – programming language
- Jupyter – online IDE
- pandas – data analysis library for Python (developed by an AQR employee)
- Python scripting – used to get the daily price updates from Yahoo
- RDS/MySQL – database where the price data resides
- crontab – run the Python script at 2am in the morning
- crontab.guru – a super simple site to understand the syntax for scheduling cron jobs
- MySQLWorkBench – Software to interact with the MySQL DB
- SQL statements – Structured Query Language (SQL) to manage and get data from the DB
Below is a SlideShare document showing the process of setting up the server on AWS:
Part 2 will talk about the research aspect of building trading models – the traditional methods and using the newer Machine Learning tools like Apache SystemML, Caffe2, Microsoft’s CNTK, TenserFlow and Sciket-learn to name a few.





It’s another day and yet another payment option/technology was launched in India. The newest one to the party is called BharatQR, it’s being launched by the Government of India. BharatQR is like Paytm except instead of using e-wallets, you just need a bank account. It’s pretty clear the Indian government is hell bent on getting most people to transact online. With the explosive growth of Paytm, I’m guessing the government decided it needed it’s own QR-code offering.

We live in an era of limited attention span, super short news cycles and the upcoming President of the US who uses Twitter and it’s 140 characters to talk. When PM Modi announced on November 8th that all Rs. 500 and Rs. 1000 notes would stop being legal tender as of midnight that day, it was like an earthquake and here we are almost 46 days later still talking about it.
Then my phone went nuts with all the WhatsApp messages (yeah, India loves WhatsApp and not Facebook Messenger). I’m wondering if there was some announcement that CNN missed in regards to the US elections – nope. PM Modi dropped the equivalent of a nuclear bomb on the financial markets by banning the use of Rs. 500 (USD 7.40) and Rs. 1000 (USD 14.80) denomination notes in an effort to fight black money, corruption, fake currency notes and terror financing. This was not some ban that would go into effect in 1 week, 1 month or 1 year, it was going into effect in 4 hours – at the stroke of midnight Tuesday. The old notes could be redeemed at a bank over the next 2 months for new notes. Of course, if you have unaccounted wealth its going to be a very awkward conversation with the Income Tax officials to explain it. Which means most people will just burn it Pablo Escobar style like he did in Narcos. As of Wednesday morning the biggest legal tender was Rs. 100 (USD 1.48) until the new currency notes hit the market. It was a genius move by PM Modi and one that will go down as the biggest changes in the course of India’s financial markets. Yes, there is probably some
At this point, my TV remote was probably ready to retire since I was switching between 5 or 6 news channels to understand the implications of this massive announcement from PM Modi. All the while I was following the US elections on CNN and Nate Silver’s 
