Derman again

June 26, 2008

I’ve finished Derman‘s book now, and rate it very highly. Anyone going into software development for rates trading should read it. I’ve mentioned before how it’s a great combination of personal narrative and anecdotage. The final chapters top this off with some great pop science writing on financial engineering innovations since Black-Scholes. Usually the authors of accessible pop science texts are not the same people as those who made the original breakthroughs. Derman is great at explaining the work of Black, Scholes and Merton. By way of explaining the Black-Derman-Toy interest rate model he gives us an accessible explanation of curve bootstrapping. His coverage of the puzzle of the volatility smile and the use of binomial trees in modelling it is excellent too.

Advertisements

Marc asked for hardware accelerated messaging ideas. Here’s one: how about using SCRAMNet to eliminate IP networking and achieve sub microsecond latency ?  You’d need all of your exchange connectivity, pricing and order management processes on boxes in the same machine room linked by a SCRAM fibre loop. But it would go mighty quick. SCRAM pricing is surprisingly reasonable too…

PyEval_AcquireLock( )

June 20, 2008

The Python docs explain that PyEval_AcquireLock( ) shouldn’t be called more than once by the same thread: “if this thread already has the lock, a deadlock ensues”. I ran into this recently while coding with our C++/Python application framework. At work I’m fortunate enough to use an excellent proprietary C++ application framework specifically designed for building electronic trading systems.  It has pub/sub messaging, RPC, monitoring, failover, persistence, caching, versioning and logging all built in. While C++ is the native language of the framework, Java, C# and Python are also supported.

The Python support is implemented in CPython using the Python C API. C++ framework callbacks are dispatched into Python. Before and after dispatch the GIL was  acquired with PyEval_AcquireLock and released with PyEval_ReleaseLock. All well and good until a Python callback invokes a C++ function which in turn calls another Python function, causing a second call to PyEval_AcquireLock which then deadlocks. Not good if your process is handling an RFQ !

The solution was to use PyGILState_Ensure and PyGILState_Release, as introduced in Python 2.2, instead.

Nearing the end of Derman’s book, and I can recommend it wholeheartedly to any developer working in the rates business. It’s written in an easy style with a well balanced mix of personal and family narrative, accessible technical content and anecdote. Derman covers his physics career – we encounter Richard Feynmann and Douglas Hofstadter (Godel, Escher, Bach) while enjoying a survey of particle physics in the 60s and 70s. Then Derman moves on to Bell Labs where he learns to code and works with Kernighan, Ritchie, Plauger and Stroustrup. Then on to Wall St, Goldmans, Salomon Bros, Fischer Black, John Meriwether, Gutfreund and many of the usual suspects familiar from Liars Poker, FIASCO etc. It’s all leavened with insight on theoretical and experimental work in physics, coding and financial modelling.

Life as a quant

June 17, 2008

Since I’m reading Derman‘s My Life as a Quant, and since desk moves are banned at my bank for cost reasons, I got a laugh out of this cartoon

Quote conventions

June 12, 2008

Good post from Accrued on the quote conventions for USD bond prices. Accrued notes Bloomberg’s importance in this area, so I’ll add some further info based on quoting conventions for govt bonds on Bloomberg single dealer pages…

  • Bid and ask prices: all dealers quote two prices, the price they’ll buy at – the bid – and the price they’ll sell at, the ask or offer. The spread is the difference between bid and ask. Bloomberg has a feature called ALLQ that will let a user see a stack of dealer quotes ranked by tightness of spread. Some have argued that other factors ought to influence the ALLQ ranking, for instance dealer execution rates. But that’s a question for another day.
  • Clean prices: dealers quote clean prices – that is prices that exclude the interest accrued between coupon payments. Trades are settled as dirty prices, so the seller is compensated for the portion of the next coupon payment he’ll miss.
  • Bid and ask sizes: quoted in millions of the relevant currency. So if I buy 10,000,000 of the on the run Treasury at 99.35, the clean cash amount I pay is 9,935,000, plus accrued.
  • Yield quoted: most euro govies are price quoted, but some are yield quoted. For instance all Euro bills except Italy, and all Swedish.
  • ASM: on Bloomberg single dealer pages dealers often display asset swap margins. One ASM measure is 6M yield/yield – the spread between the bond yield and the matching point on the 6M swap curve.
  • BEI: for inflation linked bond break even inflation may also be on the quote. BEI is the inflation level that will cause a linker to pay the same coupon as a straight bond.

Seth Klarman

June 11, 2008

Klarman‘s comments on investment strategies are worth reading. He covers the credit crunch, the abuse of leverage, academic economists ignoring empirical evidence, and risk/return. He advocates the Buffet/Graham value investing philosophy.

I’m also reading and greatly enjoying Emanuel Derman‘s My Life as a Quant at the moment. I’ll comment more on this later, but must point out how Derman’s comments on academic economists chime with Klarmans. While Klarman notes that academic economists often ignore evidence, Derman points out that the maths of economics is much more formal than the maths of physics textbooks – “much of it reads like Euclid or set theory, replete with axioms, theorems, and lemma. You would think that all this formality would produce precision. and yet, compared with physics, economics has so little explanatory or predictive power.”

The point being that physicists don’t need to cloak their theories with the spurious authority of excessive formalism…

fintag gauges the sages

June 10, 2008

One of my daily reads is fintag, so I was intrigued to discover his sagegauge project. I’ve had a lot of conversations lately about applying web 2.0 ideas to trading. Will be interesting to see how this one plays out.