Labeling Opportunities in Price Series

One approach to trading which has been puzzling me lately, is to sit and wait for opportunities. 🙂 Sounds simplistic, but it is indeed different than, for instance, the asset allocation strategies. In order to be able to even attempt taking advantage of these opportunities, however, we must be able to identify them. Once the opportunities are identified – we can try to explain (forecast) them using historical data.

Read More

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

Is There a Winner from all This BS?

There is abundance of claims that markets (by definition US markets) are rigged. Rigged in the sense that orders are often executed in a way, which contradicts to the natural intent of the person/machine behind the order. Until now, I have dismissed most of these as (populist) speculation, or, conspiracy theory. There is some truth in it however and my feeling is that it’s detrimental to all participants, yes, even to the “winner” in the examples I am going to show.
Read More

Volatility and Bollinger Bands

It is a common knowledge that Bollinger Bands (price standard deviation added to a moving average of the price) are an indicator for volatility. Expanding bands – higher volatility, squeezing bands – lower volatility. A bit of googling and you get the idea. In my opinion – that’s wrong, unless, one uses a twisted definition of volatility.
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.

Why is Tradelib in Java?

Why Java? Doesn’t sound like a meaningful question at first – whatever works, right? Yes, but it’s not that I didn’t have a choice, and Java was hardly my first choice. There were at least a few other attractive options: C#, Python and Go. Lat but not least, don’t forget, I am a professional C++ developer. So why Java? The history of Tradelib is somewhat interesting, so I decided to share it.
Read More

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.

Is the Stock Market Different?

Overall, we expect the stock market to go higher. There is a good reason for that – the stock market is positive close to 54% of the days. A natural questions is whether this holds for other markets as well. There is inflation after all.
Read More