algorithm design and evaluation further reveal connection between investment and trading processes
TRANSCRIPT
Introduction
The design of effective algorithms for trading may sometimes seem an “art on its own”, full of rules of thumb and very disconnected from the investment process within which algos exist.
We show, via clear and practical examples, that such notion is misleading, in sometimes surprising ways. We then connect those examples with approaches that appropriately fix the algorithmic flaws presented. Those approaches fix those flaws mostly by keeping the initial investment decision in mind and knowing how to manage transaction costs.
A Novel Idea:A Tale Of Love And Hate (really novel!)
• Loved Algo FILLS MORE AT BETTER PRICES• Loved has traded those 5 orders better than Hated… Right?• Remark: 1-Day Stock Pr Chg = from order placement to 24h later.
# Stock Side Order Arrival Pr Traded Sh Traded Pr Fill Slipp (BP) 1-Day Stock Pr Chg (BP)
1 XYZ B 1,000,000 102.08$ 850,000 102.31$ 85% -8 11
2 XYZ B 1,000,000 102.30$ 1,000,000 102.60$ 100% -14 21
3 XYZ B 1,000,000 102.11$ 636,000 102.24$ 64% 2 18
4 XYZ B 1,000,000 102.09$ 1,000,000 102.34$ 100% -9 6
5 XYZ B 1,000,000 102.06$ 514,326 102.07$ 51% 14 19
Avg 1,000,000 102.13$ 800,000 102.31$ 80% -3 15
Loved Algo
# Stock Side Order Arrival Pr Traded Sh Traded Pr Fill Slipp (BP) 1-Day Stock Pr Chg (BP)
1 XYZ B 1,000,000 102.08$ 885,011 102.28$ 89% -5 17
2 XYZ B 1,000,000 102.30$ 859,882 102.60$ 86% -14 23
3 XYZ B 1,000,000 102.11$ 823,525 102.30$ 82% -4 19
4 XYZ B 1,000,000 102.09$ 561,434 102.21$ 56% 3 10
5 XYZ B 1,000,000 102.06$ 370,148 102.26$ 37% -5 6
Avg 1,000,000 102.13$ 700,000 102.33$ 70% -5 15
Hated Algo
(Profit From Flipping)
Algo's Ordered Traded Fill Slipp Slipp 1-Day 1-Day 1-Day Chg Flipping Flipping Flipping
Avg # Shares Shares (BP) ($/sh) Pr Chg Pr Chg Net of Slipp Proceeds ($) Proceeds Proceeds
Trade (BP) ($/sh) ($/sh) (Net X Shares) ($/sh) (BP)
Loved Algo 5 1,000,000 800,000 80% -3 (0.031)$ 15 0.153$ 0.12$ 98,043$ 0.10$ 9.6
Hated Algo 5 1,000,000 700,000 70% -5 (0.051)$ 15 0.153$ 0.10$ 71,490$ 0.07$ 7.0
Loved Algo Does Seem To Deserve Love
• “Flipping” Exercise: Buy at arrival plus slippage (that is, traded price), sell at 24h later price, keep net.
• Average trade conditions same.• From table, “Fill The Most At Best Prices” works:
Loved lets the fund pocket 9.6 BP ($98k) per order on average, while Hated lets fund pocket only 7.0 BP ($72k) per order, on average.
• Loved Algo Is Better… RIGHT?
# Stock Side Ordered Shares Arrival Pr Traded Sh Traded Pr 1-Day Stock Pr Chg Fill Slipp Flipped $/sh $ Flipped1 XYZ B 1,000,000 102.08$ 885,011 102.28$ 0.17$ 89% (0.05)$ 0.12$ 108,410$ 2 XYZ B 1,000,000 102.30$ 859,882 102.60$ 0.24$ 86% (0.14)$ 0.09$ 79,169$ 3 XYZ B 1,000,000 102.11$ 823,525 102.30$ 0.19$ 82% (0.04)$ 0.15$ 126,135$ 4 XYZ B 1,000,000 102.09$ 561,434 102.21$ 0.10$ 56% 0.03$ 0.13$ 74,512$ 5 XYZ B 1,000,000 102.06$ 370,148 102.26$ 0.06$ 37% (0.05)$ 0.01$ 3,778$
Avg 1,000,000 102.13$ 700,000 102.33$ 0.15$ 70% (0.05)$ 0.10$ 78,401$ Total 5,000,000 3,500,000 392,004$
Hated Algo
# Stock Side Ordered Shares Arrival Pr Traded Sh Traded Pr 1-Day Stock Pr Chg Fill Slipp Flipped $/sh $ Flipped
1 XYZ B 1,000,000 102.08$ 850,000 102.31$ 0.11$ 85% (0.08)$ 0.03$ 26,030$
2 XYZ B 1,000,000 102.30$ 1,000,000 102.60$ 0.21$ 100% (0.14)$ 0.07$ 71,610$
3 XYZ B 1,000,000 102.11$ 636,000 102.24$ 0.18$ 64% 0.02$ 0.20$ 129,884$
4 XYZ B 1,000,000 102.09$ 1,000,000 102.34$ 0.06$ 100% (0.09)$ (0.03)$ (30,627)$
5 XYZ B 1,000,000 102.06$ 514,326 102.07$ 0.19$ 51% 0.14$ 0.34$ 173,224$
Avg 1,000,000 102.13$ 800,065 102.31$ 0.153$ 80% (0.03)$ 0.12$ 74,024$ Total 5,000,000 4,000,326 370,121$
Loved Algo
Looking More Closely: Potential Profit If Flipped Shares Next Day* Loved fills
more, at lower prices than Hated...
... But ??
7.2 BP =
370k/ 500MM
7.7 BP =
390k/ 500MM
• Now fund seems to keep more money using Hated.• Perhaps it is time to give more love to the Hated –
and vice versa?* For simplicity – and without compromising results – transaction costs not shown in flipped sells (included only when fund really sells, not in potential profit exercise). If included when sale happens, transaction cost is appropriately taken into account, and no double count happens.
Confusion: Loved Algo Better Before, Worse Now ?????
• Now, with Loved Algo, fund nets ONLY 7.2 BP per order.• With Hated Algo, fund nets 7.7 BP per order.• Which one is correct, once and for all?
Potential Gross
Given To Algo
sum of StockChgi * TargetShi
for i=1, ..., 5 trades
Both Algos Loved Algo Hated Algo Loved Algo Hated Algo
Total $ 766,100$ 370,121$ 392,004$ 370,121$ 392,004$ For # Shares 5,000,000 4,000,000 3,500,000 5,000,000 5,000,000
Per Share 0.15$ 0.09$ 0.11$ 0.074$ 0.078$ BP 15 9 11 7.2 7.7
Algo Receives
Fund's Research
Quality And Tries To Make The Best Out
Of It
Algo's Potential Proceeds Fund's Proceeds
From Flipping From Algo
sum of (StockChgi - Slippi) * TRADEDShi Over Planned Shares
for i=1, ..., 5 trades (5,000,000 shares)
Algos' Fill Rates X (24h Pr Chg - Slipp): Capitalizing on Fill Rate, Slipp Effort
0%20%40%60%80%
100%120%
-10 0 10 20 30 40
Trade's Return - Slippage (BP)
Tra
de
's F
ill R
ate
Loved
Hated
Loved's High Fill + Low Slipp Efforts Are Lost In
NEGATIVE (Fill, PrChg-Slipp) Correlation (-93%)
Hated's Lower Fill + Higher Slipp Are Made Up In
POSITIVE (Fill, Ret-Slipp) Correlation
(+65%)
Answer: ”Hated” Did Perform Better Than “Loved” –
We Have To Add Each Trade’s $. “Loved”’s AIM Strategy, When Under Bad TC
Mgmt, Leads To A Self-Imposed Adverse Selection
“Hated Algo” Returns More Money Back To Fund’s Research Alpha
• Loved algo jumps too hard at cheaper opportunities.
• Because initially lower prices tend to yield not as good medium term returns, the additional mkt impact from those “rushes to cheap” cancels the benefits from better prices.
• Loved algo needs better TC management.
Potential Gross
Given To Algo
sum of StockChgi * TargetShi
for i=1, ..., 5 trades
Both Algos Loved Algo Hated Algo Loved Algo Hated Algo
Total $ 766,100$ 370,121$ 392,004$ 370,121$ 392,004$ For # Shares 5,000,000 4,000,000 3,500,000 5,000,000 5,000,000
Per Share 0.15$ 0.09$ 0.11$ 0.074$ 0.078$ BP 15 9 11 7.2 7.7
Algo Receives
Fund's Research
Quality And Tries To Make The Best Out
Of It
Algo's Potential Proceeds Fund's Proceeds
From Flipping From Algo
sum of (StockChgi - Slippi) * TRADEDShi Over Planned Shares
for i=1, ..., 5 trades (5,000,000 shares)
Why We Should Start Really Loving The “Hated Algo”:
The Power of 1 BP• Reinvest net x
BP proceeds from each 24-hour investment horizon.
• 200 days/year.• Compounding
yields (1.000x)200-1 annual returns.
• Simple setup, but illustrates power of 1 BP saved.
Annual Fund Return(Calculated based on an avg of 1 trade per day)
Formula = (1.000x )200-1, based on 200 days per year
6%8%
11%13%
15%17%
20%22%
25%27%
0%
5%
10%
15%
20%
25%
30%
3 4 5 6 7 8 9 10 11 12 13
Net Return (BP) (= 24-hour pr chg - slippage) Per 24-Hour Investment Period
An
nu
al F
un
d R
etu
rnPotential Savings May
Increase Annal Returns By A Lot
The Conclusion From Love X Hate: Algorithms Depend Enormously On Appropriate
TC Mgmt – Investment/Trading Together:The Trading X Alpha Orthogonality Principle
•
Fund’s alpha
Optimal Net (orthogonal with fill)
Hated Slipp
Loved Slipp
Optimal Slipp
• Graphic Interpretation: 5-point slippage and alpha numbers can be represented as vectors.• Correlations fill, net angle• Conclusions: • Loved: traded more when alpha smaller neg correl should not jump so hard at better prices; be less afraid of unfavorable prices.• Hated: traded more at good alphas pos correl could trade some slippage for higher net even when forecasting well.
• Vectors: slippage, alpha and fill rate’s numbers can be represented as R5 vectors. Correlations and angles between those vectors can be shown to be equivalent quantities.• Since cannot see in R5, show above in plane.
Another Conclusion From Love X Hate: Opportunity Cost And Risk, Not Only Slippage, A Major Component In Evaluating Algorithmic
Performance
• Tendency is to select a benchmark (say, arrival), and calculate average cost (slippage) with respect to it. Misleading, as gaming may make benchmark average look better for algos but yielding worse for fund’s returns.
•Different situations: appropriate transaction cost measurements should correct for different trading conditions (momentum, liquidity, etc).
Part II: Algorithms Cannot Avoid TC Management And Investment
IdeaWhen Adapting To Market
Movement, Keep Impact X Risk At Sight + Remember Initial
Preferences
TC Management: Cannot Avoid The Trade-Off Between Risk (And Alpha) And Market Impact
Efficient Trading Frontier(Almgren & Chriss)
Timing Risk
Tra
din
g C
os
t
X*
30
20
Trading Cost Distribution
Trading Cost
20
30 30
•Strategy X can be represented by a percentage of volume rate (“POV”) or by a trade schedule.
• Adaptation: Should adapt the initial scheduled plan as trading evolves, without drifting away from initial cost/risk preferences.
Algorithm’s Adaptive Strategies: AIM – Has To Follow TC Management As Well
• Very Important: Reference price has to shift as achieved cost and prices change in order to reflect original preferences.
AIM Adaptation Tactic
Good Risk Bad RiskC3 < C1
Constant Trade Rate
AIM Tactic
Tra
de
Rat
e
Comparison of Adaptation Tactics Trading Rates
Pb Pb+frefPb-fref
AIM
Target
PIM
• Loved Algo’s flaw was that, even though it reacted to favorable prices, it lost sight of TC management and initial price X risk trade-off.
Algo Example: Investing & Trading Decisions Tied
Efficient Trading Frontier
Timing Risk
Cos
t
x1
x2x3
c1
c3
c2
r1 r2 r3
*2'..
'
Cwwts
rwMaxw
*'..
'
rrwts
CwwMinw
CwwrwMaxw
'' *
xxMIMinx
Efficient Frontier
Risk
Ret
urn
U2
U3Frontier
U1
Investment & Trading Frontiers Connected: Losing Sight Of Alpha
May Ruin Trade TC MgmtInvestment Frontier
Risk
Ret
urn
*
*-c3
*-c1
*-c2
* *+r2*+r3
x3
x1
x2
*+r1
• Case in point: Loved Algo’s careless attack into cheaper prices.
• By seeing current price levels compared to arrival (or implementation) price, Loved Algo could have managed better its “greed”.
Ensuring Consistency between Investment & Trading Frontiers
Investment Frontier
Risk
Ret
urn
U1
U2
X
Frontier
U3
Z
(VWAP = Ineff icient)
(Very Aggressive = Ineff icient)
Y
(Optimal = Eff icient)
LOVED ALGO: forgets planned alpha and values instant gratification without remembering its exact risk aversion...
HATED ALGO: not VWAP, since it could save slippage even at good alpha forecasts. But, like VWAP, could be more aggressive at cheaper prices (has some room for slippage).
Risk Aversion Should be Consistent Across Investing & Trading
Determining Appropriate Level of Risk Aversion
Risk
Ret
urn
Investment Frontier Cost-Adjusted Frontier
A
ETF-A
X
Slope of Tangent
Introductory Example:Who Performed Better?
• Avg Cost:• Hated Algo:
-36 BP• Loved Algo:
-11 BP
• Conclusion:• Loved Better
Than Hated.• Obvious,
right?
Hated Algo gets the “curve ball” (9 COG 400k, 1 MSFT 10k)...
Loved Algo gets the “beach breeze” (1 COG 400k, 9 MSFT 10k)...
ALGO Trade# Symbol StockNick Side Order ADV Slippage OppCost CostHated 1 COG "Apple" BUY 400,000 535,000 (30) (10) (40) Hated 2 COG "Apple" BUY 400,000 535,000 (30) (10) (40)
Hated 3 COG "Apple" BUY 400,000 535,000 (30) (10) (40)
Hated 4 COG "Apple" BUY 400,000 535,000 (30) (10) (40)
Hated 5 COG "Apple" BUY 400,000 535,000 (30) (10) (40)
Hated 6 COG "Apple" BUY 400,000 535,000 (30) (10) (40) Hated 7 COG "Apple" BUY 400,000 535,000 (30) (10) (40) Hated 8 COG "Apple" BUY 400,000 535,000 (30) (10) (40) Hated 9 COG "Apple" BUY 400,000 535,000 (30) (10) (40)
Hated 10 MSFT "Orange" BUY 10,000 63,000,000 (1) 0 (1)
Avg 361,000 6,781,500 (27) (9) (36)
ALGO Trade# Symbol StockNick Side Order ADV Slippage OppCost Cost
Loved 1 MSFT "Orange" BUY 10,000 535,000 (4) (1) (5) Loved 2 MSFT "Orange" BUY 10,000 535,000 (4) (1) (5)
Loved 3 MSFT "Orange" BUY 10,000 535,000 (4) (1) (5) Loved 4 MSFT "Orange" BUY 10,000 535,000 (4) (1) (5)
Loved 5 MSFT "Orange" BUY 10,000 535,000 (4) (1) (5) Loved 6 MSFT "Orange" BUY 10,000 535,000 (4) (1) (5) Loved 7 MSFT "Orange" BUY 10,000 535,000 (4) (1) (5) Loved 8 MSFT "Orange" BUY 10,000 535,000 (4) (1) (5) Loved 9 MSFT "Orange" BUY 10,000 535,000 (4) (1) (5) Loved 10 COG "Apple" BUY 400,000 63,000,000 (40) (20) (60) Avg 49,000 6,781,500 (8) (3) (11)
Cost
Algo COG, 400,000 MSFT, 10,000
Hated (40) (1)
Loved (60) (5)
Looking More Closely...• Indeed, Loved’s Average of -11 BP Better Than Hated’s -36 BP.• But, strangely... • Hated “beats” Loved in direct “face-offs”:• Hated trades MSFT better than Loved.• Hated trades COG better than Loved.• SO: IS Loved STILL BETTER THAN Hated? IS -11 BP ABOVE
REALLY BETTER THAN -36 BP ABOVE? WHAT GIVES?...
Hated trades COG better than Loved
Hated trades MSFT better than Loved
In the table above, B’s average’s superiority comes into question.
Cost
Algo COG, 400,000 MSFT, 10,000
Hated (40) (1)
Loved (60) (5)
Paradox Resolved• Avg Cost:• Hated: -36 BP• Loved: -11 BP• But Hated better
for each stock. How come?
• Answer:• Hated beats Loved
hand-to-hand and is thus better than Loved. Simple average is misleading due to uneven assignment of easy (MSFT) and hard (COG).
Hated trades COG better than Loved
Hated trades MSFT better than Loved
Number of Trades
Algo COG, 400,000 MSFT, 10,000
Hated 9 1
Loved 1 9
Should Be Able To Compare At Level Playing Fields
• Different algos, say from different brokers, may enjoy different perceptions in the buy-side firm which uses them.
• The firm may apply one algo for certain trade characteristics and other algo for other characteristics.
• For fair comparisons – and best use of algos – such possible differences should be taken into account.
Conclusions
• What looks good when seen in isolation may not be as good when seen as part of a process. Algos should be consistent with investment.
• TC management follows some basic ideas. Adapting the efficient frontier to adaptive trading (as in algos) goes beyond simple rules of thumb to include the investment plan.
• Comparing algos should take into account possible differences in their applications, even for similar type algos (like, two IS algos).