Thursday 26 April 2012

HFT Strategy

Two posts in one day... yes, have too much free time. Colo box is heading back, lost this round but just one of many to come. Decided to target pure FPGA strategies as it plays to my strengths  - hardcore tech (yes can code verilog) & need team up for that,  but more on that later.

So what does the return on a HFT strategy look like? Somethings like this.


Above is March 2012 worth of accumulated PnL, horizontal axis is # trades, vertical axis is accumulated dollars. In this case it makes about $4K / month on a single symbol on roughly 4M shares / month of volume, which is about $80MM/month of trades. On the day-to-day basis 90% of the time the PnL is flat or positive doing about 100-200 trades per day - keep in mind this is only 1 symbol out of many. Its simulated with full trade & quote data + liquidity rebates, commissions and latency discussed later.

How real is it? Its not live thus 100% BS :) In reality my model of the nasdaq queue is fairly simple and there`s some weirdness in the matching engine I haven`t worked out thus isn`t modeled. The only way to know is trade it for real... which I dont have the infra for.

The theory goes $4K/month for 1 symbol,  find 10 symbols makes it $40K/month, 20 symbols $80K/month etc all is good. Thus go out, signup for an eTrade/IB account and trade your way to $100M return in a year... or NOT.

HFT strategies are either highly sensitive to latency, commissions or both, so lets explore. First up latency.



The above plots show the monthly PnL with a -1.25 commission at various levels of simulated latency. From top to bottom its, 0usec, 100usec, 250usec, 500usec, 1msec, 2msec, 5msec, 10msec, 100msec. Thats a pretty broad spectrum. Whats clear is the variance dramatically changes from a 100usec latency to a 100msec latency aka the return gets very "lumpy" something you really don`t want.

In pure dollar terms, 0usec latency returns $3,942 with 100usec $3,179, 1msec $2,341, 100msec $1,978.

Or put another way, 

100usec  $3942 - $3179 =  $763/mo @ 10 symbols thats  $7,630/mo
+900usec $3942 - $2341 = $1601/mo @ 10 symbols thats $16,010/mo
+90msec  $3942 - $1978 = $1964/mo @ 10 symbols thats $19,640/mo

... 90msec costs $20,000/mo. Which can be interpreted in a variety of ways. e.g. dont trade on 100msec of latency!

If you look closely the number of trades slightly decreases then increases with the higher latency, the reason? Its a passive strategy thus if your too slow when the world moves you get hit by a bus because your sleeping in the middle of the road... instead of running to the other side. Resulting in a alot of unfavorable trades. In tennis I guess this is called "unforced errors".

So even @ 100msec latency its profitable making a hypothetical Tech setup of IB account hooked up to say Amazon EC2 & even if the everything is Java(.. ducks..) we should be well under 100msec tick to trade.. all good.

The other axis is per trade commission's as discussed in a previous post. Whats the PnL look like? ......


... and there`s alot of red ink on the plot. The above plot has commission's from top to bottom of 0, -1, -5, -10, -15, -20 per share. As you can see @ -1 myri / share its a solid green, -5 its a bit shaky yet still firmly in the green.  At -10 myri/share its in trouble and it just goes down hill from there.

So whats a reasonable commission/latency estimate? It depends at what level of the game your playing. For IB something like 100msec & -20myri / share which gives...



... a really red and nasty picture.. it loses about -$10,000/month. Same strategy just different latency & commissions.

Whats do you need and what is realistic ? 100usec & -1.25myri/share if you have $250K - $1MM to invest and doing alot of volume every day... which looks like.


... a nice picture indeed.

As has been said by many people before HFT is half strategies, half technology, you need both or you will lose.

4 comments:

  1. Thanks for the wonderful description of the problem.

    You said that you decided to use FPGA. Do you already have a chosen strategy, how you do it? Is the whole is to operate entirely on the FPGA as a separate module (board), or do you want to use FPGA on PCIe? If PCIe, do you want to connect the FPGA to the CPU or to remain only on the FPGA?

    http://www.bittware.com/applications/App-stories/financial_acceleration.cfm

    Have you thought about the specific hardware producers.. like bittware?

    http://www.bittware.com/products/hardware/prod_desc.cfm?ProdShrtName=S5PE

    Solarflare wants to introduce FPGA on the net cards. They call it ApplicationOnload Engine:

    http://www.theregister.co.uk/2012/02/08/solarflare_application_onload_engine/print.html

    http://solarflare.com/02-07-12-Solarflare-Unveils-ApplicationOnload-Engine-Application-Accelerator

    best regards,
    Daniel

    ReplyDelete
  2. Hi Daniel,

    btw you missed the 7124FX

    http://www.aristanetworks.com/en/products/7100series/7124fx/7124fx-datasheet

    IMHO strategies change/tweeked so frequently that you can not say strategy X back tested well so lets go hire some HDL guys and say put this in hardware.

    What will happen is

    1) ASIC HDL guys think 3mo from spec to tapeout will think your a nut job.

    2) 3mo for development/verification/timing/floor planning/tapeout of an ASIC *IS* crazy aggressive

    3) your verification guys will want 6mo to test all the edge cases.

    4) 6mo from now market will look completely different.. hell 6weeks from now it will be different.

    6) 6mo from now your back tested strategy is no longer profitable.

    ... this is *NOT* how you go about it but... is the conventional wisdom.

    ReplyDelete
  3. Arista is extremely expensive:

    "The regular 7124SX switch costs $13,000, but getting the full-on AppSwitch 7124FX switch with the x86 server, the FPGA, and the 50GB SSD will run you $49,995. Adding the atomic clock will cost you another $10,000 on top of that."

    I don't have deep pockets to buy Arista :)

    I agree with you that strategy on FPGA needs a lot of time. I prefer to put static things, like feed, EMS/OMS and risk on an FPGA and the strategy logic would keep on the CPU (it change more frequently) - that combination (FPGA + CPU) make sense for me, so Solarflare / Bittware are very interesting.

    regards,
    Daniel

    ReplyDelete
  4. BBO, full book ?! ... i dont think so ... top of book is sufficient

    ReplyDelete

Note: only a member of this blog may post a comment.