Saturday, 18 February 2017

Some of my favourite, or most useful, finance books

Fortune's Forumla was one of the most fun reads I've ever been fortunate enough to stumble across. That's a big call, but I mean it. It's certainly been a while since I last read it, but it has been worth reading more than once. I must read it again. William Poundstone's narrative theme is the Kelly Criterion largely centred around Ed Thorp with a dash of Claude Shannon. You gotta read it to understand how the mob's low latency telephone betting arbitrage underwrote an embarrassingly large amount of AT&T/Bell's revenue. The amazingly simple story within: buy the worst performing stocks the next day, sell the best performing, rinse repeat for a couple of decades. Just read it.

At four companies I've been involved with, I used C/C++ code that was transliterated from Espen Haug's The Complete Guide to Option Pricing Formulas book. As far as option pricing goes, this approach was largely enough pricing to make some millions of dollars. Last time I just ocr'd the relevant pages, as the CD had gone walkabout, and transliterated the BASIC code to C/C++ fairly directly. Pricing and unit tests done in less than a day. Perhaps I should do it again and release such C++ as open source so I can stop the repetition. I kind of prefer the size and convenience of the first edition, but the second edition is certainly an improvement.

I like Barry Johnson's Algorithmic Trading and DMA: An introduction to direct access trading strategies even though it is not overly insightful for a market professional. It is nice, clean, and easy to read but its real usefulness to me has been as the "goto" description of a call auction if anyone asks you. That small snippet is dog eared. Somehow I find it a particularly pleasant book even if it is not filled with great insight. A tidy reference.

As far as understanding option trading goes, there is only one that is worthy that I've come across. It is ancient but still relevant and a great introduction for a budding trader. Sheldon Natenberg's Option Volatility & Pricing: Advanced Trading Strategies and Techniques. This is the ancient 1994 edition I've read and recommended over the years. There is a newer 2014 edition, "Option Volatility and Pricing: Advanced Trading Strategies and Techniques, 2nd Edition", but I can't vouch for it as I haven't read it, though I know I probably should.

For futures and option basics, especially for new finance staff, just stick to the biblical Hull, "Options, Futures, and Other Derivatives (9th Edition)", but why is it now so expensive? You might find a better price in a university's co-op bookshop. Just a tip.

I'm not the biggest Taleb fan, but whilst I found the mildly annoying "Fooled by Randomness: The Hidden Role of Chance in Life and in the Markets (Incerto)" was well worth the read, albeit through gritted teeth, you gotta give Taleb a lot of credit for the masterclass that is: "Dynamic Hedging: Managing Vanilla and Exotic Options."

Rebanto's "Volatility and Correlation: The Perfect Hedger and the Fox" is a favourite of mine though I've only read about half of it as it is my most "missing" book. Over the years, somehow it has just walked out of a few of my offices and disappeared into the Ether. Perhaps there can't be a much better recommendation than that? I'd like to read it all but I can't really afford to keep buying copies. I credit this book with stimulating me into some newer and novel ways of thinking about volatility and pricing that aren't contained in any text book. That is a real credit to Rebanto's intuitive way of presenting his thoughts on pricing and volatility. He's a good teacher. Perhaps it is the most valuable half read book I've never completed? Hmmm.

As another fun, albeit soft, read, Peter Berstein's "Against the Gods: The Remarkable Story of Risk" is about as good as it gets. The story about the English using the Roman life tables for their annuities is a rip roarer, especially when you look at those median life spans from the 1600s. There is a lot of context in many of his books that have enriched my life. Highly recommended.

What's next on my list? Well I'm waiting on Amazon to deliver Dave Cumming's autobiography, "Make the Trade". It should be a beauty based on this snippet:

A snippet from Sniper's tweet
(click to enlarge)
I've chatted briefly to Dave a few times and always found him to be terribly interesting and engaging. I'm sure his tome will be a great read, full of historical gems that only someone who has been there and done that can provide.

Happy trading,


Tuesday, 24 January 2017

US microstructure - why the rules don't matter

That's a little facetious. Rules do matter except when they don't.

Let's trudge past the click-bait-like title a little to revisit the recent Citadel SEC fine: A tale of two cities' firms.

First a fair warning. This is really not that interesting and you'll have to be a very bored market structure geek to care much about this meandering meander. My advice is to run away whilst you still can.

OK. Don't say I didn't warn you.

CES was fined for a lack of disclosure around how their internaliser worked under some limited circumstances. In the article linked above, I explained why I think PFOF and best execution is kind of oxymoronic. Nevertheless, it is useful, and prudent, to remember that the retail punter is better off, on the whole, with CES stepping in and providing general price improvement. CES is a remarkably efficient PFOF machine that benefits many clients. Perhaps the market could do better if given a chance to chew on retail orders? Probably not easily, and perhaps never, especially with the sub-penny rule. It's an interesting dilemma.

All that aside, there were some questions around if, and if so: when and how, FastFlow and SmartProvide at CES would have become improper if they did continue. Larry Tabb suggested such activity was allowed at the time but was not likely to be OK now:

That was interesting as I wasn't sure when or where the regulations made the direct feed (DF) essential if you had access. It still remains that you can use just the SIP if that's all you have, by the way.

Mr Kipp Rogers pointed out the correct FINRA regulation covering this. Kipp also pointed out the preceding reg from the daze of NASD. The text is pretty short. Importantly, all the various versions are also referenced as they changed over time. You won't see any reference to a DF in them there wordy things though. Hmmm.

Let's have a quick looks at FINRA 5310, the pertinent regulation. The particular sub-section reads:

5310. Best Execution and Interpositioning 

(a)(1) In any transaction for or with a customer or a customer of another broker-dealer, a member and persons associated with a member shall use reasonable diligence to ascertain the best market for the subject security and buy or sell in such market so that the resultant price to the customer is as favorable as possible under prevailing market conditions. Among the factors that will be considered in determining whether a member has used "reasonable diligence" are:
(A) the character of the market for the security (e.g., price, volatility, relative liquidity, and pressure on available communications); 
(B) the size and type of transaction; 
(C) the number of markets checked; 
(D) accessibility of the quotation; and 
(E) the terms and conditions of the order which result in the transaction, as communicated to the member and persons associated with the member.

That form of the rule is the latest incarnation, as from 9-May-2014. Some form of this best execution obligation has been a rule effective since May 1968 you'll see in the history listed at the bottom of the reg. I presume preceding 1968 best ex was just a moral obligation if there was no such rule. I expect it was likely covered by some code of practice somewhere. After-all, doing the right thing by a customer is an obvious and indispensable thought.

If you choose to go to the previous version of the FINRA rule, the text of 5310 (a)(1) remains exactly the same for the period covering May 9 2011 - May 30 2012. This is still after the CES fine period. We have to go back to the preceding reg at NASD2320 and look at the third last version to get to the last period covered by the CES settlement:

2320. Best Execution and Interpositioning

Past version: effective from Dec 14 2009 - Jun 27 2010.

(a)(1) In any transaction for or with a customer or a customer of another broker-dealer, a member and persons associated with a member shall use reasonable diligence to ascertain the best market for the subject security and buy or sell in such market so that the resultant price to the customer is as favorable as possible under prevailing market conditions. Among the factors that will be considered in determining whether a member has used "reasonable diligence" are: 

(A) the character of the market for the security, e.g., price, volatility, relative liquidity, and pressure on available communications;
(B) the size and type of transaction; 
(C) the number of markets checked; 
(D) accessibility of the quotation; and 
(E) the terms and conditions of the order which result in the transaction, as communicated to the member and persons associated with the member.
Yes. It's the same. The regulatory text hasn't changed but what was proper is now improper. So how did it change? How do you know what is the law of the land?

It is unfortunate that reading the law gives not that much understanding of the interpretation of the law. That changes over time. This is a particular case in the point. The Best Ex obligations and wording have remained the same, but the interpretation changed. When you re-read Larry Tabb's tweet above, carefully note the word "guidance." Hmmm.

I asked for a pointer to when that was on twitter. Mr David Weisberger politely replied as follows:

The link to the November 2015 interpretation that mentions DFs in footnote 12 is here, with the following snippets extracted:

So, that's settled. If you're somewhat unsettled by the settling of something so important in a footnote to a regulatory notice that is not explicitly referenced in the regulatory legalese, then you're not alone. Practitioners in law and tax have long had such problems. Law is set by precedents and interpretations by different strengths of courts and officials. Sometimes concurrently. Sometimes with paradoxical conflict. The sometimes twisty, long history of many of these things matter. Some interpretations will go back to the Magna Carta over 800 years ago so don't feel bad if you're too young to remember the actual regulatory events. It is simply not possible for a mortal to have the collective history of all laws and interpretations, so we rely on study and specialisations. As Matt Levine points out in Marblegate, sometimes we forget about how things became the way they are until cases are lost and then won on appeal when clever archaeology assists the memory reconstruction process to derive the thoughts that once resulted in a heuristic now assumed to be innate,
"There are three possible levels of understanding the law, or a bond document, or whatever:

  1. Not reading it.
  2. Reading it.
  3. Reading it while also being familiar with the institutional memory of the legal community."
The largest law library in the world, available to all
Good luck reading
"approximately 5 million items"
It is a curse of the modern world. My father opines for a return to an understandable tax system. In the 1960s, when he first became a partner in an accounting firm, he fondly remembers being able to read the tax law in a thinnish but not tiny volume, and digest it, and understand it. Today's Australian tax law is voluminous, cumbersome, and esoteric and yet still likely simpler than the US tax code. One of his practice's partners had deep anxiety about the ever growing complexity of tax. He felt he could no longer serve his clients diligently as he simply could no longer keep it all in his head. This fellow took an early retirement rather than cope with the anxiety of the unknowable that all sensible accountants and lawyers must contain within their true selves beyond the carefully marketed veneer of expertise. Therefore we have the practice of regulatory books reproducing laws along with carefully researched annotations regarding precedents, cases, and interpretations that are necessarily incomplete but serve as the "real" law to most except for the rare exceedingly expert bird.

Market regulation is simply a simpler case of the same lack of simplicity.

That is, market structure is perhaps now getting to a stage where it has a similar need for an interpretive dance book just like larger fields. DF versus SIP for PFOF. IOIs in the dark. Speed bump interpretations and types of delays. The so-called millisecond "de minimis" that isn't a millisecond. Allowable orders. There is an annual interpretive book needed there that I definitely don't want to read but probably would. It would be incomplete, a good start, and cheaper than a poorly focused discussion with a securities law firm.

For now, the bottom line is, you won't know the law if you read the law. Be alert, not alarmed. That's how it is designed to be. You'll need the institutional memory of bright folk like Larry Tabb, David Weisberger, David Lauer, Kipp Rogers, and their kin to keep you straight.

Good luck with that,


Tuesday, 17 January 2017

A tale of two cities' firms

Not so comical?
(source: Wikipedia)
"It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to heaven, we were all going direct the other way - in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only."

Charles Dickens is no less relevant in 2017 than he was in 1859. Yeah, the quote is a bit delightfully long.

The big news from last week was the Moody's gentle US$864m wrist slap and general escape. However, the micro news was a bit more stimulating to me. The SEC came out with two interesting finalisations of matters.

Firstly, ITG's Frank Troise's valiant attempt to turn around belief struck a hiccough with ITG's well telegraphed ADR fiasco being finalised by the SEC ($US 24.4M). Secondly, Citadel, or more specifically Citadel Execution Services (CES) as part of Citadel Securities LLC, was poked in the ribs for misrepresenting how some of its wholesale internalisation, or Payment For Order Flow (PFOF), worked ($US 22.6M). There was a very important difference between the two findings. ITG was doing something wrong. CES was not found to be doing something wrong with respect to transactions but, rather, was found to be miscommunicating what it was doing. Let's meander through both of these.

New York, New York

It's just on a year since Frank Troise took over at ITG. He has made significant progress in changing the focus of the firm back to its clients. The most important action undertaken was closing the proprietary trading and lending businesses down. ITG had been called to account for their pool abuses with their previous settlement of $US 20.4M. This new settlement may finalise the lending abuses and Troise's aim to deflect the settlement to historical legacy is fair enough. It remains to be seen if the strong language from the SEC,
"Many of the ADRs obtained by ITG through pre-release transactions were ultimately used to engage in short selling and dividend arbitrage even though they may not have been backed by foreign shares."
results in any other parties being held to account. The large missing item for ITG is that it has not been properly held to account for the historical lying to its customers about being an agency only business. ITG did infact engage in proprietary trading in the same or similar products to many of its clients. Bob Gasser misled a US Senate Committee in 2012 when he claimed ITG did not engage in proprietary trading,
"ITG is not a market maker, and we do not take on proprietary positions. In other words, we do not have “skin in the game...”
ITG closed their proprietary trading business in 2016. I don't think proprietary trading is necessarily a bad thing in a diversified financial services business, but lying about it is definitely bad. When you're caught out doing something you said you're not doing, the sensible thing is to get rid of it so your customers may grow better trust in your integrity. ITG seems a bit swollen in head count with ageing products but at least it has a chance now if it can lift its game. However, the deception associated with ITG's proprietary trading has not yet been accounted for by any regulator. We'll have to wait to see if that penny drops.

ITG's share price has been doing OK with reasonable interest being associated with sizeable positions. Now revenues may see some improvement through some of the diversification being promised. It is also possible significant head count reductions could see a much better ROI from ITG's legacy IP even if revenue faded. That is, I'm not sure ITG would perform much worse with only 250 people instead of over 1000. 2017 is going to be "interesting" for ITG staffers you'd expect. Time will tell if New York's ITG is a value trap or not.

A cover from the 1859 Serial. Has the SEC started another serial?
Is there more to come? (Source: Wikipedia)

By the inland sea: the other city

In a tale from the city of Chicago, Citadel had a bit of a different diagnosis and prognosis from their SEC fine. After a detailed look under the covers, the SEC found CES made misstatements about how its executions worked in some circumstances. Its operations were not found to be at fault, but its marketing was. That's an important distinction. So how bad was it? Is this similar to ITG deceiving its customers about it pool operations or prop trading? It looks quite different to me.

After trying to parse to the SEC order I found myself left without all the detail to make a proper judgement of the situation. There are are curious twists in the saga worth discussing however. I was certainly left with the impression that there was simple miscommunication going on rather than anything nefarious. The FastFill aspect goes to the heart of PFOF. More about that below as I feel the juxtaposition of PFOF and best execution responsibilities particularly troublesome. The other procedure focused upon by the SEC was CES's algo called SmartProvide. There is not enough detail to evaluate SmartProvide. The scant details could even be interpreted as a gain for the customer, though less likely than otherwise. Nevertheless, CES was penalised for saying it was doing X and instead doing mainly X with a dash of Y.

The scale of the Citadel misgivings was pretty small beer according to the SEC. They point out that CES does about 35% of retail execution in the US. Yet in the period covered from "late 2007 through January 2010" the SEC disgorged $5.2M for those two and a bit years. It is interesting to try to put that in a per customer perspective. CES is one of the big internalisers, for example they handle most of TD Ameritrade's volume. TD Ameritrade is one of the big five retail brokers (Nov 2015). This shows north of 50 million or so retail accounts are likely for the big five.  The SEC counted 109 million retail and institutional brokerage accounts in 2011. It would thus not surprise if there were approximately 100 million retail brokerage accounts in the US. So if the CES penalty was over 35% of those it would equate to about $0.075 annually.  Yes, seven and a half cents, per account per year. That calculation is arguably quite a bit wrong, but you get the idea. The scale is nevertheless appropriate. The profit attributed to those algos was pretty small beer.

There are a few interesting facets to all of this. Let's look at Fast Fill: from the SEC order,
"10. One strategy, known as FastFill, was triggered when the best price from one or more of the depth of book feeds that FastFill referenced was better than the best price disseminated by the SIP feed. Assuming all other eligibility conditions were met, FastFill immediately internalized a marketable order at the SIP NBB or NBO, as applicable, or better. 
11. For example, if CES was handling a marketable order to buy shares, and the SIP best offer was $10.01, and the best offer from one or more of the depth of book feeds was $10.00, FastFill immediately internalized the order using the SIP offer of $10.01 per share. FastFill did not internalize at or seek to obtain through routing the better $10.00 price from the depth of book feeds."
This is basically saying that if the SIP was behind the direct feed, the customer got the SIP and CES would do its best to get something better for itself. That may not have always worked out for CES, but it probably did. This is the direct feed (DF) versus SIP feed, a so called latency arb that isn't, but is frowned upon at an ATS or exchange. I'm not sure if this was improper for an internaliser under rules at the time. I don't think it was. Newer rulings, subsequent to January 2010, may have an impact in current interpretations. The SEC did not take the view it was improper, they just wanted proper disclosure. For example, say that you used some smart ML to determine the price was about to change and thus filled your clients over the spread with the expectation you would do better as you hedge, but with less certainty, is that wrong? At what price is innovation? It quickly gets cloudy.

SmartProvide gets murkier. The SEC order doesn't give full details but enough to know that you can't really make a judgement,
"12. The second strategy, known as SmartProvide, was triggered when the SIP NBB or NBO, as applicable, was better than the best price from at least one of the depth of book feeds. SmartProvide did not internalize at the SIP price, nor did it seek to obtain an execution at that price by sending an order to the market. Instead, assuming all other conditions for order handling by SmartProvide were met, SmartProvide would route a non—marketable order to the market.
13. For example, if CES was handling a marketable order to buy shares, and the SIP NBO was $10.01, and the best offer from one or more of the depth of book feeds was $10.02, SmartProvide would send a buy order to be displayed in the market at a price less than $10.01, such as $10.00. This order would be displayed for up to one to five seconds, depending on the size of the order. If this order received an execution, the customer order would benefit from the execution at the better price (i.e., the shares purchased by the customer would be at a price at least one penny better than the NBC). This occurred for approximately 18% of the shares handled by SmartProvide. If the order did not receive a full execution from this routing, CES’s algorithms reassessed the handling of the remaining shares, and could either internalize or seek to obtain an execution in the market. Some of the orders that CBS internalized after SmartProvide displayed an order in the market on their behalf received a price that was worse than they otherwise would have received in the absence of SmartProvide."
So, 18% of trades were executed at a better price. The customer benefited in those cases. Did that offset the other 82%? It is unclear. It probably didn't but it could have if the average 18% gain was 4 times larger than the 82% average displacement. We don't have enough information to know for sure. Also, it was not a simple DF versus SIP equation here as the decision was specific to order size and which stock as to how the algo assessed the decision making. Here is how the SEC described the SmartProvide trigger,
"Triggering Event for SmartProvide 
34. SmartProvide was triggered when the SIP NBB or NBO, as applicable, was better than the best bid or offer from one or more depth of book feeds. SmartProvide referenced only one depth of book feed for many securities and fewer than all of the depth of book feeds for other securities. Accordingly, at times, SmartProvide was triggered when the SIP NBB or NBO, as applicable, was from an exchange whose depth of book feed SmartProvide did not reference. In addition, SmartProvide sometimes could be triggered when the difference existed between the SIP and only one of the depth of book feeds SmartProvide referenced, and not the others.
35. For example, in the case of a marketable order to buy shares, SmartProvide could be triggered if the SIP NBO was $10.01, and the best offer from one or more of the depth of book feeds was $10.02, even though the best offer on one or more of the depth of book feeds from one or more other exchanges was $10.01."
So, it was a bit more complex than DF versus SIP. There was some judgement as to which DFs got used, often only one. However, this is not what was disclosed,
"40. During the relevant period, CES provided a written disclosure to certain retail broker—dealer clients that described a market order as an “[o]rder to buy (sell) at the best offer (bid) price currently available in the marketplace,” and made other, similar representations to its clients. As discussed above, these statements suggested that CES would either internalize the marketable order at, or seek to obtain through routing, the best bid or offer from the various market data feeds CES referenced. These statements were materially misleading in light of the way that FastFill and SmartProvide functioned."
Sometimes a client got a much better price by not crossing the spread thanks to SmartProvide. However, that is not what paragraph 40 says. It is wrong to say something and do another even if it's advantageous to the client. So, the customers still received SIP NBBO or better but the marketing didn't correctly represent the ever changing algo operations. This CES story is not simply a black hat versus white hat story.

Best execution versus Payment For Order Flow

If you were to do best execution by policy, I'd argue payment for order flow could not exist. By definition the wholesaler is getting money, say $0.002 per share, for handling the order. The wholesaler is not a charity. They are expecting to receive more than the fee they pay for the execution or the execution information as a statistical whole. They need to make a profit.

That is, fundamentally, the customer is not getting best ex in a holistic fee and execution sense. The broker could make the same decisions as the wholesaler. Then, instead of losing the wholesale fee and the wholesale profit, the customer could receive that cost as a benefit. This is what I mean by best ex and PFOF being in tension. It is also just weird that US retail broking is just not really all that concerned with, you know, broking. Maybe it's just me.

All that said, there are obligations on the broker to shop for the appropriate wholesaler and to monitor and report on such. There is some competition and tension in the market place even though big wholesalers are very few in number. To me, PFOF, like the order protection rule, had a point in days gone by, but it appears to have over stayed its welcome.

Europe does best ex better than the US. In the US you get an audit and profiled against the SIP. The US has specific procedural elements, such as the order protection rule, you must take heed of. In Europe there is a better approach where best execution is a policy. Thus best ex is a little woolier but it ostensibly takes the gaming of specifics out of the equation. However, a lack of enforcement makes for weak policy in the Europe but enforcement seemingly improves over time. Canada has learnt from the US and European experience and I think it has struck a better policy / execution balance. The SEC could learn a little from IIROC but are unlikely to look North for inspiration in their parochial world.

The order protection rule is ripe for change as, not only is it tired, incumbents benefit if it is retired. PFOF is unlikely to ease out of the picture as large brokers and wholesalers benefit, and arguably, the smaller brokers still benefit by being able to outsource their operations as the NMS gets ever more complex. However, best execution and PFOF will continue to remain oxymoronic to me.

Happy trading,


Wednesday, 4 January 2017

How to game Nasdaq's Extended Life Priority Order Attribute

Someone at Nasdaq wasn't thinking too hard when they proposed the Extended Life Priority Order Attribute (ELO). To quote ELO, "Confusion - you don't know what you're sayin'":

The FIA Principal Traders Group penned a pretty reasonable takedown of the proposal here. In addition to FIA's commentary, you always have to be suspicious of retail justification, or trials, for orders. Almost no retail order ever sees a US public exchange. It is kind of like justifying invasive laws with terrorism. Beware of falsely profiting prophets.

Simply put, the ELO attribute, if you set it, puts you ahead of other orders at the same price. 99% of your orders, reviewed quarterly, with the ELO attribute set need to last at least one second, or be executed. Yes, you can cancel your ELO attributed order in just a few nanoseconds without consequence, just keep in mind the 99% rule.

As an HFT, simply mark every order as ELO. Gain priority on all your orders and profit. Make sure 99% of your orders are away from best so they normally last the required one second. This can be done in the normal course of business as this is how you would paint the book with proper trade intentions for priority anyway. Trade normally with your regular flow, including fast cancels.

If you get it a bit wrong, don't panic as it is reviewed quarterly and you will be not pushed out on your first indiscretion.

Everyone will do the same, so all orders will be ELO and nothing changes. Stupid, huh?

The ELO proposal is trivially easy to game and thus somewhat pointless. Nasdaq should withdraw it.

Live long and prosper,



PS: ELO is kind of weird when the normal behaviour is for priority to be granted for orders the longer they are in the system anyway. You know, the normal price, time priority ordering thing. ELO grants priority for a promise of being in the system longer, but you don't have to mean it. You can cancel an ELO in a nanosecond regardless of your promise. Your ELOs are still ordered by time priority of arrival compared to other ELOs, so picoseconds still matter. Nevertheless, your one microsecond old ELO will take priority over the order that has been in the system for two hours. That makes little sense.

Sunday, 1 January 2017

2017 = 111111 0000 1

After a wee meander, 2017 seems a little weirdly interesting.

It's primal, not perfect, and odd. Really, after 2016?!

Its unicode suggests a year of delta: ߡ. Batten down the VIX then ;-)

Genetically, 2017 can't possibly be cool as it is the sum of squares: 9^2 + 44^2

2017 isn't politically happy as it opposes a primitive right [angle]. Some destiny: it is the hypotenuse of a primitive Pythagorean triple: 2017^2 = 792^2 + 1855^2

Cute representations:
2^11 - 2^5 + 2^0
3^2^2 + (2^2 (3^2 + 2))^2
It's a hex of old memories. 7E1 reminds me of the old BBS modem days: 7 bits with even parity. Remember when there wasn't an Internet and no blogs that wasted your time?

2017 mainly leaves one left out of small groups, unless you're talking about group of five. 2017 mod [2..9] = 1, except for 2017 mod 5 = 2. That's OK for me. After all, I'd question the judgement of small group that would include me :P

2017 suggests it is going to be interesting. Let's hope 2017 is not suggesting an ancient Chinese proverbial curse, "May you live in interesting times." Interesting in a good way would be nice.

Wishing you all the best for your primally odd 2017,


With some thanks to Wolfram Alpha
(click to enlarge)

Wednesday, 28 December 2016

Christmas console

Here is a rather agricultural console gaming machine I built for my three daughters at Christmas:

Emily is the youngest daughter, and thus the "Emstar" lighting at the top. The top box houses four speakers with the volume knob on the left front.

It kinda reminds me of what an iMac may have looked like if a caveman built an iMac with an axe when he was drunk. It's clearly not time to change profession; I'd better stick to my C++.

It's a Raspberry Pi 2 at the core as that's what I had sitting around. Retopie which is a debian based ARM linux image that includes Emulation Station was used for the base system. Retropie is rather nice as it includes a samba share straight out of the box, so that you can just drag and drop games to it from, depending on your poison, a smb://retropie or //RETROPIE path.

The box is mainly white with chromish trim to fit into the girls' decor.

The screen was from a broken Samsung 1920 x 1080 LCD monitor. The panel's touch control was extended and recessed into the side of the box, just in case. 

The only tricky piece was getting the sound to work off the raspberry pi. The output from the pi is a 4 ring VGSS 3.5 jack but getting a fair signal via hacking a 4 pole cable from the pi to my PAM8610 audio amp board proved a bit messy. So instead I hacked a 3 pole cable from the audio amp to the raspberry pi base which you can see here:

There are plenty of ground points, I chose PP6 for ground with PP25 and PP26 for the sound channels. A three amp 5.3V power pack was used for the pi and the brumby christmas tree LED pattern at the top of the box. That voltage is not quite within a modern USB spec but it worked OK with the pi 2. You can see here the direct solder attachment to pi jumper pins if you look closely enough:

I ripped apart some old speakers and took their main speakers and tweeters out, along with the crossover circuitry. A cheap PAM8610 amp cost $2.10 and this class D amp is supposed to be able to drive 2 x 10W but I have my doubts about that judging by the size of the heatsink on the chip though the chunky electrolytics and inductors on the crossovers may be helping there. It all seems to work without complaint.

Anyway, it may prove to be a fun project for your season break if you want to dig in. Though much of the build was driven by whatever was lying around, let me know if you'd like to see a more detailed build log with sources for parts, et cetera.


Thursday, 8 December 2016

IEX innovation killing innovation

IEX gets far too much attention as it stands, but here is another reluctant meandering.

IEX is a small, expensive dark pool that was improperly licensed as a public exchange by an SEC influenced by the fan boys and girls of Michael Lewis' false and improper "Flash Boys" narrative which was written to support his friends who had invested in Spread Networks and the InvestorSexChange.

Phew, now that I've got that off my chest, most of the problem is not IEX but Reg NMS. The big mistake made by the SEC was giving protected quote status to IEX's delayed quotes. To me, the other main errors in the approval of IEX were not rule breaks but improper facets within Reg NMS. IIROC, the Canadian regulator, has handled things better than the SEC by not giving protected quote status to speed-bumped markets there.

Now there are two main pieces of somewhat old news to cover here:
  1. IEX's filing for its new Primary Peg (PP) order type to join its Discretionary Peg (DPEG) order type in fading, and
  2. an older filing changing the calculation mechanism for IEX's crumbling quote indicator.
Another argument, that I feel is important to understand, is how IEX's innovation, particularly PP and its DPEG, actually prevents innovation.

Primary Peg

You can read the PP IEX submission to the SEC here.

Basically with PP, you sit on the NMS bid or ask, NBBO, unless IEX uses its crumbling quote indicator to look into the future 350 microseconds and decides that you might be at risk of being traded through, or adversely selected, so it moves you one tick to safety. When the crumbling quote indicator says its safe to go back, IEX will put your order back to the NBBO. It is an automatic fade based on IEX's formula and their 350 microsecond look into the future. Remember the order is non-displayed, unlike CHX's LTAD, and thus will not interfere with the SIP feed.

It's a good order type for an HFT market maker. It gives you some adverse selection protection and lets you sit on the NBBO to graft out a living from the spread. Unfortunately for the market maker, your order will be prioritised behind displayed orders, but you don't have to worry too much about that as most of the activity, as you can see in the following chart, is not lit.

(click to enlarge)
IEX has some cunning bullsh*t in their application as it talks about reaching up to the BBO when the market is stable rather than thinking of it as a non-displayed quote fade. Schmarketing. Fading is fading. Go on. Admit it.

Marketing doesn't really matter as the effect is not a lot different to the DPEG in terms of NMS interaction. Thus, I can't see this order type not being approved. The SEC has already fumbled the ball. It's no worse than what already exists at IEX. Do you also think that it remains hypocritical of the "Puzzle Masters" to introduce yet another complex order type despite the "Flash Boys" pledge to only have simple order types? If I was forced to trade on this exchange, I would certainly be using such a PP if their hideously expensive transaction costs do not rule out such an application.

Innovation killing innovation

That brings me to my main problem with the PP. It is a good bit of innovation that kills innovation.

Normally a trader or broker would build their own algorithmic way of avoiding adverse selection. This is the usual activity you see in a market with little micro-structural avalanches of cancellations as traders avoid being the dumb bunny being traded through at best. It might be something as simple as saying, if there is only 10 left on the bid, bale. It could be what I'm used to doing, which is applying a machine learnt algorithm to the security or contract to determine your adverse selection criteria.

The logistic regression formula IEX uses for all stocks cannot possibly be perfect because all stocks don't behave in the same way. One size does not fit all. So their innovation is flawed from the outset. Perhaps good enough for some market participants, but not for others. The IEX speed-bump prevents you innovating yourself as you can't look into the future as IEX does. You're frozen out. You are forced to use their innovation which kills your pathway for any innovation you might have in mind. This usurping of brokers and traders is not healthy. No innovation for you. Like it or lump it. This is what I mean by IEX's innovation killing innovation.

It is kind of ironic that the SEC has asked for innovation and it is getting innovation that kills further innovation. It is the wrong multiplier to harness. You should be seeking to harness the multiplier of innovation from the many brokers and traders. Don't impede widespread innovation.

Parasitic darkness

So be it. I expect this order type will likely act to further darken the trading at IEX. Public price discovery will be increasingly impeded.

At some stage, the SEC needs to consider how much dark and parasitic activity should be allowed at a public exchange. I would argue that zero would be the appropriate number. However, parasitic trading is not necessary bad, as I have pointed out many times. Index funds are likewise parasitic, yet helpful to many. Perhaps a limited number, such as ten or twenty five percent, would be an acceptable threshold. That said, my gut feel is that if three quarters of the flow was parasitic the markets may remain functioning OK. Perhaps even ninety percent. My gut feel is not something I'd like to rely on. I do believe the role of public price discovery is too important to subvert in this manner. Zero dark, not thirty, should be the benchmark from a public policy viewpoint.

If you want dark, go to the dark corner: the ATS corner. Why be public if you don't have public pricing? We have to remember the beneficial role public markets play. IEX is not fulfilling that role.

Crumbling quotes

Back on August 9, 2016 IEX also filed an update to their quote instability factor (QIF) process that was used for DPEG. That QIF process will also apply to the PP. Now I've gone through this calculation in its old guise previously and this change to the formula just adds two more variables and changes the timing. Instead of the quote instability being triggered for ten milliseconds, it was changed to two milliseconds. The two new variables, are:

  1. a Boolean indicator that equals 1 if the last two quotation updates have been quotations of protected markets moving away from the near side of the market on the same side of the market and at the same price; and,
  2. the number of these three (3) venues that moved away from the near side of the market on the same side of the market and at the same price in the prior one (1) millisecond: XNGS, EDGX, BATS. 
The quote stability threshold changed from 0.32 to 0.6.

It's a reasonable formula they have extracted from their logistic regression but I suspect most of us could come up with a better one in our sleep. The biggest problem with this approach is that it treats all trading instruments the same. We all know that big caps and small caps trade quite differently. There are many other reasons to differentiate adverse selection criteria beyond IEX's approach. Why not a random forest or deep learning parameter set for each instrument? Tens of thousands of pages of appendices for the numeric weights in SEC filing appendices would be a fun way to send a perverse message to the regulator on the wrongheadedness of this innovation killing innovation.

Anyway, let's spell out the newish formula:

It's interesting IEX picks on XNGS, EDGX, and BATS in their formula. Make of that what you will.

Now that BATS has been purchased, there seems to be a vacancy in the market for a real exchange that supports improving price discovery and efficiency. IEX hampers both price discovery and efficiency. It is time the SEC thought long and hard about this issue. The SEC needs to revise their methodology for approving public exchanges.

SIP games

I wrote previously about the SIP games that were on the table at IEX:
"IEX - the good, the bad, and the ugly",   Thursday, 16 June 2016.
Particularly in the comments of that piece. The SIP times are improving dramatically and you may be gamed if you don't plan to have multiple sites beyond the necessary IEX co-location. Yes co-location is required at IEX despite the rubbish you may have been told by IEX staff. SIP gaming is yet another wrinkle to keep in mind when you co-locate to trade at IEX.

Bigger fish

Let's not get too carried away though by all the hypocrisy from IEX. There are much bigger fish to fry. The equity markets work pretty well, despite the need for modification. It is much worse outside equity markets. Why are we still paying outrageous spreads in foreign currency when we do foreign transfers? Some markets still live in the dark ages. We should pause and be thankful that equities are at least a little enlightened.


CFTC vs DRW: judge leans against CFTC on closing

This is just a short follow up on a previous meandering: CFTC vs DRW: regulator's ego explodes

Judge Richard Joseph Sullivan
It looks like US District Court Judge Richard Sullivan is on the ball. His Honour has reportedly cast some significant doubt on aspects of the CFTC's argument. His Honour did admonish both sides in the process but interrupted the CFTC significantly in its closing:

"Judge Casts Doubt on CFTC’s Manipulation Case Against Trader Wilson", Alexander Osipovich, WSJ:
“There are multiple elements to market manipulation and it’s not clear to me that you’ve proven a central one, which is artificiality,” Judge Sullivan said in a Manhattan courtroom
But on Wednesday the judge’s toughest questions were aimed at the CFTC. He admonished the agency’s lawyers for focusing on what they described as “illegitimate” bids and sidestepping the issue of whether DRW had caused an artificial price.
“You keep using ‘illegitimacy’, which is a very fuzzy term, to somehow be the equivalent of artificiality,” Judge Sullivan said. Arguing that DRW’s bids created an artificial price because they were made with an illicit intent was “so circular as to be nonsensical,” he added.
"Judge assails regulator’s lawyers in DRW case", Gregory Meyer, FT:
A New York judge has raised piercing doubts about a US financial regulator’s reasoning as it pursues a high-stakes case against DRW, one of the world’s leading derivatives traders.
His battery of questions aimed at lawyers from the Commodity Futures Trading Commission suggested they may struggle to win their first market-manipulation trial since 2008.
US District Judge Richard Sullivan repeatedly interrupted CFTC lawyers as they made closing arguments, his tone caustic at times. As Daniel Ullman of the CFTC tried to explain why DRW’s bids broke the law, Judge Sullivan said: “That’s economics. I don’t think you folks believe in it much.” 
Later he told Mr Ullman his logic was “so circular as to be nonsensical”.
"CFTC faces tough questions as trial of Chicago firm, founder ends", Nate Raymond, Reuters:
But Sullivan repeatedly interrupted her, questioning why no one would take DRW up on its bids if it was offering a higher price in what was an illiquid market. That could mean, he said, that DRW's bids were actually too low to attract a counterparty.
"If that's the case, then it seems to me the entire theory of artificiality goes out the window," Sullivan said.
"DRW Judge Casts Doubt on CFTC Case Defense Calls ‘Absurd’", Christian Berthelsen, Bloomberg:
Sullivan repeatedly interrupted the government lawyers’ closing arguments, peppering them with skeptical questions.
Still, Sullivan questioned whether the CFTC had presented enough evidence to prove DRW’s strategy created artificial prices in the market. He said the logical inference from the lack of other bidders for the contract was that DRW’s bidding prices were too low, rather than unjustly high. 
He also noted a lack of testimony from witnesses that could have addressed unanswered questions in the case, and generally criticized the regulators’ grasp of economics and view of how financial markets work.

Monday, 5 December 2016

CFTC vs DRW: regulator's ego explodes

CFTC’s independent future should be questioned.

CTFC v DRW complaint [pdf]
(click image to enlarge first page)
The CFTC does some excellent work. Look here to see some of the many essential enforcement actions the CFTC undertakes. But then you get this complaint.

The exemplar of the currently unfolding case against DRW is not such a piece of excellent work.  Let’s meander through why I and others may think this by examining some of my somewhat limited understanding of the details - which is all that is required.

First though, let's address some of the current press coverage. You can read coverage just about anywhere, including the WSJ, WSJ again, FT, Reuters, Bloomberg, Bloomberg again, Chicago Tribune, et cetera. The case has profile.

The handling of such cases by the press, the financial press in particular, needs to be examined. Read those articles and you may think DRW is the devil incarnate. Not the best reporting. It is the duty of the press to report properly on obvious regulatory bullying and malfeasance. The fourth estate has an important role in keeping the government and associated regulators in check. The vast majority of the press has dropped the ball on this one with their recent coverage.

DRW Philanthropy: DRW College Prep
I feel the press has reported with unbecoming glee on the trials and tribulations of Don Wilson in these events. Although DRW is a not quite an HFT in my mind, more of a large trader with some occasional HFT characteristics, it seems the press derives some schadenfreude from sticking the knife into the firm despite its well regarded integrity and charitable works. The press has a tendency to sidle up to regulators and buy their stories without a proper critical eye. This may be rational as regulators run many cases, or stories, and if this is your beat, you don't want to be frozen out. Perhaps, thus, the bias, or prejudice, is natural, as harmful as it is. The press needs to do better.

Exceptions to this, in the early daze of the drama, came from the courts of Matt Levine:
and, John Lothian:
Both of these reference an excellent synopsis of the matter from Craig Pirrong, Professor of Finance and Energy Markets, University of Huston:
  • the Streetwise Professor, "Enjoin This!", September 17, 2013.
Bradley Hope also wrote a decent piece in the WSJ:
Back in March Matthew Leising wrote a more balanced piece worth reading at Bloomberg,
Not so much proper reporting recently.

Let's look at a simple version of events:
  1. Exchange introduces new contract F, says it is just like S;
  2. People start trading it believing F is just like S;
  3. F and S have quite different cash-flows. Big Trader notices F under-pricing and buys lots of F;
  4. Big Trader publishes paper explaining how F and S are different;
  5. Big Trader bids to buy at higher prices for F in market, no takers;
  6. Sellers to Big Trader complain; and,
  7. CFTC sues Big Trader.
Things were a bit more roundabout in the beginning. In the Matt Levine articles referenced above, you can see that the CFTC was threatening a suit. DRW took action to prevent it in Chicago. The CFTC went around this by filing in the Southern District of New York. DRW tries to get it thrown out. DRW fails on dismissal but succeeds in getting a proper definition of a manipulative trade. That clarification was that the CFTC has to show that a trader intended to create an "artificial" price in order to prove attempted market manipulation. Quite a bit of a skirmishing.

Importantly, Bradley Hope reported in his WSJ piece,
"A key piece of evidence the firm said can prove its trading was appropriate is a September 2011 review by the National Futures Association of the timing of DRW’s orders over a period that included the same days the CFTC alleged DRW manipulated the market. The review concluded that the manner in which DRW traded reduced the likelihood that the firm manipulated prices. The National Futures Association is a self-regulatory agency that polices the futures industry. The association declined to comment. 
DRW’s lawyers received the document from the CFTC as part of a discovery process late last year in anticipation of the trial"
So even a fellow regulator said, nothing to see here, move along.

As the Streetwise Professor says,
"CFTC apparently believes that the swap futures and the swaps are equivalent, and hence DRW should have been entering quotes equal to swap yields.  By entering quotes that differed from swap rates, DRW was distorting the settlement price, in the CFTC’s mind anyways. 
Put prosaically, in a way that Gary Gensler (the lover of apple analogies) can understand, CFTC is alleging that apples and oranges are the same, and that if you bid or offer apples at a price different than the market price for oranges, you are manipulating. 
The reality, of course, is that apples and oranges are different, and that it would be stupid, and perhaps manipulative, to quote apples at the market price for oranges.
The CFTC is completely confused."
It really is trading 101. Different products. Different cash-flows. Different risks. You should probably expect different pricing, no? Print out the cash-flows on a timeline for the two products; hold them up to the light; and, surprise, they won't perfectly overlap. They're not identical.

Think about one of the simplest of trades: a stock index arb to the futures equivalent. There is a cost of carry to the basket of physical stocks, a question of dividends, and also the margining risk of the daily funding calls on the futures. When you look at the different timings of cash-flows you have to consider your yield curve to get your interest rate calculation right. That is, even such a simple trade, without convexity bias, has quirks you have to carefully calibrate.

The "other" Donald (source MarketsWiki)
(Click here for video:
 Reminiscences (and Prognostications)
DRW simply did their homework. They even published their homework and circulated it. The bids they put into the market were at a more correct price, seeking a convergence to the correct price. This is how markets are meant to work.

The dumb bunnies on the other side of the trade, MF Global, may they rest in peace, and Jefferies, didn't do their homework. They believed the exchange accurately represented the product as being the same as OTC product it was seeking to duplicate. Lazy or dumb?

As recorded in phone call transcripts, when Laurie Ferber, MF Global's general counsel complained, "You guys have been putting up prices at 2:45 the last several days", Don Wilson answered, "We'd be happy to trade on any of those prices. All day long."

Back to the case, the CFTC legal eagle, Aitan Goelman, the same guy that ran against the Oklahoma bomber as a rookie team member - fact is always stranger than fiction - allowed the use of incendiary language, such as "Banging the close", "distorted the market price for their personal benefit", "There is no invisible hand here...It is DRW's hand, pointing to the prices it wanted and setting them up illegally", "brazenly" engaging in market manipulation. Often colourful language in court points to a weak case, as emotion becomes the reliant vehicle, rather than fact. It may work as US District Judge Richard Sullivan reportedly thinks the worst of the trading community. A good prosecutor would understand this and thus just give the judge the line of reasoning he needs to write up if His Honour so honourably chooses. Court facts and real world facts sadly do not always align. Judges are human too.

Can you ever bid a higher price and be the best bid if you think the market is under priced? How would prices ever move if it was improper to put your bid where your mouth is? 

The CFTC colourfully refers to DRW inflating bids more than 1,000 times over 118 days with DRW placing bids in the 15 minute settlement window used by Nasdaq's OMX Futures Exchange. To me, the bids were proper and actionable and reasonably priced. In a world where transactions are competed down to the last nanosecond, hundreds of billions of nanoseconds, minutes even, of availability sat in the market bleating for a trade. If you didn't like the price, sell to DRW. Where were you?

You have to be a bit old to remember the NatWest saga from around 1997 (number 41 in this trading loss list) where an element within NatWest smugly thought they had a better way of pricing options. NatWest went after the "suckers" in the market with their new fangled formula. After a tidy $200M loss, they found out that their clever trick was not so clever. The sun does not rise in the west.

If the prices were so fake, why did DRW try to do another billion dollars with MF Global that fell apart due to the unavailability of staff due to a blizzard? Really? Is this the best the CFTC can do?

An important question that needs to be asked and answered is, Why has the CFTC gone so hard on DRW? Especially when the CTFC is so obviously wrong. All I can think is that there is an ego somewhere in the upper echelons of the regulator's organisation that can't be satiated. The lack of logic must point to such a particularly human reason. Perhaps that is the real story. These actions certainly detract from the normally good work of the CFTC. Such ego led, blind bravado is not something a regulator should be known for.

There are many reasons why the CFTC should not exist as an independent entity, simultaneous FX prosecutions, the uncoordination of the SEC's fractured and failing CAT, etc. A long time after delta one desks happened, it is surely time the SEC and CFTC merged and took a holistic view on the regulation of markets. The CFTC certainly needs a better understanding of derivative pricing.

The press needs to look underneath the covers of such cases. Ego driven drivel from regulators shouldn't just be reported as fact. The fourth estate's recent reporting, especially compared to earlier reporting, shows it is failing in its investigative responsibilities which is no surprise in a post-truth era. Truthiness and integrity should matter more.

The bottom line? Not only are there too many cracks in the regulatory framework, there are also too many crackpots at the CFTC. It's time for the CFTC to show some leadership and apologise.

Happy trading,