Sunday, November 24, 2013

The Physics of Wall Street

The Physics of Wall Street - James Owen Weatherall

The book describes the evolution of quantitative trading through a history of the major principles involved in building the financial models, the researchers who proposed them, their impact and the reasons behind their failures. Each chapter deals with a single principle behind a model. Successive chapters follow the evolution of these principles, starting with the random walk model, progressing through delta/dynamic hedging, chaos theory, black box modelling and ending with extreme event detection through log periodic variations. A good read for someone who is interested in understanding the basics of quantitative finance. Recommend.


 Chapter 1: Louis Bachelier, "A theory of speculation"

  • Bachelier's dissertation ("A theory of speculation") proposed that random walks could be used to model stock prices.
  • Valid if the trade is a fair bet. Intuitively a trade means that buyer believes information is positive, seller believes information is negative, therefore the trade price is the price at probability of going up == probability of going down. Equivalent logic to the Efficient Market Hypothesis (Fama, Chicago School)
  • If stock prices follow a random walk, probability of distance from starting point is normal, variance increases with time. Distribution of future price at a time is normal, mean is at the starting price, variance depends on  the time. As time increases, variance increases, normal curve becomes flatter
  • Bachelier extended the model to options/derivatives. Fair price of an option is price that would make it a fair bet. Used random walk to calculate probability of a future price, and derived a fair price estimate.
  • Basis for model is somewhat flawed, e.g if efficient market hypothesis was true, bubbles could not happen. Also, model was not fully validated with real data.

Chapter 2: Maury Osborne, "Brownian motion in the stock market".

  • If Bacheliers' hypothesis were right, stock prices would be normally distributed, which was not supported by real data. Osborne showed that returns were normally distributed, so stock prices follow a log normal distribution. Rate of returns follow a random walk (prices change by a fixed %age, not by a fixed amount) i.e. prices are log normally distributed
  • Has an intuitive basis: Investors do not care about absolute price, they care about rate of return. Also, from the Weber-Fechner psychological principle: logarithms model human response to stimuli
  • Hypothesis that markets are random seems to indicate that in the long term, investments will yield no gain, However, estimating future values of options can be used to develop instruments that yield a profit.
  • Later Osborne, rejected the memoryless efficient market hypothesis in favour of the memory based models:  after prices go up they are likely to go down and vice versa. Fundamental change in assumption from random walk

Chapter 3: Benoit Mandelbrot,  "The fractal geometry of nature"

  • Mandelbroit's work showed that real market returns are governed by Levy stable distributions with 1 < alpha <2 i.e long tailed distributions
    Extreme events occur much more often than predicted. Makes random walk based models obsolete.
  • Mandelbrots theories emerged around the same time that random walks were gaining traction in financial modeling, but were unable to gain much traction because of complexity/tractability.  Random walk gives good results "most" of the time. Long tailed models are not tractable.
  • Notes on  long tailed distributions
  • Levy-stable distribution: Alpha characterizes the tail.  Normal: 2, Cauchy 1, (<1 => distribution has no average). Self similar features have no average
  • Zipf's law: Frequency of occurrence of events related to ranking.
  • Pareto principle: 80:20 rule
  • Cauchy distribution: Long tailed distributions

 Chapter 4: Edward Thorp, "Delta hedging"

  • Bachelier, Osborne, Mandelbrot did not apply their theories to real investments. Ed Thorp was the first to apply their theories to the market
  • Card counting strategy to achieve a favourable strategy for 21. If you have a strategy (edge) that is probabilistically profitable in the long run,  how can you estimate betting amount to avoid "Gamblers ruin". Thorp used Kelly'c criteria (information theory) Probability of likelihood of correctness when a message is distorted by noise. Calculated the optimal amount to gamble when betting in a favoured bet. Kelly criteria specifies fraction to bet given the advantage and payout. Shows that rate of return equals information rate
  •  Applied the strategy to options (warrants): 
    • Used Osborne/Bachelier equations to estimate how much a warrant should be worth. Thorp found most options were overpriced using pricing theory. This provided an edge in the warrant market (not the stock market). 
    • Used short selling of options to exploit the edge. Short selling:allows investors to bet against a stock, without owning it.
    • Thorp hedged short sale of warrants against underlying stock. - The first hedge fund.  Underlying stock protect against increase in option value. Protects against all but large changes in stock value.  Controls risk, but does not eliminate it.
    • Procedure: Fair price of option is price at which it is a fair bet.Assume stock prices are log normal, calculate option price, calculate  proportion of stocks and options to execute delta hedging
  • Even though hedging guarantees profit, long and short term profits are taxed differently, reducing profits 

Chapter 5: Fischer Black, "Black-Scholes-Merton options pricing model",  "Dynamic hedging"

  • CAPM: Capital Aset Pricing Model: Proposed model that assigned a price to risk. Linked risk and return via a cost benefit analysis of risk premiums
  • Dynamic hedging: It is always possible to construct a portfolio consisting of an asset and its option that is always risk free 
  • Procedure:  
    • Assume there exists a mix of stock/options to construct a risk free portfolio
    • Use CAPM to calculate risk free rate
    • Calculate price of options in order  to realize the risk free return
  • Allowed banks to construct options to sell them. Banks could sell options, and reduce risk, by buying corresponding asset
  • 1987 crash:Portfolio insurance based hedge fund. O'connor used a moidified BlackScholes model that accounted for long tail events- was not impacted by the 1987 crash

Chapter 6:  The Prediction Company, Lorenz, "Chaos theory"

  • Lorenz developed Chaos theory -  Sensitive dependence of state on initial conditions
  • The Prediction Company was started by a group of physicists with expertise in chaos theory, and prediction algorithms. Their objective was to find the signal in the noise, applying understanding of chaos, genetic algorithms Developed statistical arbitrage on correlated assets e.g. Pairs trading, algorithms around voting for trades
  • Most significant contribution was Black box modelling - building balck boxes that predicted based on accuracy on past real data (training sets, etc.)
  • One premise was that markets are inherently unpredictable, obey efficient market hypothesis, which implies they should be impossible to predict. However if anamolies (e.g a stock price is away from its normal, expected value) are detected they can be exploited before market returns to equilibrium. Need computation power and speed to detect, take action

Chapter 7: Didier Sornette: "Self organisation"

  • Ruptures in physical systems result from a self organization of components. Self organisation:uncorrelated entities begin to join together in correlated behaviour
    Log periodic patterns predict ruptures. Used to predict breaking of water tanks, earthquakes. 
  • Specific crashes (Dragon Kings) may be caused by state of the market rather than a particular event. More extreme than long tailed events, may be predictable through log periodic observations. Self organisation is difficult to predict, has fractal properties, but log periodic behaviour in properties may indicate system is in 1a dragon king state
  • Predicted the 1997 Asian currency crash, 2000 dotcom crash

 Chapter 8: New Manhattan Project

  • Gauge theory and its application in calculating a new CPI


  • Renaissance Technologies: 
    • Medallion Hedge Fund, approx 2500% return  (compared to 1700% Soros)
    • 40% over lifetime, compared to 20% (Berkshire Hathaway)
    • 80% return in 2008 during the crisis
    • One asset is usually a derivative
  •  Derivative:  Contract based on some kind of security: stock, bond, commodity
    • Objective: Reduce risk (historically with commodity futures), now with stock futures
  • Hedge fund: Counterbalanced protofclio comprising asset and its derivate. Calculate relationship between derivative prices and underlying asset price, quantify risk of a fund based on derivatives, keep portfolio in balance.
  • 1971: Chicago Securities Board allowed the first options market
  • Breton Woods 1944 agreement. Fixed exchange rate, all currently tied to dollar, dollar tied to gold. Abandoned by Nixon on recommendation from Milton Friedman (Chicago school). Currency futures became widely traded after this.
  • 1987 crash: Portofolio insurance: Hedge: Buying a stock, short sell futures. Volatility smile: Abnormality in options pricing graphs becuase of short comings of the Black Scholes model
  • 2007 crash: Banks needed an asset hat was like a treasury bond (low risk), that they could provide as collateral on deposits from corporations/other banks (shadow banking system). They used consumer debt (mortgage, credit card, student loans) - Collateral Debt Obligations (CDO). Shadow banking system collapsed when underlying assets became toxic. Mathematical models made a flawed assumption of the independence of failure of individual assets (mortgages). Failure was followed by run on the banks.

Tuesday, March 12, 2013

What to listen for in music

What to listen for in music: Aaron Copland, 1939

The book summarizes the basics needed to understand and appreciate music at a reasonably deep level. It focuses mostly on western classical music, with some mention of jazz. It covers the process of listening and composing, the 4 major elements (rhythm, melody, harmony, tone color) and musical structure (4 major forms in western classical music). Was written in the 30s, so the focus and writing style reflect that.

Well worth the read for someone (like me) with no formal music training.


Most people have the prerequisites to developing an appreciation of music, though they may not be aware of it.
  • Short sequence recognition:  Ability to recognise a melody i.e. a short progression of notes 
  • Long  recognition: Ability to relate what happens in a section of music to what happened before and what happens after

    How we listen to music

    There are different ways in which one may attempt to listen to music:
    • Sensuous plane:Listening without thinking, a diversion.
    • Expressive plane: The feeling that the composer is striving to express, or the feeling that the listener feels. The meaning of the music. A controversial topic because of the difficulty in identifying what a musical work expresses.
    • Musical plane: The manipulation of the notes: sequences, combinations, speeds, patterns. This book deals with this plane

    The creative process 

    Music works are composed using different methods. Types of composers include:
    • Spontaneously inspired: Composers begin with a composition that is close to completion. E.g Schubert
    • Constructive: Continuously refinement of themes. E.g. Beethoven, as deduced from his notes.
    • Traditionalist: Starts with a pattern, rather than a theme. The pattern may be, e.g. the music style of the age/place. E.g. Bach
    • Pioneer: Opposite of traditionalist. Is experimental, adds new harmonies, new principles

    Elements of music

    4 essential elements:
    • Rhythm
    • Melody
    • Harmonic
    • Tone color


    Measured music system: 

    • Rhythmic units are divided into measures separated by bar lines
    • The bar line generally has 4 instants.
    • Number of notes between the bars is used to define the system: E.g. 2/4, 3/4, 5/4, 6/4
    • Stress/Accent: Some notes are stressed/accented (down beat)
    • Meter vs. Rhythm: The stressing of note defines the meter


    • Measured music system started around 1100 AD. Prior to that most music had rhythm that was based on words (Gregorian chants).
    • End of nineteenth century was when newer features started:
      • Combination meters (2/4 + 3/4) were used e.g. Tchaikovsky
      • Grouping of notes within a bars (2-3-2/8)
      • outside the bar
        •  Polyrhythms Two simultaneous different rhythms, e..g 2/4 coincides with 3/4
        •  Sometimes with non coinciding first beats (length of musical unit is different?). E.g one rhythm is 2/4, which overlaps with 3/4
        • Frequently used in Chinese, Hindustani, African music, madrigals (rhythms from words)


    • Progression of notes in time, has a skeletal frame
    • Exists within a scale system
      • Scale: Set of notes between a tone and its octave
      • Octave: 12 equal semitones,
      • CC#DD#EFF#GG#AA#BC
    • Chromatic scale 
      • 12 semitones, i.e. all notes
      • CC#DD#EFF#GG#AA#BC
    • Diatonic scale
      • 7 semitones from the 12: 2 whole tones, half tone, 3 whole tones, half tone
      • 12 possibilities,starting with each semitone
      • Starting tone is called the key or tonic
      • Key may be major or minor mode (?): 12 scales in major mode, 12 in minor mode
      • CDEFGABC
    • Four scale systems:
      • Oriental, Greek, Eccelesiatical, Modern
    • Scales center around the tonic, dominant order is 5th, 4th, 7th degree is the leading tone (leads to tonic)


    Started in the ninth century
    • Organum: Same melody repeated at a 4th or 5th interval above or below
      • Interval: Distance between two notes
    • Descant: Two independent melodies moving in opposite directions
    • Faux bourdon: Intervals of 3rd and 6th
    • All chords are built from the tonic, upwards in a series of intervals of a 3rd
    • Triad chord: 1-3-5, 7th chord:  1-3-5-7, 9th (1-3-5-7-9), 11th (1-3-5-7-9-11), 13th (1-3-5-7-9-11-13)
    • Return to the tonic is a principle in all early harmonic work
    • More recent developments:
      • Atonality: Feeling of central tone lost (Wagner), Abandoning tonality (Schoenberg, Debussy). Opens questions of consonance, dissonance
      • Polytonality: Use of multiple tones (right hand plays in one key, left hand in the other)
      • Most work today is diatonic and tonal

     Tone color (or timbre)

    • Quality of sound from the medium e.g. musical instrument, or voice
    • There is a characteristic way of writing for each instrument
    • Single tone colors: Sections of an orchestra
      • Strings: Violin. viola, cello, bass
      • Woodwind: Flute, oboe, clarinet, basoon
      • Brass: Horn, Trumpet, Trombone, Tuba
      • Percussion: Drums
    • Mixed tone colors:
      • Combination of single tone instruments
      • Sting quartet: 2 violins, viola, cello
      • Melodic line passes from one section to another in an orchestra
    • Jazz: Some instruments provide rhythm (piano, bass, percussion), other harmonic texture, one solo instrument plays the melody

    Music Texture

    • Monophonic: Single melodic line, No harmony. E.g Chinese, Hindustani, Gregorian chants
    • Homophonic: Principal melodic line + Chordal accompaniment
      • Contrapuntal view: Two separate melodies progressing in time
    • Polyphonic: Separate and independent voices in the chordal progressions
      • 2-3 polyphonic voices can be perceived independently
      • E.g. Choral prelude (Bach), Jesu

    Music structure

    • Structural background of a lengthy piece of music. Various structures (sonata, fugue) have evolved over years.
    • Sections have a hierarchy. 
      • Large sections denoted by upper cases (A-B-C etc) called movements or sections
      • Smaller sections denoted by lower case (a-b-c..). Analogous to sections and chapters in a book. The classification is made based on how repetition happens

    Larger sections:
    • Exact repetition
    • Sectional (Symmetrical ) repetition: 2, 3 part, rondo ,free sectional
    • Variation: Basso ostinato, passacaglia, chacome, theme
    • Fugal: Fugue, Concerto grosso, Chorale prelude, Motets & madrigals
    • Development: Sonata
    • Free
    Smaller sections:
    • Exact: a-a-a-a
    • Minor alterations: a-a'-a''-a'''
    • Repetition after digression: a-b-a, a-b-a'
    • Non repetition:a-b-c-d

    Fundamental forms I: Sectional form

    Work is divided into distinct sections
    • 2 part form: A-B-A-B. E.g. Scarlatti's sonata, No 413 (Dminor), 104 ( C major), 338 (G minor)
    • 3 part form: A-B-A, B is sometime called the trio, A is the minuet. Nocturne, ballad, elegy, waltz, intermezzo, are likely to be 3 part forms E.g. Minuets of Haydn (String quartet, Op 17, No 5) and Mozart. Beethoven's Scherzo (Piano Sonata Op 27 No 2)
    • Rondo: A-B-A-C-A-D-A-.... i.e. sections separated by return to A. E.g. Haydn's Piano Sonata No 7 in D Major
    • Free sectional form: Any arrangement, e.g. A-B-B, A-B-C-A Chopin's Prelude in C Minor, No 20

    Fundamental forms II: Variation form

    Piece is composed as a set of variations on a theme:
    • Basso ostinato: Short phrase repeated over and over in the bass section, while upper parts proceed, E.g. Soldier's violin form Stravinsky's The Story of a Soldier
    • Passacaglia: Repeated bass part, but the bass part is a melodic phrase, not a figure, with some variation in each section, the work starts with unaccompanied bass theme. E.g. Bach's organ Passacaglia in C minor
    • Chaccone: Very similar to Passacaglia, no starting unaccompanied bass theme, so sounds like the first variation of a Passcaglia. E.g. last movement of Brahm;s Fourth symphony
    • Theme and variations: Variation of a simple, direct theme. Theme is usually a 2 or 3 part form. Five types of variation: Harmonic, Melodic, Rhythmic, Contrapuntal (Combination). E.g. Mozart's A major Piano Sonata: Theme and six variations. Variation 1 s a florid melodic variation, Variation 4 is a skeletonizing of the harmony, Variation 3 is major key to minor key harmony change

    Fundamental forms III: Fugal form

    • Polyphonic/Contrapuntal in texture: Separate strands of melody concurrently. Needs repeated listening to be able to acquire the skill to differentiate the strands. Types of contrapuntal devices:
      • Imitation: Voices follow a leader, may enter at a different note. Only one melody, but spaced in time.
      • Canon: Imitation from beginning to end of piece
      • Inversion: Melody inverted, one voice follows the melody in the opposite direction. E.g. when the original moves one octave forward, the inverted one, moves an octave downward
      • Augmentation: Double time value of notes, slowing it down
      • Diminution: Halves the time values of notes
      • Cancrizans: Melody read backward
      • Inverted cancrizans: Melody backward, then inverted
    • Types:
      • Fugue proper: 3-4 voices
        • First voice enters, Second voice enters, First voice adds a counter melody,, then starts a free voice,
        • Exposition, Subject, Subject, ...Stretto, Cadence
          • E.g. Bach, Well Tempered Clavichord
      • Concerto Grosso:
        • Two groups of instruments: Large (Tutti) and smaller (Concertino) E.g. Bach's Brandenberg Concerti (6 each having a different concertino)
      • Chorale prelude: Originated in choral works in Churches. Melody is kept intact, harmonies are made complexer. Bach's Orgelbuchlein
      • Motets/madrigals: Choral forms, Vocal fugal form. Motet is based on scared words, madrigal on secular works

    Fundamental forms IV: Sonata form

    • 3 or 4 movements (fast-slow-fast, fast-slow, moderately fast, very fast)
      • Created by Karl Bach (JS Bach's son) (Prior to Bach, a sonata was a instrumental work, contrasting with the vocal cantata)
      • 1st movement: Sonata Allegro:
        • 3 parts (ABA):
        • Exposition (abc): First theme is in tonic, dramatic, second theme is feminine, in dominant, closing them in in dominant
        • Development: Free section, combines material in the exposition, new and foreign keys
        • Recapitulation: Repeats exposition but in dominant key
      • 2nd movement: Slow movement, may be a slow Rondo
      • 3rd movement: Minuet or scherzo, A-B-A, three part form
      • 4th movement: Extended rondo or in sonata allegro
      • Sometimes preceded by introduction and followed by a coda. E.g. Beethoven's Waldstein Sonata
    • Symphony: Sonata for orchestra: E.g. Beethoven's 9 symphonies
    • String quartet: Sonata for 4 strings
    • Concerto: Sonata for solo instrument + Symphony
    • Overtures: First movements of a sonata

    Fundamental forms IV: Free forms

     Does not belong to above structures
    • E.g. Preludes (for Piano). E.g. Bach's prelude, fugue
      • Clear progression of chordal harmonies from beginning to end without repetition of any themes. E.g Bach's B minor Prelude in Well Tempered Clavichord
    • E.g. Symphonic poems: Program music (as opposed to absolute music)