Saturday, 31 March 2012

Work Life Balance

Another week finished and still unprofitable.. haven`t really traded much last week or two as busy in research/quant mode. My edge gets better by the day, but sadly the comission`s and latency do not. Current problem is I keep building profitable strategies but for some reason always make them passive ... which require extremely good queue positions which means... it wont work with my setup... meaning wasting more time.

To have an excellent queue position on say SPY requires a direct feed from nasdaq, 10Gb, ultra low latency pre trade risk checks and fpga/extremely tight code for market data processing. e.g. the ability to filter out all the crap when your about to get hit by a bus. Unfortunately this is really expensive (for myself atleast) so dont have it and thus have finally made the conscious decision to absolutely under no situation build a passive strategy.

For those who dont know, I`m based out of Tokyo which means really weird and utterly brutal hours. All the movies of dudes sitting on Yachts in the Bahamas spending 10min/day adjusting their positions via laptop over a satilite connection? ... is well ... not my case and certainly not the life of anyone I know who trades.

Imagine this schedule


Mon:  5:00 - 18:30 : 
Mon: 30min - 1H siesta
Mon: 19:30 - 00:00 : Market Open 9:30 EST (22:30 Tokyo)
Tue:  0:00 -  7:00 : Market close 16:00 EST (5:00 Tokyo)
--- sleep ---
Tue: 11:00-   0:00
Wed:  0:00 -  7:00
-- sleep ---
Wed: 11:00 -  0:00
Thu:  0:00 -  7:00
-- sleep --
Thu: 11:00 -  0:00

Fri:  0:00 -  7:00
-- sleep --
Fri: 11:00 -  0:00
Sun:  0:00 -  7:00  <--- now!
-- sleep --
Sun: 13:00 -  0:00
-- sleep -- 

And yes Monday is a 24H work day. All up think its easier to use 24H * 7 - SleepTime... which is

24*7 - (6 * 4 + 1 * 5) = 168 - 19 = 149H week

Obviously this aint sustainable long term and pile onto that 6days/week * 12-16H/day for 6months and you get some sort of idea on how many hours its taken me to get to this point.. and still not profitable (holy fark!) For those lucky enough that are in the right location and can learn from co-workers/existing code bases it makes a *huge* difference... ive wasted so much time on the wrong things, but on the plus side what I do understand is burned into my cortex forever as have paid the price via trial & error.

.....dont try this at home kids :P

Friday, 23 March 2012

Too Many Hats

Another week with consistent alpha proving elusive. Got most of the tech problems got sorted out which left only math problems. The math unfortunately is not so easy to fix. Was running a few incarnations of a sub tick arbitrage strategy that unfortunately the combination of comissions/rebates/latency/law of large numbers means it will never make money/inconsistent or not enough to cover the fixed infra costs. So hit the puke point, taken the stop loss and building a new strategy.

Whats interesting(and frustrating) is I can now build a variety of profitable back tested strategies fairly easily, which was certainly not the case a few months ago. Yet when running it live it fails to match the model. The reason? many. but to a large extent I didnt know alot of the characteristics/behaviour when interacting with a real market/real broker which significantly eroded the edge.

My general process for strategy development goes like

Stage 1) "back of the envelope mode" this is quickly test some basic assumptions with level 1 data or medium granularity bars or both. At this point don`t care about latency or even the queue and commissions/rebates arent priced in. The goal here is to check the "edge" is there and if so, it needs to be sufficiently strong  & consistent.


Stage 2) Add the queue/comissions/rebates/tax and then trade & quote data. At this point everything is run in lock step. e.g. one step == one message. Find this is where I most of the time. Whats good about this stage is, its really easy to change the strategy add new things, remove things do all sorts of random stuff to it and not have to worry about any of the order entry/market data details, e.g. order/cancel reject handling, re-priced, latency, etc etc

Stage 3) Code it up as a a real strategy. This means real async order entry/market data and you now have a time constraint - if a tick takes 1sec to crunch then you will get run-over. The environment here is a fully simulated exchange both order entry & market data that is replaying historical. This can be fiddly but your just re-coding up Stage 2) which is fairly straight forward and the environment you already coded thus dosent take very long.

Stage 4) Run it live against the real exchange. My setup makes launching a strategy simply executing a program on the command line, theres no monolithic gui/master program/program within program. All a strategy does is talk to shared memory. Thus can run it one shot at a time, or continuously, have scripts calling scripts call the strat, etc etc the usual linux scriptfu. From here its easy to monitor and watch, tune and fix/debug. The key here is to make it match the theoretical/backtested model or change the theoretical model to match the observed behaviour.

... and this is where im at. Sucks pretty badly spent so much time and effort so far without any real success. Had a few highs tho, turning my position over a few times was really cool! as was sending half a million dollars worth of orders to the market but sadly, still missing something, still in the red and the  20H days are catching up.

the quest continues...








Saturday, 3 March 2012

Week Number 2

Wow my 2nd week live has finished, pretty much just testing the break, accelerator, warming up the tiers, a few test laps, getting a feel for at what speed/rpm to shift gears. how it corners and most importantly how fast does it go and how fast can it stop.

so far no trip to the emergency room.... yet lol

This pretty much sums up the experience


... and yes getting wacked happens a bit, tho only down $20 so far. Whats weird is there`s this completely irrational fear, similar to the fear of talking to that girl... or hitting that asshole on the nose...  and now a new addition...  putting 100shrs at the BBO. Theres no logical explanation for it. Sure, she might ignore you, or you might get some nasty bruise or you might get executed with a 100shrs of an incredibly liquid stock, all 3 of which are of little consequence.

So just like the above examples, after you`ve done it a few times and realize its not so bad, the irrational fear dissipates and the analytical part of your brain takes over from more primal/emotional.

Basic breakdown has been

Week 1
- code order entry gateway
- code market data feed handler
- code risk managmenet
- cron jobs
- scripts of all sorts
- various system infra stuff.. pissed you cant monitor ECC failures
- various silly bug fixes

Week2
- recon/SOD/EOD automation
- performance/latency tests
- debugging latency problems with market data
- re-wrote feed handler (latency probs)
(most of the week spent on market data latency)

Whats gone wrong so far?

- incorrectly sent massive burst of cancels (5000+) ... opps
- VPN connection into colo dropped out while trading! holy fark!
- a few run-away terminal sessions, flood of printf`s makes ssh un-responsive
- desktop PC`s deciding to update and reboot by themself
- pretty much most of my worst fears have happened

Murphy I really do hate you.

Next up? bit more latency/performance tuning and now finally digging deeper into strategy development, and as they say.

Gentlemen, please start your engines!