How Technical Skills are crucial for the job of a Portfolio Manager, the 2010 version

By , August 9, 2011 7:10 pm

As I am writing this post, I am very sure that what I know and layout here will be changing overtime as I will be incrementally (or logarithmically?) exposed to more of the finance industry. Nevertheless, it serves as a snapshot of my knowledge and values.

“Technical skills” in portfolio management practice refer to a variety of related skill sets which include (but by no mean are limited to):

  1. Financial modeling
  2. Data processing
  3. Statistical handling
  4. Matrix algebra automation
  5. Programming
  6. Database design and coding

I learned from my peers that C++, Visual Basic, MATLAB, Ox and Relational Database Design with SQL are widely used in the industry.

Why is programming and database here? After all, “financiers are business people, not technicians”.

Here are a few reasons I believe to justify the need of technical skills:

  1. Portfolio management requires constant portfolio construction and rebalancing. Different methods and models are employed in the process; huge and diversified data are required. The issue is data are usually scattered from different sources and one needs to be quick on the hands to process them to plug into models
  2. Customizations to Funds Management systems is costly and time-consuming. The cost does not only include actual fee charged by the software developer, but also involve opportunity cost (losing trading opportunities), communication cost, change management cost and business disruption cost. If you yourself can simply write a small application that solves your problem, most aforementioned costs are eliminated
  3. Large financial institutions house indoor IT support and development teams. However, this internal resource only limits the costs to some extend
  4. Graphing, charting and presentation creating are also paramount in writing analysis reports
  5. Existing models concentrate around large well-established markets, exchanges and asset classes. If you work with a new market (e.g. Vietnam), you need the technical skills to build your own model

A few programming techniques I have employed throughout my projects:

  1. Basic programming: data type handling, array handling (for matrix algebra), character handling
  2. Multi-dimensional loops and their optimization
  3. Search & sort algorithms
  4. Logic and discrete math
  5. Memory management, file management and database management

Nonetheless, technical skills make one category among a wide range of silos required from a Portfolio Manager. If you were to measure, how would your weight technical skills in your job?

In conclusion, this post outlines what I believe I know at the moment. What is your experience on this?

Pseudo-codes for basic Finance value calculations

By , August 9, 2011 7:10 pm
// value can either be return or price

// this pseudo-code function calculates the mean of value observations
float[] average(float[] value)
{
for (i = 0 ; i < NUMBER_OF_OBSERVATIONS ; i++) sum += value[i];
return (sum / NUMBER_OF_OBSERVATIONS);
}

// this pseudo-code function calculates the mean of value observations with probability
float[] average(float[] value, float[] probability)
{
for (i = 0 ; i < NUMBER_OF_OBSERVATIONS ; i++) average += value[i] * probablity[i];
return average;
}

// this pseudo-code function calculates discrete return from price observations
float[] discreteReturn(float[] price)
{
discreteReturn[0] = 0;
for (i = 1 ; i < NUMBER_OF_OBSERVATIONS ; i++) discreteReturn[i] = price[i] / price[i-1] - 1;
return discreteReturn;
}

// this pseudo-code function calculates excess return from price observations
float[] excessReturn(float[] price)
{
average = average(price);
for (i = 1 ; i < NUMBER_OF_OBSERVATIONS ; i++) excessReturn[i] = price[i] / price[i-1] - 1 - average;
return excessReturn;
}

// this pseudo-code function calculates variance from value observations
float[] variance(float[] value, float[] probability)
{
average = average(value, probability);
for (i = 0 ; i < NUMBER_OF_ELEMENTS ; i++) variance += probability[i] * (value[i] - average)^2;
return variance;
}

// this pseudo-code function calculates annualized variance from value observations
float[] annualVariance(float[] value, float[] probability)
{
return variance(value, probability) * NUMBER_OF_OBSERVATIONS / NUMBER_OF_YEAR;
}

// this pseudo-code function calculates standard deviation from value observations
float[] stdDev(float[] value, float[] probability)
{
return variance(value, probability)^(1/2);
}

// this pseudo-code function calculates annualized standard deviation from value observations
float[] annualStdDev(float[] value, float[] probability)
{
return annualVariance(value, probability)^(1/2);
}

// this pseudo-code function calculates covariance from two sets of values
float[] variance(float[] value1, float[] value2)
{
average1 = average(value1);
average2 = average(value2);
for (i = 0 ; i < NUMBER_OF_ELEMENTS ; i++) covariance += (value1[i] - average1) * (value2[i] - average2);
return covariance;
}

/*
* this pseudo-code function calculates variance-covariance matrix from multiple values
* value[][] is in the format value[number of observations][number of variables]
*/
float[][] varcovarMatrix(float[][] value)
{
for (i = 0 ; i < NUMBER_OF_VARIABLES ; i++)
{
for (j = 0 ; j < NUMBER_OF_VARIABLES ; j++)
{
varcovar[i][j] = covariance(value[][i], value[][j]); // only takes the vertical array
}
}
return varcovar;
}

// this pseudo-code function calculates correlation matrix from multiple values
float[][] corrMatrix(float[][] value)
{
varcovar[][] = varcovarMatrix(value);
for (i = 0 ; i < NUMBER_OF_VARIABLES ; i++)
{
for (j = 0 ; j < NUMBER_OF_VARIABLES ; j++)
{
corr[i][j] = covariance(value[][i], value[][j]) * stdDev(value[][i]) * stdDev(value[][j]);
}
}
return corr;
}

Code for Markowitz Efficient Frontier Calculation using Black’s Shortcut

By , August 9, 2011 7:09 pm
#include < www.taitran.com/blog/pseudo-codes-for-basic-finance-value-calculations.html >

// This pseudo-code class entails the risk and expected return values for efficient frontier. In real code, accessors and mutators should be provided
class EfficientFrontier()
{
float[] return; // series of expected returns on efficient portfolios
float[] risk; // series of standard deviation of returns of efficient portfolios
float gmvpReturn; // expected return of Global Minimum Variance Portfolio
float gmvpRisk; // standard deviation of returns of Global Minimum Variance Portfolio
float tangentReturn; // expected return of the efficient portfolio tangent to Capital Market Line
float tangentRisk; // standard deviation of returns of the efficient portfolio tangent to Capital Market Line
float shortConstraintMaxReturn; // maximum expected return that an efficient portfolio can reach
float shortConstraintMaxRisk; // standard deviation of returns of the efficient portfolio with maxmimum return
}

// This pseudo-code function produces position of Markowitz Efficient Frontier
EfficientFrontier getEfficientFrontier(float[][] price)
{
const float c1 = 0.1; // first substitute of risk-free rate for Black's shortcut
const float c2 = 0.2; // second substitute of risk-free rate for Black's shortcut
float[] annualReturn = annualReturn(price);
float[][] annualVarcovar = annualVarcovarMatrix(price);
annualVarcovar = InverseMatrix(annualVarcovar);

for (i = 0 ; i < NUMBER_OF_VARIABLES ; i++)
{
for (j = 0 ; j < NUMBER_OF_VARIABLES ; j++)
{
z1[i] += annualVarcovar[i][j] * (annualReturn[j] - c1);
}
sumz1 += z1[i];
x1[i] = z1[i] / sumz1;
}

// repeat for z2 & x2;

float expectedReturn1, expectedReturn2;

for (i = 0 ; i < NUMBER_OF_VARIABLES ; i++) // calculate expected return
{
expectedReturn1 += annualReturn[i] * x[i];
}

// repeat for expectedReturn2;

variance1 = z1[] * annualVarcovar * z1[]; // this is a shorthand for tri-matrices multiplication. Actual code should extend the calculation of matrix multiplication

// repeat for variance2;

covariance = z1[] * annualVarcovar * z2[];

return = discreteReturn(price);
risk = stdDev(price);

for (i = 0 ; i < NUMBER_OF_OBSERVATIONS ; i++)
{
if (maxReturn < return[i]) maxReturn = return[i];
if (maxRisk < risk[i]) maxRisk = risk[i];
// the maximum return and standard deviation here are not exactly value due to limitation of the method. A better method can be found here www.taitran.com/blog/limitation-of-using-blacks-shortcut-to-portfolio-optimization-in-excel-and-solution.html
}

do
{
w2 = 1 - w1; // rebalance the two asset portfolio
EfficientFrontier.return[i] = w1 * expectedReturn1; // for demonstration only, a mutator should be used
EfficientFrontier.risk[i] = (w1^2 * variance1 + w2^2 * variance2 + 2 * w1 * w2 * covariance)^(1/2); // for demonstration only, a mutator should be used
w1 += INCREMENT;
i++;
}
while(EfficientFrontier.return[i] <= maxReturn); // for demonstration only, an accessor should be used
}

IESE Global Venture Capital & Private Equity Country Attractiveness Index

By , August 9, 2011 7:09 pm

Prof. Alexander Groh and Prof. Heinrich Liechtenstein, together with a group of researchers from IESE’s International Center for Financial Research (CIIF) and support from Ernst & Young and DLA Piper Weiss-Tessbach, have rated the varying levels of "attractiveness" of global countries for venture capitalists and private equity investors.

The index sources from over 150 databases.

Key indicators of VC/PE attractiveness include:

  1. Economic Activities
  2. Taxation
  3. Entrepreneurship Culture and Opportunities
  4. Human and Social Environment
  5. Depth of Capital Market
  6. Investor Protection and Corporate Governance

The index can be viewed at VC/PE Index IESE

Venture Capital and Private Equity are also taught at University of New South Wales at postgraduate level.

Securities exchange micro-structure part 2 – How it affects trading

By , August 9, 2011 7:08 pm

Informed traders can mask their information advantage by

  • Breaking the trade into medium size
  • Use Limit Orders to test the market

Earnings announcements generally affect intraday price movements more than dividend announcements

Retail-dominated markets Institutional Purchase Institutional Sale
Expected Fairly stabilize Stabilize
Unexpected Stabilize Cause volatility

In institution-dominated markets: institutional purchase good signal, institutional sale no effect (liquidity driven).

Price adjustments to new information are quicker on NASDAQ than NYSE/AMEX.

When informed: place aggressive orders to profit from information then place limit orders to take advantage of bid/ask spread.

Limit orders perform better in first half of trading session.

Opening & closing time: high liquidity, high transaction costs, fast execution speed.

In uncertainty, follow momentum.

Insiders sell 10 months ahead of crash. Insiders purchase close to increase in price.

Intense insider sales followed by low activity signals uncertainty which leads to crash – the dog that did not bark. This effect does not apply to insider purchase.

Reference

Barclay M, Warner J, 1993, ‘Stealth trading and volatility: which trades move price?’, Journal of Financial Economics

Li W, Wang S, 2010, ‘Daily institutional trades and stock price volatility in a retail investor dominated emerging market’, Journal of Financial Markets

Patell J, Wolfson M, ‘The intraday speed of adjustment of stock prices to earnings and dividend announcements’, Journal of Financial Economics

Masulis R, Shivakumar L, 2002, ‘Does market structure affect the immediacy of stock price responses to news’, Journal of Financial and Quantitative Analysis

Anand A, Chakravarty S, Martell T, 2005, ‘Empirical evidence on the evolution of liquidity: choice of market versus limit orders by informed and uninformed traders’, Journal of Financial Markets

Zhang F, 2006, ‘Information uncertainty and stock returns’, American Finance Association

Marin J, Olivier J, 2008, ‘The dog that did not bark: insider trading and crashes’, Journal of Finance

Securities exchange micro-structure part 1 – NYSE, NASDAQ, CBOE, LSE, EuroNext, ASX

By , August 9, 2011 7:08 pm

NYSE: order-driven. NASDAQ: quote-driven. LSE: quote-driven. ASX: order-driven.

NYSE faster for market orders. NASDAQ is faster overall (25 seconds). NYSE slower (50 seconds) because of manual execution & auction.

Liquidity

Liquidity has U-shape pattern: high at open and close. Trade while liquidity is high. Prices are more informative in liquid parcels.

NYSE orders are consolidated. NASDAQ orders are fragmented because NASDAQ has different trading locations.

Switch from NASDAQ to NYSE: liquidity & price efficiency improved, volatility reduced. Consolidation is more valuable for less liquid stocks.

Spreads

NASDAQ: spreads are stable through out the day but narrow near close.

NASDAQ spreads remain constant during first hour. NYSE spreads decline.

NASDAQ spreads narrow near close, NYSE spreads widen near close.

CBOE options: spread high at open, narrows after open, lowest at close.

NYSE: reversed-J spread shape.

Inverse relationship between spreads and activity. Relationship between risk and spreads. Relationship between spreads and information coming to market. Inverse relationship between spreads and competition.

Switch from NASDAQ to NYSE: quoted spreads & effective spreads decrease.

Institutional Trading

70% trading volume on NYSE is by member firms & institutional investors.

Large block institutional sale: perceived as liquidity motivation. Block purchase: perceived as containing favorable information, especially for small stocks.

Seller-initiated: down then slightly up, price effect is temporary. Buy-initiated: up then slightly down, price effect is permanent.

Seller-initiated: price reaches equilibrium after 3 trades, most adjustments in the first trade. Buy-initiated: equilibrium after 1 trade.

Downticks: price effect is largely permanent. Upticks: permanent price effect dominates.

Brokers do short to accommodate block purchase.

Anonymity

Spreads decline. Aggressiveness decline. Orderbook depth increases.

Limit order traders are more willing to expose under anonymity.

Anonymity attracts order flow from non-anonymous markets, but only for large stocks.

Anonymity has few benefits to inactive stocks, and higher benefits in presence of information asymmetry.

Increase in spreads foreshadows increase in volatility.

Positive relationship between spreads in one parcel and magnitude of price change in the subsequent.

Exchanges in fragmented markets should consider anonymous trading to improve price competition and liquidity.

Bibliography

Bennett & Wei, 2006, Market structure, fragmentation, and market quality

Admati & Pfleiderer, 1998, A theory of intraday patterns: volume and price variability

Chan, Christie & Schultz, 1995, Market structure and the intraday pattern of bid-ask spread for NASDAQ securities

Chan, Chung & Johnson, 1995, The intraday behavior of bid-ask spreads for NYSE stocks and CBOE options

Chan & Lakonishok, 1992, Institutional trades and intraday stock price behavior

Comerton-Forde & Tang, 2009, Anonymity, liquidity and fragmentation

Foucault, Moinas & Theissen, 2005, Does anonymity matter in electronic limit order markets?

Holthausen & Leftwich, 1987, The effect of large block transactions on security prices

Holthausen, Leftwich & Mayers, 1990, Large-block transactions, the speed of response, and temporary and permanent stock-price effect

McInish & Wood, 1992, An analysis of intraday patterns in bid/ask spreads for NYSE stocks

MATLAB code for Gaussian Function

By , August 9, 2011 7:07 pm
A = 1;
x0 = 0; y0 = 0;

sigma_x = 1;
sigma_y = 2;

for theta = 0:pi/100:pi
a = cos(theta)^2/2/sigma_x^2 + sin(theta)^2/2/sigma_y^2;
b = -sin(2*theta)/4/sigma_x^2 + sin(2*theta)/4/sigma_y^2 ;
c = sin(theta)^2/2/sigma_x^2 + cos(theta)^2/2/sigma_y^2;

[X, Y] = meshgrid(-5:.1:5, -5:.1:5);
Z = A*exp( - (a*(X-x0).^2 + 2*b*(X-x0).*(Y-y0) + c*(Y-y0).^2)) ;
surf(X,Y,Z);shading interp;view(-36,36);axis equal;drawnow
end

The proving of Fundamental Lemma: from Math to Money, and probably Misery

By , August 9, 2011 7:07 pm

 

Proving of Fundamental Lemma by Fields Medalist Professor Ngo Bao Chau, or more generally, a breakthrough B in Mathematics theory does have direct impact on everyday life:

  1. Research B’, B”, Bn ‘ will spawn
  2. Academic components will be composed en masse basing on B, B’…
  3. (2) generates billions of revenue for education service providers
  4. (2) generates revenue for book composers, sellers and distributors
  5. Non-B research will likely cease and research budget will be saved
  6. Scientists from other disciplines (Physics, Chemistry, Biology, Computer Science, Anthropology…) will benefit from B
  7. Quants will use B to build new financial models, instruments, institutional models… which will lead to new cycles of fund flows, transfer of wealth, job creation, excessive expansions… All will feed up bubbles which test limits of economic systems. When the limits are smashed, markets will crash and economies will collapse (Ho 2010). A few extraordinary quants (Doan 2010) equipped with mathematics beyond normal human comprehension and possess real understanding of behavioral economics will make fortune; hundreds of thousands will lose their jobs and assets; billions will suffer crises.
  8. Perhaps the most well-known example of (7) in Finance world is Ito’s lemma and Wiener process, used for Derivatives valuation (i) (Ho 2010). Derivatives market beyond control is one reason which had lead to 2007-present global financial crisis (ii) (Friedman & Friedman 2009).

B might be rooting it all. At this very present.

(i) John Hull – Options, Futures, and Other Derivatives, Seventh Edition http://www.rotman.utoronto.ca/~hull/ofod/

(ii) Hershey H. Friedman & Linda W. Friedman – The Global Financial Crisis of 2008: What Went Wrong? http://ssrn.com/abstract=1356193

Image from Wolfram’s demonstration of Ito’s Lemma

The case of idiosyncratic risk

By , August 9, 2011 7:04 pm

It is well argued that idiosyncratic risks are not desired and can be diversified away (Bodie et al 2007). While this knowledge dominates introduction to finance courses (subjects/modules), idiosyncratic risk is in other most circumstances the key to wealth.

Firm-specific and industry-specific characteristics are key to capture excess returns from CAPM expected return. For example, retail industry, food industry, metal industry etc. fluctuate to business cycles, and business cycles are not captured in CAPM.

Next, idiosyncratic volatility is useful for speculation purpose, especially when you do not have a concrete target on where to exit the investment. Volatile means holding through (or even shorting during) dip and exit during peaks. You earn steady income through dividends and small gains on stable stocks, but you make fortune on volatile-but-fundamentally good investments.

Treynor Black model for alpha specifies that on the Single Index Model

Active portfolio A should receive investment weight

where the rest of the portfolio should be invested in market index. This is one example in the academic world where idiosyncratic is, indeed, good.

Practical relevance: for smaller stocks and international investments, particularly emerging markets, ‘beta’ approach almost does not work. These are the cases where idiosyncrasy comes to play.

Bodie Z, Kane A, Marcus A, 2007, ‘Investments’, McGraw-Hill, 2007

Treynor, J. L. and F. Black, 1973, ‘How to Use Security Analysis to Improve Portfolio Selection’, Journal of Business, January, pages 66–88

Google Risks Explained to my non-geek colleagues

By , August 9, 2011 7:04 pm

Panorama Theme by Themocracy