I THINK ∴ I'M DANGEROUS

bl-sh

bl-sh from Buy Low, Sell High - pronounced `blush' is my foray into algo based day trading. I'm trying to make myself into a quant, albeit I'm starting out pretty simplistic.

The project has grown to the point of taking up several pages and merits its own sub-section. My current work is on branch 'blush'.

Tradeking

Tradeking provides an amazing service for an amazing price. Unlike other trading services their API is free. Unlike other trading services their API is easy to write an interface to in any language. Several other services provide dlls to interface with their servers and thus limit you to not only windows, but to specific languages.

Their documentation is clear and mostly complete and their tech support is quick to respond and helpful.

Trials

test2

test3

test4

test5

Test5 got my hopes up great as soon after implement a few changes and improvements total value started skyrocketing. I soon realized the increase in value was due to a bug I introduced when I changed the order I stored price values.

Since the bug invalidated all data I had collected, I reset all my logs/stats and began the simulation again at a more reasonable $3,000 initial investment amount.

test5.1

test5.1 is the same code as test5, it was just given a (somewhat ridiculous) starting amount of 20,000 so I could have an apples-to-apples comparison to see what kind of affect, if any, a substantially larger initial investment makes.

rc1

Rc1 is a perl based re-write of test5 utilizing the tradeking API for data. I abandoned it after getting frustrated with perl and other issues. Blush is the true successor and first real implementation of the tradeking API.

blush

Blush is the first version of bl-sh written in tcl and the first version to utilize (ignoring rc1). After a sudafed fueled coding marathon and pouring over the OAuth RFC, I resolved a bug in this implementation of OAuth. Once that bug was fixed it was open season for implementing

I took blush in a different direction an previous versions of bl-sh, implemented a faux-OOP system. Stock names are registered as commands (procs) and values are retrieved and set as sub commands.

So instead of doing

[lindex [dict get $stocks $stock bidprice] 0]

I just do

[$stock price]

I could have just as easily created various procs like that accept the stock name as a parameter and return the value, but this way I prevent the global namespace from getting polluted.