A friend of mine recently started using Interactive Brokers through Python on Linux, and referenced the installation guide in my previous note. He wrote a much better, clearer set of instructions. Python is a really good language to code in and Linux is easier to work in and has less overhead processes than Windows.

percent sign (%) lines are comments, other lines are to be entered in a terminal.

%-------------------------------------------------------------------------
%---
%1. Run Ubuntu 9.10 Installer
%---

%---
%2. Update ubuntu 9.10 with the latest everything
%---

sudo apt-get update

%there were 159 MB of updates on 12-17-2009

% If you have any problems while running the update, run this to resume the
% update (important if you are downloading a few hundred MB of updates).

sudo dpkg --configure -a

%install flash

sudo apt-get install flashplugin-nonfree


%---
%3. Download trader workstation
%---
%URL:
%http://interactivebrokers.com/en/control/systemstandalone.php?os=unix&ib_entity=llc
%
% Or you can just run the following command
%

sudo wget http://www.interactivebrokers.com/download/unixmacosx.jar

%run this in your home dir or your downloads dir and it will download the file

%---
%4.Install Python, using the following commands
%---

sudo apt-get build-dep python-numpy python python-scipy python-gtk2
python-imaging ipython

%this is about 326 MB as of 12-17-2009

sudo apt-get install python-numpy python-profiler python-gtk2
python-scipy python-matplotlib python-matplotlib-doc ipython pychecker
pylint pyflakes python-doc python-examples python-imaging
python-scientific python-serial python-docutils python-glade2

%this is about 80 MB as of 12-17-2009

%---
%5.Install and Configure Java and then Install and Configure Trader
Workstation (TWS)
%---

%install the java runtime using the following commands:

sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts

%install the Java Dev Kit will give you the jar command necessary to install TWS

sudo apt-get install sun-java6-jdk

%test the java installation with this command

java -version

%make a directory for IB TWS

mkdir /home/YOUR_USERNAME/IBJts


%move the IB download from the download directory to the home directory

cp ./unixmaxosx.jar /home/YOUR_USERNAME/

%extract the TWS files

jar xf unixmacosx.jar

%install TWS

java -cp jts.jar:pluginsupport.jar:riskfeed.jar:hsqldb.jar:jcommon-1.0.12.jar:jfreechart-1.0.9.jar:jhall.jar:other.jar:rss.jar
-Xmx256M jclient.LoginFrame .


%---
%6.Install IBpy
%---

%download ibpy wget IbPy-0.7.6-9.51 (current as of writing 12-17-2009)

wget http://ibpy.googlecode.com/files/IbPy-0.7.6-9.51.tar.gz

%extract

tar xzf IbPy-0.7.6-9.51.tar.gz

%go to the directory

cd IbPy-0.7.6-9.51

%setup

sudo python setup.py install

%run TWS

java -cp jts.jar:pluginsupport.jar:riskfeed.jar:hsqldb.jar:jcommon-1.0.12.jar:jfreechart-1.0.9.jar:jhall.jar:other.jar:rss.jar
-Xmx256M jclient.LoginFrame .


%run IBpy demo

python IbPy-0.7.6-9.51/demo/example_opt

Just found this convenient list of ETFs through the TWSAPI Yahoo discussion group. The site it's from, masterdata.com has some other data sets too which I haven't looked into.

I read the Ph.D thesis of Cengiz Y. Belentepe titled "A Statistical View of Universal Portfolios" because I'd been looking for a concrete paper on universal portfolios (UP).


The UP is a portfolio allocation scheme that is supposed to perform as well as the best constantly rebalanced portfolio constructed with the benefit of hindsight. A constantly rebalanced portfolio is one where you choose certain weights for each asset and then rebalance your allocations whenever one rises or falls to match the original weights. With hindsight means you can choose the best portfolio among all fixed-weight portfolios knowing what the future will be like. The UP is supposed to be able to match this because it is a dynamic, rather than static, allocation scheme.

However, it's important to know that the UP is only supposed to perform as well in the sense of a lower bound. If you know computer science then this is like saying that the Big-O efficiency (in terms of profits not time) is the same. However, a constant multiple can be enormously important in investments.

Anyway, the thesis was really interesting (although I imagine that for a thesis committee it wouldn't be obfuscated by enough complicated and excessive but impressive math).


Here are some of the most interesting bits I learned with page numbers so you can look them up too (p. book/pdf).

1. Universal Portfolios are, down to an approximation, equivalent to Markowitz's mean-variance optimization. (p.36/52)

2. A constantly rebalanced portfolio is much more powerful than it appears. For example it can "turn two nags (assets A and B) into a thoroughbred (equity curve)":








In this case we have two assets that just go up and down with -1 correlation and our fixed weights are half of our equity in each asset, rebalanced at the end of every period. He also shows a similar result on real stocks. Essentially the equal-weight constantly rebalanced portfolio is the simplest mean-reversion strategy. (p.22/38)

3. There is a nice quote by Cover summarizing the UP on page 33/49

4. There is an extremely concise and practical explanation of two methods of intelligently estimating a covariance matrix - by exponential smoothing to decrease the influence of points in the past and eigendecomposition to shrink/regularize/decrease overfitting. (p.62/74)

5. The UP can be beaten by the most naive portfolio allocation scheme - uniform allocation. He humorously calls it the capitulation portfolio. Results on real stocks show that this can hold in the real world too. (p.63/75)

6. He uses Cover's own data to show that the UP is not that effective. (p.60/76)

7. And finally lists some good heuristic learning rates to try with an exponentiated gradient (EG) online learner. I won't go into details here (probably later) but EG is a powerful, efficient, theoretically pretty algorithm good for adversarial learning settings. I always like seeing heuristics because most academic papers are missing them but in practice they are so helpful. (p.66/82)

Overall I enjoyed it a lot more than I expected and it was an easy read. Please leave a comment if you know of any good sources on modern UP work.

Here's a good 2008 paper by Martin Sewell reviewing the literature on financial time series from around 1980 to 2008.

Some of the characteristics covered are: autocorrelation, return distributions, non-linearity, volume, calendar effects, and so on. It's a really comprehensive and easy to read review. Here's a screenshot of the Conclusion and Summary:

UPDATE: Great additional list from Or Shai in the comments:


This could be useful for finding a job or just Googling out of curiousity. This is a secretive industry so it can be hard to tell which firms are important.

From Nuclear Phynance:

Banks -
Goldman Sachs
Morgan Stanley (PDT or ETL)
Barclays
Deutsche
JP Morgan

Hedge Funds -
Athena Capital Research
D.E. Shaw
Two Sigma
Millennium / World Quant (masters level+)
Renaissance
HBK (not hiring)
Citadel (no positions listed, accepting resumes)
IV Capital (only career email listed)
Tower Research (only back office internships)
Knight (only 2 back office jobs listed, not internships)
Blue Crest (minimum PhD for front office)
Winton Capital (UK based, winter internships)
GSA Capital (only career email listed)
Etc.

Prop -
Hudson River Trading (only C++)
Wolverine Trading (Internships)
Optiver (No internships)
CTC (Chicago Trading Company) (Trading assistant TA)
Fox River Partners (No website)
Jump Trading (Internships)
Spot Trading (Career website down)
GETCO (No internships)
Sun Trading (No internships)
Matlock Capital (Tiny, no positions)
Ronin Capital
Allston Trading (Software developer internsips)
Chopper Trading (No internships)
Tradelink (No internships)
Etc.

It would be great to extend this list, please leave a comment with additions.