Build RQuantLib on 32-bit Windows

Before you start, note that there is now a Windows binary of RQuantLib is available on CRAN. Due to a change in how R-2.12.0 is built, CRAN maintainers could no longer provide a Windows binary of RQuantLib with the QuantLib library they had been using. I decided to try and build an updated QuantLib library from source, which would allow me (and them) to build the current RQuantLib. Instructions for Getting Started with QuantLib and MinGW from Scratch by Terry August (found in QuantLib FAQ 3.

Risk-Opportunity Analysis

I will be attending Ralph Vince’s risk-opportunity analysis workshop in Tampa this weekend. Drop me a note if you’re in the area and would like to meet for coffee / drinks.

Algorithmic Trading with IBrokers

Kyle Matoba is a Finance PhD student at the UCLA Anderson School of Management. He gave a presentation on Algorithmic Trading with R and IBrokers at a recent meeting of the Los Angeles R User Group. The discussion of IBrokers begins near the 12-minute mark.

Patrick Burns is blogging

Patrick Burns is the author of several helpful R resources, including A Guide for the Unwilling S User, The R Inferno, and S Poetry. He also wrote one of my favorite critiques of Microsoft Excel: Spreadsheet Addiction. His writing is witty, entertaining, and packed fully of useful bits of information. I strongly recommend you add his blog to your list of regular reading material.

Margin Constraints with LSPM

When optimizing leverage space portfolios, I frequently run into the issue of one or more f$ ([Max Loss]/f) being less than the margin of its respective instrument. For example, assume the required margin for an instrument is $500, f$ is $100, and $100,000 in equity. The optimal amount to trade is 1,000 shares ($100,000/$100). However, that would require $500,000 in equity, while you only have $100,000. What do you do?

Estimating Probability of Drawdown

I’ve shown several examples of how to use LSPM’s probDrawdown() function as a constraint when optimizing a leverage space portfolio. Those posts implicitly assume the probDrawdown() function produces an accurate estimate of actual drawdown. This post will investigate the function’s accuracy. Calculation Notes: To calculate the probability of drawdown, the function traverses all permutations of the events in your lsp object over the given horizon and sums the probability of each permutation that hits the drawdown constraint.

LSPM Joint Probability Tables

I’ve received several requests for methods to create joint probability tables for use in LSPM’s portfolio optimization functions. Rather than continue to email this example to individuals who ask, I post it here in hopes they find it via a Google search. ;-) I’m certain there are more robust ways to estimate this table, but the code below is a start… # `x` is a matrix of market system returns # `n` is the number of bins to create for each system # `FUN` is the function to use to calculate the value for each bin # `.

Introducing IBrokers (and Jeff Ryan)

Josh had kindly invited me to post on FOSS Trading around the time when he first came up with the idea for the blog. Fast forward a year and I am finally taking him up on his offer. I’ll start by highlighting that while all the software in this post is indeed free (true to FOSS), an account with Interactive Brokers is needed to make use of it. For those not familiar with IB, they offer a trading platform that excels on numerous fronts but is most appealing to those of us who trade algorithmically.

Thoughts on LSPM from R/Finance 2010

I just got back from R/Finance 2010 in Chicago. If you couldn’t make it this year, I strongly encourage you to attend next year. I will post a more comprehensive review of the event in the next couple days, but I wanted to share some of my notes specific to LSPM. How sensitive are optimal-f values to the method used to construct the joint probability table? Is there an optimizer better suited for this problem (e.

Historical / Future Volatility Correlation Stability

Michael Stokes, author of the MarketSci blog recently published a thought-provoking post about the correlation between historical and future volatility (measured as the standard deviation of daily close price percentage changes). This post is intended as an extension of his “unfinished thought”, not a critique. He suggests using his table of volatility correlations as a back-of-the-envelope approach to estimate future volatility, which led me to question the stability of the correlations in his table.