Category Archives: Programming

Loading Data with Pandas

On at least a couple of occasions lately, I realized that I may need Python in the near future. While I have amassed some limited experience with the language over the years, I never spent the time to understand Pandas, its de-facto standard data-frame library.

Read More

Too Much Parallelism is as Bad

The other day I run a machine learning backtest on a new data set. Once I got through the LDA and QDA initial run, I decided to try xgboost. The first thing I observed was a really bad performance. The results from the following debugging session were quite surprising to me.

Read More

Tradelib’s C++ Code Base

My previous post explained some of the reasons to move away from C++ to Java for my trading tools. It generated a few interesting, somewhat heated, but fruitful discussions. Hence, I thought I’ll share Tradelib’s C++ code base, just before I switched to Java. The code is on GitHub. It’s fairly small, but it proved sufficient to implement some interesting strategies. It’s just as it is – I am not planning on adding any new features, fixes or examples for it.

Creating Calendars for Future’s Expiration

Lately I have been doing calendar analysis of various markets (future contracts). Not an overly complicated task, but has a few interesting angles and since I haven’t seen anything similar on the Net – here we go.
Read More

First Tradelib Strategy

Finally I managed to find some time to prepare and share a strategy using my Tradelib library. The strategy implements a simple momentum rotation of a few ETFs on a monthly basis. Look for updates over the coming weeks – my plan is to update the wiki with more information on setup and use.

Trading Autocorrelation?

Markets are very smart in absorbing and reflecting information. If you think otherwise, try making money by trading. If you are new to it, make sure you don’t bet the house.

In other words, markets are efficient. At least most of the time. So then why people trade? The general believe is that there are windows during which prices of certain assets are inefficient. Thus, there are opportunities to make money. Is the presence of autocorrelation one such opportunity? Let’s find out.
Read More

When is a Backtest Too Good to be True?

One statistic which I find useful to form a first impression of a backtest is the success/winning percentage. Since it can mean different things, let’s be more precise: for a strategy over daily data, the winning percentage is the percentage of the days on which the strategy had positive returns (in other words, the strategy guessed the sign of the return correctly on these days). Now the question – if I see 60% winning percentage for a S&P 500 strategy, does/should my bullshit-alarm go off?
Read More