Designing, Building and Deploying a Fully Automated Algorithmic Trading System As I developed several inter-day trading/ portfolio management algorithms, I also embarked on a journey in parallel to develop a fully automated execution framework that could satisfy my requirements.
Previously orders were executed manually after signals are generated automatically.
Requirements A relatively slow trading system triggered by an hourly task scheduler during trading hours. I’m using Linux cron jobs for this.
Volatility targeting could potentially increase risk-adjusted returns for quantitative strategies Note: Man AHL’s framework in this paper is used in the write-up here.
Let’s say you researched and managed to find a quantitative strategy that suits your risk-reward preferences. How do you further improve your strategy while managing your risk?
A common way in the trend-following and risk parity space is to target risk - also known as volatility targeting.
Framework for capital allocation In this resource starved world, capital is scarce. Every dollar that you own has its place and deserves to be allocated properly.
Currently, I already have a huge chunk of capital tied up in a diversified portfolio levered up to 1.4 times. Portfolio has (& expected to) outperformed/ matched up to market returns with 2 to 3 times lower risk - in terms of standard deviation and drawdown.
Volatility targeting Currently, I’ve a suite of toolkits integrated into my Jarvis that advises me on the investing decisions that I’ve to make on a daily basis.
On the latest feature I cobbled together on a Saturday evening, 2 weeks ago, I’ve decided to measure the volatility of my portfolio formally.
Why I’m doing this is because managing risks in the form of volatility is easier than targeting returns.
Mapreduce using java I haven’t coded in java in eons. The assignment (Mapreduce, Pig and Spark) I worked on over last 3 weeks is a good way to jolt me out from my comfort zone.
Java is something I need to brush up on before taking the Software Development Process module which requires me to write an android app. Argh!
Back to Mapreduce. It’s a useful framework if you’ve to summarise huge datasets (gigabytes, terabytes).
Regime detection through hidden markov model It’s rumoured that in the early days of Renaissance Technologies - according to the book ‘The Man Who Solved the Market’ - hidden markov models are used for regime detection.
Here I am, a couple of decades later - employing this strategy. This will be integrated into my ‘Jarvis’ - a series of Algorithmic toolkits that advises me in all situations.
Hidden markov mode is a statistical unsupervised learning model used to model states.
Embedding D3 interactive charts Part 2 - Testing reading in of file from directory Just having fun - testing to see if I could embed D3 charts in my blog.
Seems like it works too! But I would have to upload the csv under public folder first.
// set the dimensions and margins of the graph var margin = {top: 10, right: 30, bottom: 30, left: 60}, width = 460 - margin.
Embedding D3 interactive charts Just having fun - testing to see if I could embed D3 charts in my blog.
Seems like it works!
// set the dimensions and margins of the graph var margin = {top: 10, right: 30, bottom: 30, left: 60}, width = 460 - margin.left - margin.right, height = 450 - margin.top - margin.bottom; // append the svg object to the body of the page var svg = d3.
Fuzzy matching As a computer scientist graduate, I always strive to reduce my computational complexity through parallelization or vectorization!
Explicit loops in data science is the root of evil!
For loops & while loops have their places but definitely not in data science space (fairly broad statement here).
In this post here, I hope to show a really cool example that avoids the dreaded O(n square) complexity.
I will be using fuzzy matching to find the closet match of strings in data-frame 2, df2 against data-frame 1, df1.
Lessons learnt I just realised that there’s a quick way to understand the xpaths’ patterns.
In the past, usually what I did is to manually eyeball to infer the patterns from the page source or inspect page.
Silly me!
1 quick way to understand the pattern is through the following,
Right click on an element in a web page that you are interested in and click on ‘inspect’ Right click on the node and click ‘copy’ Copy full xpath And paste to a notepad.