Setting up a database for my Jarvis As I run more sophiscated trading strategies, I require a proper database for training parameters and records.
Previously, I was using a mix of SQLite, RDA and CSV files - but going forward I will be using Mysql (workbench) to house my data.
Below is an example of database tables for my market neutral strategies. I will be using these tables for the following,
CONTINUE READING
DAX index and Germany ETF I will keep it short in this post since I espoused on this strategy a couple of times.
I discovered another market neutral opportunity this month.
And this is based on ratio between Germany DAX index and MSCI based Germany ETF (EWG)
Based on backtest, sharpe ratio is close to 1.16.
The composition between these 2 indexes are largely similar and any significant deviation shouldn’t persist for long.
CONTINUE READING
Jarvis Humans are imperfect.
Humans are prone to biases.
Humans are dumb.
Humans have egos.
Humans rely on intuitions which are way way overrated.
And all these are blockers to sustainable positive performances in the area of investment portfolio management.
But not all is lost… I’ve found a way to aid me in my invesment decision making processes.
And that’s Jarvis! My expert advisor to advise me what to do in different scenarios.
CONTINUE READING
UK index and UK ETF I discovered another market neutral opportunity this month.
And this is based on ratio between FTSE 100 index and MSCI based UK ETF (EWU)
Based on backtest, sharpe ratio is close to 0.9.
The composition between these 2 indexes are largely similar and any significant deviation shouldn’t persist for long.
The optimal lookback period for the MA component in bollinger band is approximately 40 days.
CONTINUE READING
Asset allocation notification I’m in the midst of automating/ guiding my life with algorithms (largely inspired by Ray Dalio) - and 1 of the guidelines that I set is on asset allocation,
Emerging market and Developed Market should be of the same proportion Bonds + Cash proportion should be equivalent to my age. This can deviate in times of crisis when I want to be more opportunistic. If it deviates from the portfolio policy statement, it will send me a pushover notification to my phone:)
CONTINUE READING
Email notification I finally bit the bullet and updated my previously hideous email notification!
You may find the updated email notification template here - alongside with the code.
Feel free to ping me if you are keen to be on the email list too.
~ Jirong
import smtplib, ssl import datetime import pandas as pd from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart #Format text data = pd.read_csv('/home/jirong/Desktop/github/ETF_watchlist/Output/yahoo_crawled_data.csv') data['Change_fr_52_week_high'] = round(100 * data['Change_fr_52_week_high'], 1) data = data[['Name', 'Price', 'Change_fr_52_week_high']].
CONTINUE READING
Market neutral strategy As the negative news pile up (trade wars, slump in economy growths, etc), I sought for market neutral stategies that could perform well in any market environment.
An idea that struck me recently is to exploit the pair between Berkshire and SnP 500 ETF.
The SnP500 ETF/ Berkshire ratio has been falling over the years - insinuating that Berkshire still outperforms the index in the last couple of years.
CONTINUE READING
Converting NAs to obscure numbers to prevent the data from messing up the recoding. 1 issue that I encounter while I data-munge is that NAs in data seem to mess up my recoding. Here’s a neat swiss army knife utility function I developed recently.
suppressMessages(library(dplyr)) # Converting NA to obscure number to prevent awkward recoding situations that require & !is.na(<variable>) # Doesn't work for factors #' @title Convert NA to obscure number #' @param dp_dataframe Dataframe in consideration #' @param np_obscure_num Numeric - Obscure number #' @param bp_na_to_num Boolean if TRUE, convert NA to num.
CONTINUE READING
Loading data with data types When reading static files into R or Python, most of the times we are lazy as we load the data with no regard to the data types.
But in mission critical ETL jobs or Data analytics workflow, data types are quintessential and there’s a fine line between life and death. Ok, I’m exaggerating here.
What I’ve written below is a swiss army knife function to read an excel file: 1st tab is data and 2nd tab is the variable types (e.
CONTINUE READING
Describing unsupervised learning clusters As a data scientist / analyst, besides doing cool modelling stuff, we’re often asked to churn out descriptive statistics. Yes, we know. It’s part of the process.
I chanced upon this really nifty concept at work to describe the clusters derived from unsupervised learnig. Here’s how it goes,
Say it’s a nominal or ordinal variable. First, I find the proportion of the feature across the X clusters Second, I rank this proportion through percentiles across these X values The cluster with the highest percentile will earn its right to be represented by the feature And if it’s a scale variable, you may find the mean of the feature for each cluster and repeat the steps.
CONTINUE READING