## 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. --Matt. ## 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. --Matt. ### 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. --Matt. ## 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. Seriously. 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 tidy200M 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.