Feedback Loops: HFT, Black-Scholes, and Cicadas
In response to a series of articles I wrote earlier this year on high frequency trading, a longtime visitor to the site decided to put together some extremely fascinating research relating current market phenomena to his 40+ years of work as an engineer with retail, commercial, and military applications. In the following pages, he covers, among many others, the Black-Scholes model, feedback loops, HFT, resonance, and, yes, cicadas.
Feedback Loops: What do these two pictures have in common?
by Kent Johnson
The Quants. I live on the periphery of a banker rich zip code neighborhood. During the past decade I periodically ran into banking professionals who had degrees/backgrounds in mathematics and physics, usually with a Masters or PhD. No engineers!!! I thought this strange as to how such scientific talents were being used in the banking industry. Having an engineering degree myself and sharing many of the same math courses in college as they, I tried to engage in "shop talk” to no avail. I thought this was also strange, even when one was my neighbor. Was this a proprietary field or was this a miscommunication between scientists?
Thanks to Financial Sense, I learned some time ago that this strange specie of bird is called a "quant". Assuming miscommunication on a technical level I will define what the math basis is in engineering and how it relates, as I believe, to the financial world of quants.
Feedback loops in the real world use control strategies based upon mathematical algorithms derived by time based differential equations (integrals and derivatives). To avoid confusion, note the dual use of the word "derivative" in the mathematical sense, and as a financial product "V" discussed as follows in the Black-Scholes (B-S) equation.
The system (a machine, fluid process, or, in finance, the exchanges, institutions and money flows) is controlled or adjusted in "real time" by an embedded mathematical algorithm on application specific computer or instrumentation hardware. The computer hardware takes in real world parameters and variables (temperature, pressure, speed, stock prices, etc.) associated with the process system, and then outputs a signal to either model, adjust or control the system. The output of the algorithm is used to signal the mechanism that physically controls the process of the system. This mechanism can be a valve, a switch, or even a stock buy/sell order.
Tasks that used to be done manually by a person are now done by computers with embedded algorithms, automatically, at higher execution speeds and with more precision to optimize a certain goal, i.e. quality, efficiency, profitability, etc.
The benefits have been enormous. However in the evolutionary process of this technology (over a 100 years in industrial applications and relatively new in finance) unintended problems were discovered (some too late by accident and death), and corrected. As new applications appear or old ones grow in size or scale, old problems start to appear and again must be corrected. Some are minor and can be corrected as they appear. Others, in the catastrophic realm, must be anticipated, identified, and corrected before disaster strikes. Previous experience and lessons learned with feedback loops are appropriate warnings not to be ignored in the financial world.
The following are some real world experiences associated with feedback loops in retail, commercial and military over 40 years professionally. My engineering work did not consist of working directly with differential equations; nor do I have much more financial knowledge other than that of a small retail investor. I can easily understand why many in the financial world do not know what a differential equation is, or have a basic understanding of what a PID (proportional-integral-derivative) controller is beyond their home thermostat or the cruise control of their car, but use them in ways that could bring down whole economies.
Hopefully my experiences will help bridge the intellectual technical gap between mathematicians, bankers, economists, and engineers who may not have the good fortune of the full range of experience.
Industrial PID Single Loop Feedback Controllers (Chemical Process, Machines, Electric Motors)
This is a simple and very widely used device to control a single process variable like temperature, pressure, flow, position, speed, etc. The control algorithm is a simple differential equation. An operator dials in a set point, the device does the rest.
Users have access to three tuning parameters: Proportional, Integral, Derivative—hence, the acronym PID. These adjustments tune the device and keep the process stable through disturbances (step changes in set point or disturbances from the process). Depending upon the nature of the system there are a wide range of instabilities to contend with. Examples: over shoot/undershoot of the desired set point, external disturbances, step changes/surges, wild oscillations, windup, resonance, and many others. With the evolution of industrial controls field disturbances like these are well known and accounted for with corrective algorithms and techniques unique to the process or system under control.
Keep in mind, incorrect, incompetent, misapplication or adjustment of just the PID parameters can destroy the machine or cause a process to blow up, even cause loss of life. Such devices may be as simple as the wall thermostat in your home or a more sophisticated version as cruise control in your automobile. The process under control responds and reaches the desired setting in minutes (house HVAC system) or seconds (automobile). But most people have no concept of these devices which are common in plants and factories all over the world where manufacturing process control occurs in milliseconds.
More Details: The equation, PID algorithm, for process control
Example: the signal u(t), to speed up or slow down a car on cruise control, is a function of the difference between actual speed, and desired/set point speed aka "error" variable "e". Generally, it is user accessible to three "PID tuning parameters": Kp, Ki, and Kd. Kp is the primary sensitivity/stability "gain" factor, Ki rejects step disturbances, and Kd has a damping effect to disturbances. In cruise controls they are set by the factory, in a manufacturing plant they can be set by engineering or by factory floor technicians.
Like the B-S equation, its elements are all based on a function of time and operate at 1-10 millisecond range (from sensor input to a corrective output signal)
Key words for more study: "automatic control", “feedback control", or "PID loop control"
Financial: Black-Scholes partial differential equation (B-S PDE or B-S for short)
While this is a differential equation and is time based, it looks a lot like what engineers call an open loop control algorithm (no direct real-time feedback with the system) unlike the PID single loop controller above.
The "System", like in PID control above, is the actual equipment in the real world; in B-S the "system" is the financial market in its entirety (broker dealers, exchanges, customers, financial events etc.).
What appears to be happening here is we are trying to adjust (track) a process variable in real time (derivative V in this case) with reference to another variable (financial stock/asset S). One might think of the "set point" in B-S as the S (stock price) which can vary quickly all over the place over time with V always trying to catch up.
The end result is that B-S is very limited and only computes "the likely value" or "recommended price" and "not the price if bought or sold directly". It is just a big computerized look-up table. There are pieces missing if we wish to control some portion of a financial market system.
Two things seem to keep the equation producing a new value for the financial derivate based upon time when there is no change in stock price or "interest rate". One is the "volatility" factor which by design constantly "drifts" statistically with time. The second is the natural decay factor in price of the financial derivative over time (dV/dt term). These factors are called "The Greeks" and must be set according to guidelines by a trader or quant.
To make matters worse, as the basis of a control system these parameters alone are estimated and not based upon any real-time feedback.
For starters, for B-S to be used as the basis of a feedback control system for the real world of trading, we need to look in real-time at the difference between B-S calculated V vs. real-physical market traded V. The difference, called an "error" value or signal in real-time, could be fed back into B-S via a PID loop algorithm to more closely match the computed price for V with what the real market price of V is on the exchanges (the system). The resulting "control signal" as in PID loop controllers, might trigger an automated buy/sell order of some magnitude. All the data needed is currently available in real-time to do this; and, yes, it may already be part of a more sophisticated trading algorithm; maybe one of those "dirty little secrets" associated to HFT. Just speculating.
Since B-S is a differential equation run on computers as a function of time, hunting to find equilibrium, it happens in "real-time" which is 100 to 200 milliseconds range typical of HFT vs. 1-10 milliseconds typical for industrial process controls. A system may not respond much slower, the decision making takes place in this speed.
If in fact B-S is used in any feedback loop based algorithm for trading, by nature we are faced with the potential over shoot/undershoot of the correct or desired set point values until some stability is reached. Faster is not necessarily better. The effects of an unstable resonate frequency is still there. The potential of wild oscillations in pricing could pass along a destabilizing disturbance throughout related assets in the financial industry in some cases, dependent on speed and how much money is involved (volume flow). Maybe a delay in reaching an equilibrium point (intentionally or unintentionally) can be easily used as a trading advantage to skim fees away from the investor to the house. These are just a few of the potential problems associated with feedback loops and should be addressed.
"The Greeks" as mentioned above: It looks like B-S has five primary user tuning parameters much like we use in PID loop instrument controllers. Set these parameters wrong and things can blow up just like in industry.
Bond Bubble-Derivative Bubble??: Solve the B-S PDE for the Derivative V, and you find the price of a derivative is based upon the reciprocal (divided by) of the interest rate. Like home prices only going up over time mentality, derivatives go up over time as long as interest rates are falling. The "drift" for over 30 years has been falling interest rates which keeps the nominal value of derivatives rising (probably helps explain why derivatives keep growing nominally).
Other real world examples of feedback loops and associated instabilities continue:
Automobiles: This is probably the best place for an intelligent person to begin to understand the implications of inherent instabilities and limits of feedback loop control. We will look at the cruise control system and some related mechanical instability that disturb this system, the physical automobile.
Cruise Control—Take a test drive and note once you set your speed how the car will under/over shoot your desired speed as you go up and down hills. Also note if you have an "accelerate" button on your cruise control how your car responds to a step change in speed as when you reach the new desired speed and set the button. Even on flat roads you can feel the engine make slight changes in power to maintain your speed. Note also how frequently this little adjustment is done automatically. The same thing happens in PID and B-S modified as controllers above.
Natural Frequencies—If you have ever had a wheel out of balance or a front end alignment problem it will show up at what we call the critical speed unique to the system under control. That speed is the point that sets off the destabilizing natural frequency of the automobile system. Violent shaking in the extreme can destroy the car and/or cause an accident. If you have experienced this you most likely just go a little faster or slower to pass through the critical speed range but not dwelling too long in this speed range. If a computer control system algorithm does not know this, unintended consequences occur. Financial systems have their own natural frequencies whether known or not.
Speed Bumps and shock absorbers (importance of the damping function analogous to Kd in PID loops) — Note at what speed you can pass over a residential neighborhood speed bump without bottoming out or causing an objectionable shock to the car. The speed bump is known as a system disturbance. Each car by design has its own unique shock absorbers that dampen the dynamics of the (automotive) system. Different cars have different optimum speeds as you have probably found out. All feedback control systems have built in damper adjustments to optimize performance for a given situation. Get it wrong things can get bad.
Other examples of speed and natural frequency gone bad are front-end washing machines. If the spin speed is set wrong for the wash load weight when wet it will shake itself until it shuts down (automatically desirable control). Or even in our high tech digital audio world we still get that deafening squeal via feedback between microphones and speakers (bad feedback control).
Highway Traffic Flow—Let's take another common automobile driving problem, following another car with neither using cruise control. We know how difficult it is even on the interstate to follow another car at a constant speed/distance especially if the car ahead of us is changing speed even slightly.
Now to automate this process we would have to have the lead car transmit its current speed to our cruise control computer to bring us in synch. This technology has been used by the military for over 40 years. See my discussion on SKE (Station Keeping Equipment).
Other Instabilities: San Jose-San Francisco freeway experience in the 1970's. In heavy traffic while flow was smoothly moving at 60 mph, cars would regularly come to a complete stop. This kept repeating so many times with no sign of an accident or disruption ahead on the Interstate, it got my curiosity. The rule I discovered was flow becomes unstable at certain flow rates or volume of traffic. This rule applies frequently in physics as well. Slight speed changes in the pack leaders ripples and amplifies back through to the end of the pack. So in finance and HFT we could expect instability occurring at certain trading volumes, speed, or frequency.
Military: Mil Spec Systems—Feedback loop based control systems are well developed in the military and too numerous to list, but from personal experience shaping my view of financial instability and corrective actions, here are some examples that follow:
SKE, known as Station Keeping Equipment, is the automatic feedback control version to the solution to traffic flow problems above, and is well developed. It holds position relative to other aircraft flying in formation by various communication techniques. It is integrated into all the pilot/copilots instrument panel and auto pilot systems. Without it, crew members would be exhausted with the work load of constant adjustments with formations of as few as 2 to 5 planes. Worse, it is easy at night or in weather to bunch up and collide causing a major accident. Goggle "SKE" for details; it is in reality a fantastic system.
Anti Skid Systems—Nearly lost a Boeing 747 size plane (Military C-5A) due to pseudo frequency signal from the wheel speed sensor. Maintenance crew was doing an engine power check causing the aircraft/wheel to rock back and forth relative to the sensor. The anti-skid system thought the aircraft was in motion thus activating the anti-skid braking algorithm which prevents a full lock up skid of the wheels. The effect was the plane was slowly moving down the ramp towards other aircraft. Quick action by crew disengaging anti-skid and reverting to normal braking saved the plane. This incident required an engineering fix. In the financial world think what might happen to trading algorithms when spurious signals get fed into the equations and trading algorithms?
SAS-Stability Augmentation System—My favorite feedback loop story of success became evident while on an international flight on a Boeing 757 type plane. By chance I was seated just behind the wings and had a window seat and watched it in action. SAS basically smoothes out a normally bumpy ride when in clear air turbulence called CAT. The feedback loop uses inertial-sensor (accelerometer) input to the autopilot computer for horizontal (elevator control) with a damping algorithm matched to the aircraft's dynamics. The actual "elevator" (more like a spoiler panel) on top of each wing to do this job was close to my window in great view. When we felt the slightest buffet form CAT a small panel (total area only about 1 meter square would not only pop up but would be instantly positioned over a range of 0 degrees (closed) to as much as 30 degrees open in fractions of seconds in response to turbulence. The effect was that no one noticed the turbulence but me, since I could watch it take place, is a testament of the absolute precision of the system. The benefit is a smoother ride for passengers, a significant increased life of the wings, with less weight for structural reinforcement. In the financial world, smoothing/damping algorithms are absolutely critical to detecting and correcting problems before they get out of hand.
Historical: Of Biblical Proportions—Walls of Jericho. Most people know this story but I mention it because resonate frequencies in very small power ranges can produce significant destabilizing forces on structures and objects with amplified effect. As the story goes, when Jericho was under siege they were told to blow their trumpets in numbers and, at the right note (frequency), matched the natural resonate frequency of the walls. Like an out of balance wheel or front end alignment of an automobile, the vibration in this case flexed the walls till they crumbled. Note, if you are a musician try tuning a guitar by plucking one string and adjust the adjacent string to resonate. Tapping a wine glass reveals its natural frequency. Knowing this we can adjust the frequency and dB level of an audio system thus shattering the glass. Any time based system has a critical natural frequency and I expect the financial world is no different.
In Nature, technological examples and solutions are found. Ok now to the graphic shown at the beginning and to answer the question: What does the cicada (winged version on the right) have in common with the Black-Sholes equation? To me this is an interesting example of nature's version of HFT.
Living in the South one is quite familiar with the perennial late August noise of cicada colonies gathered in trees and shrubs producing a deafening 60-70+db buzz sounding chorus.
A little research tells us the buzz noise is the carrier frequency in about the 4 kHz range. It is created by an abdominal "resonate" tuned organ on the male cicada with a matching tuned receive-only system on the female. The mating call consists of a song pattern of periodic momentary "clicks" or chirps (in the 300 Hz range and lasting only 1-2 milliseconds) riding on the carrier frequency buzz. Got it? Don't feel bad I'm trying to get a handle on it also.
To this casual observer, what happens over a 15 minute period is that it starts off with a few insects until they all gradually chime in to a steady peak noise level. When all, I guess, are in the game the overall noise starts a beat-like frequency event: A steady buzz combined with a rhythm of repeating chirp or "zing" sounds, every two to three seconds. Finally the whole process decays off faster than it started. A period of silence and the whole process starts over.
OK, what is the B-S and HFT financial analogy here? Each financial trading exchange has their own proprietary HFT algorithm where traders compete against other exchanges or trading desks throughout the financial system. Important trading activities, just like the mating call of the insect, occur in the millisecond range unnoticed against the background noise of high volume trading.
The implication is that systems (nature or man-made) controlled by time based algorithms typically exhibit critical frequencies where things start to happen. Two such conditions are resonate frequencies with amplified consequences, and frequencies where the throughput of the system starts to go unstable or to choke. Resonate frequencies in the financial world could potentially send amplified destabilizing ripples in synch to other parts of the system. The military-industrial sectors have had generations more time to adapt to these types of problems.
So when I hear the noise of the cicada I think of analogies in our man-made world and their implications.
The Quants Again. People with degrees in mathematics and physics understand these mechanisms better than bankers, but may not have practical experience for the real world consequences, magnitude, or potential for such destabilizing conditions. Armed with just the technical knowledge discussed in my notes one can see where the potential exists for a security threat over and above the potential of fraud by gaming the algorithms in the 100-200 millisecond range.
Interestingly, in a recent article by JR Nyquist, a favorite of mine, implied such a security risk to our banking system as follows:
"...In the twenty-first century the political criminal has become, also, a financial criminal. Here empires are made and unmade. In this context, ask yourself the following question: Was it wise to allow Russia (and China) access to America’s financial system?"
CONCLUSION and other thoughts
Investors warning: "forewarned is forearmed". The financial system is potentially far more unstable than I originally thought!
The Black-Sholes equation does not fit the form of the typical industrial feedback control loop. There is no reconciling control algorithm to adjust B-S calculated price for the derivative V vs. its real-time value as traded. As a result it is not truly adaptive to step changes and disturbances in the market. It is limited to setting the "Greek" tuning parameters correctly. Stock Price, Time, and Interest Rate are the only directly measured variables.
B-S appears more like a complex price tracking/following/look-up table algorithm to derive a likely price of a derivative.
By analogy and experience in the real world of feedback loops, computer driven HFT and executing B-S type time based differential equations could have similar inherent modes of instabilities. And by extension one could reasonably see where the financial world with all its complexity is exposed to many of the same shortcomings that have taken generations in the industrial world to correct. Add to this the potential of a security threat of a destabilizing attack over and above the usual fraud and criminal activity.
About Cris Sheridan
Cris Sheridan Archive
|12/08/2016||Neil Dutta on US Economic Outlook, Risks of “Too Much Fiscal Stimulus”||bcast|
|12/07/2016||Senescence and the Science of Aging||bcast|
|12/02/2016||Stratfor’s Reva Goujon: Major Geopolitical Changes Coming in 2017||bcast|
|12/01/2016||Macro Ops’ Tyler Kling: Bond Market Has Peaked; Watch US Dollar!||bcast|
|11/30/2016||Andrew Zatlin on Trump, Google, and the Leaning Tower of San Francisco||bcast|
|11/25/2016||Why Your Next Car Will Be Driverless||bcast|
|11/24/2016||The Advancing Arms Race for Market Intelligence||bcast|
|11/23/2016||Avi Gilburt on Gold, S&P 500, and Market Timing||bcast|
|11/18/2016||Jim Bianco: Currency Markets Repricing for Potential Trade War||bcast|
|11/17/2016||Clif Droke on Safe-Haven Selloff, Muni Bond Crash||bcast|