# Toss your Financial Slide-rule: Beta Computation, MPT, and PMPT

Let me take you back to grad school for a few moments, or perhaps your college undergrad. If you’ve studied much finance, you’ve surely studied beta in the context of modern portfolio theory (MPT) and the Capital-Asset Pricing Model (CAPM). If you are a quant like me, you may have been impressed with the elegance of the theory. A theory that explains the value and risk of a security, not in isolation, but in the context of markets and portfolios.

Markowitz‘s MPT book, in the late 50’s, must have come as a clarion call to some investment managers.  Published ten years prior, Benjamin Graham’s The Intelligent Investor was, perhaps, the most definitive book of its time.  Graham’s book described an intelligent  portfolio as a roughly 50/50 stock/bond mix, where each stock or bond had been selected to provide a “margin of safety”.  Graham provided a value-oriented model for security analysis; Markowitz provided the tools for portfolio analysis.  Markowizt’s concept of  beta added another dimension to security analysis.

As I explore new frontiers of portfolio modeling and optimization, I like to occasionally survey the history of the evolving landscape of finance.  My survey lead me to put together a spreadsheet to compute β.  Here is the beta-computation spreadsheet.   The Excel spreadsheet uses three different methods to compute β, and they produce nearly identical results.  I used 3 years of weekly adjusted closing-price data for the computations.  R2 and α (alpha) are also computed.   The “nearly” part of identical gives me a bit of pause — is it simply round off, or are there errors?  Please let me know if you see any.

An ancient saying goes “Seek not to follow in the footsteps of men of old; seek what they sought.”   The path of “modern” portfolio theory leaves behind many footprints, including β and R-squared.  Today, the computation of these numbers is a simple academic exercise.  The fact that these numbers represent closed-form solutions (CFS) to some important financial questions has an almost irresistible appeal to many quantitative analysts and finance academics.   CFS were just the steps along the path;  the goal was building better portfolios.

Markowitz’s tools were mathematics, pencils, paper, a slide rule, and books of financial data.  The first handheld digital calculator wasn’t invented until 1967.  As someone quipped, “It’s not like he had a Dell computer on his desk.”   He used the mathematical tools of statistics developed more than 30 years prior to his birth.  A consequence of his environment is Markowitz’s (primary) definition of risk:  mean variance.  When first learning about mean-variance optimization (MVO), almost every astute learner eventually asks the perplexing question “So upside ‘risk’ counts the same as the risk of loss?”  In MTP, the answer is a resounding “Yes!”

The current year is 2012, and most sophisticated investors are still using tools developed during the slide-rule era.  The reason the MVO approach to risk feels wrong is because it simply doesn’t match the way clients and investors define risk.  Rather than adapt to the clients’ view of risk, most investment advisers, ratings agencies, and money managers ask the client to fill out a “risk tolerance” questionnaire that tries to map investor risk models into a handful of MV boxes.

MPT has been tweaked and incrementally improved by researchers like Sharpe and Fama and French — to name a few.  But the mathematically convenient MV definition of risk has lingered like a baseball pitcher’s nagging shoulder injury.  Even if this metaphorical “injury” is not career-ending, it can be career-limiting.

There is a better way, though it has a clunky name:  Post-Modern Portfolio Theory (PMPT).  [Clearly most quants and financial researchers are not good marketers… Next-Gen Portfolio Optimization, instead?]   The heart of PMPT can be summed up as “minimizing downside risk as measured by the standard deviation of negative returns.  “A good overview of PMPT in this Journal of Financial Planning Article.  This quote for that article stands out brilliantly:

Markowitz himself said that “downside semi-variance” would build better portfolios than standard deviation. But as Sharpe notes, “in light of the formidable computational problems…he bases his analysis on the variance and standard deviation.”

“Formidable computational problems” of 1959 are much less so today.  Financial companies are replete with processing power, data storage and computer networks.  In some cases developing efficient software to use certain PMPT concepts is easy, in other cases it can be extremely challenging.   (Please note the emphasis on the word ‘efficient’.   An financial algorithm that takes months to complete is unlikely to be of any practical use.)   The example Excel spreadsheet could easily be modified to compute a PMPT-inspired beta. [Hint:  =IF(C4>0, 0, C4)]

Are you ready step off the beaten path constructed 50 years ago by wise men with archaic tools?   To step onto the hidden path they might have blazed, if armed with powerful computer technology?  Click the link to start your journey on the one less traveled by.

The first business plan I wrote was a basic outline for a small residential real-estate venture.  It detailed the property, the company equity in the property, re-curing expenses, estimated value of the property, competitive rental market data and expected cash flow.  This simple, one-page, business plan helped secure a \$10,000 private loan, that has hence been repaid.  This business is still operating successfully and profitably.

Putting together a business plan for a start up is a different matter.  The financials are not there yet, and financial forecasting is at best a guess.  Instead the business plan must focus on  ideas and products that serve to fill a gap in the target market.   It must also demonstrate why this company and this product is well-positioned to fill that market need.   Next, I’ll strive to write a start up business plan…

### Sigma1 Financial: A Business Plan for Revolutionizing Financial Portfolio Software.

The Market —  Sigma1’s market analysis reveals a stunning gap in the B2C financial software space.  The exists plenty of portfolio analysis software, but nothing that is truly portfolio-optimization software.  I refer the reader to two prime examples:  1) Quicken Premier 2012 (R) and 2) Financial Engines (R).  Both tools help investors manage and analyze investment portfolios.  They help with tracking asset allocations.  Financial Engines goes further by providing portfolio advice on increasing or decreasing risk level and changing allocations between the following asset classes: cash, bonds, large-cap stocks, mid/small-cap stocks, and international stocks.  In some cases Financial Engines partners with other firms and recommended changes can be implemented automatically.

Competing products tend to focus on broad market sectors and have little to no support for individual stocks and non-traditional-asset-class ETFs (such as gold ETFs, sector ETFs, convertible securities ETFs).

Market analysis of the B2B space is more challenging because publicly available product data is scarce.  Nonetheless, in online social media conversations with investment professions, several features of Sigma1 software appear to be unique.  For now market analysis of the B2B space is an ongoing process.

Core Product(s) — The Sigma1 Financial Engine, presently code-named HAL0 (HAL zero), is based, in part, on heuristic modeling, machine learning, and evolutionary algorithms.  HAL0 has gone through rigorous alpha testing and has proven itself to be very robust for alpha code.  Surrounding the HAL0 core are both traditional and proprietary financial heuristic and quantitative investment models.  These models have been transformed into utility functions that plug into the HAL0 optimization engine.  Additionally, there are scripts and add-ons that enable 2-D and 3-D data visualization using standard Open Source tools such as gnuplot.

Beyond the Products:

The software developer:  I have been coding and investing since I was ten years old.  In college (undergrad) I earned a degree in Electrical Engineering with a minor in Computer Science, graduating with a 3.97 GPA.  After my undergrad work I developed electrical engineering software for Hewlett Packard, Agilent Technologies, and Intel Corporation.  I lead software development on a 5-person team that created the “silicon construction” engine used by 200+ engineers in the R&D lab.

While working and HP and Intel, I took graduate-level coursework in both Finance and Electrical Engineering.  During that coursework, my partner and I created software that used EA and heuristic methods to quickly solve difficult non-linear engineering problems.  It was years later, that I realized these methods could be adapted to optimize financial portfolios… using not only classical modern portfolio theory (MPT), but also other methods beyond MPT.

I also manage a proprietary trading fund within Balhiser LLC and have written over 150 investing articles posted at balhiser.com.

Software Infrastructure and Development Model:  There is a crucial difference between undisciplined “coding” and real software development.  Both can create software that works in the present moment.  A structured software development model, however, creates software with a future.

Sigma1’s HAL0 software development environment (SDE) includes a revision control system, software regression tests, unit tests and tailored software testing support  and debug tools.  Some of the regression tests required special effort to work with the (pseudo-random) algorithms used in the software.  Careful use of srand() and rand() calls allows HALo to maintain robust regression testing capability.

Further, a revision history and log, dates back to day 1 of software development.  It charts what bugs were found and how they were fixed.  It explains what tradeoffs were made and why.  The revision history and comments in the software suggest possible improvements.

The HALo SDE makes it much easier to add and test both run-time improvements and new features.  And, it would allow other software developers to more quickly come up to speed on the code.  This would allow new developers to collaborate on or even take over HAL0 software development.

Marketing, Branding, Company Structure:   Currently Sigma1 and HALo IP and assets are held within Balhiser LLC.  Among these assets are approximately 40 registered domain names, about 20 of which are suited towards portfolio optimization software.  My goal is to secure US trademarks on one or more of these names.  Obviously overt disclosure of these would be unwise at this time.

Having learned that building web and social media awareness is not an overnight process, I have begun building that online presence using a variety of avenues, including sigma1.com.  This process in is its early stages, but Googling “Sigma1 Financial Software” or “Financial Software Heuristics” produce page 1 results.

The Business Model — The Sigma1 Financial Software model includes both B2B and B2C components.   The B2B model is centered around leasing the portfolio optimization engine and software add-ons to money managers, institutional investors and/or investment advisers.  The optimization is not limited to portfolios alone, but can also optimize funds and proprietary-trading accounts.  Along with software leasing fees, businesses are likely to require training in the use of software.  Limited training could be negotiated as part of the software lease agreement, however additional training will also be a revenue source.  Finally consulting and custom-feature development may be additional revenue sources to the business.

The B2C component of the business model is currently planned to be completely internet-centric.  A very limited free online version can serve 2 purposes.  1) As a marketing tool to induce users to pay for a full-featured subscription-based model, 2) possibly, as a source of ad revenue.  A full-featured paid-subscription B2C version would be ad-free and feature larger portfolios and greater investment modeling, optimization, and visualization features.

* Product names, logos, brands, and other trademarks featured or referred to within this document are the property of their respective trademark holders.

# New Perspectives on Portfolio Optimization

Building superior investment portfolios is what money managers are paid to do. As a fund manager, I wanted software to help me build superior, positive-alpha portfolios.

Not finding software that did anything like I wanted, I decided to write my own.

When I build or modify a portfolio I start with investment ideas. Ideas like going short BWX (international government debt) and long JNK (US junk bonds). I want some US equity exposure with VTI and some modest buy-write protection through ETB. And I have a few stocks that I believe are likely to outperform the market. What I’d like is portfolio software that will take my list of stocks, ETFs, and other securities and show me the risk/reward trade off for a variety of portfolios comprised of these securities.

Before I get too far ahead of myself, let me explain the above graphic. It uses two measures of risk and a proprietary measure of expected return. The risk measures are 3-year portfolio beta (vs. the S&P500), and sector diversification. This risk measures are transformed into “utility metrics”, which simply means bigger is better. By maximizing utility, risk is minimized.

The risk utility metrics (or heuristics) are set up as follows. 10 is the absolute best score and 0 the worst. In this graph a beta of 1.0 results in a beta “risk metric” of 10. A beta of infinity would result in a beta risk metric of 0. For this simulation, I don’t care about betas less than 1, though they are not excluded. The sector diversification metric measures how closely any portfolio matches sector market-cap weights in the S&P 500. A perfect match scores a 10. The black “X” surrounded by a white circle denotes such a perfectly balanced portfolio. In fact this portfolio is used to seed the construction of the wide range of investment portfolios depicted in the chart.

On thing is immediately clear. Moving away from the relative safety of the 10/10 corner, expected returns increase, from 7.8% up to 15%. Another observation is that the software doesn’t think there is much benefit in increased beta (decreased beta metric) unless sector diversification is also decreased.  [This is the software “talking”, not my opinion, per se.]

The contour lines help visualize the risk tradeoffs (trading beta risk for non-diversification risk) for a particular expected rate of return.  The pink 11% return contour looks almost linear — an outcome I find a bit surprising given the non-linear risk-estimation heuristics used in the modeling.

For all that the graphic shows, there is much it does not.  It does not show the composition or weightings of securities used to build the 100 portfolios whose scores appear.  That data appears in reports produced by the portfolio-tuner software.  The riskiest, but highest expected-return portfolios are heavy in financials and, intriguingly, consumer goods.  More centrally-located portfolios, with expected returns in the 11% range, are over-weighted in the basic materials, services (retail), consumer goods, financial, and technology sectors.

Back to the original theme: desirable features of financial software — particularly portfolio-optimization software.  For discussion, let’s assign the codename HAL0 (HAL zero in homage to HAL 9000) to this portfolio-optimizing software.  I don’t want dime-a-dozen stock/ETF screeners, but I do want software that I can ask “HAL0, help me build a complete portfolio by finding securities that optimally complements this 70% core of securities.”  Or “HAL, let’s create an volatility-optimized portfolio based on this particular list of securities, using my expected rates of return.”  Even, “HAL, forget volatility, standard-deviation, etc, and use my measures of risk and return, and build a choice of portfolios tuned and optimized to these heuristics”.

These are things the alpha version of HAL0 can do today (except for understanding English… you have to speak HAL’s language to pose your requests).  The plot you see was generated from data generated in just under 3 hours on an inexpensive desktop running Linux.  That run used 10,000 iterations of the optimization engine.  However 100 iterations, running in a mere 2 minutes, will produce a solution-space that is nearly identical.

HAL0 supports n-dimensional solution spaces (surfaces, frontiers), though I’ve only tested 2-D and 3-D so far.  The fact that visualizing 4-D data would probably involve an animated 3-D video makes me hesitate.  And preserving “granularity” requires an exponential scaling in time complexity.  Ten data points provides acceptable granularity for a 2-D optimization, 100 data points is acceptable for 3-D, and 1000 data points for 4-D.  Under such conditions the 4-D sim would be a bit more than 10x slower.  If a granularity of 20 is desired, the 3-D sim would be slowed by 4X, and a 4-D optimization by an additional 8X.   I have considered the idea that a 4-D optimization could be used for a short time, say 10 iterations and/or with low granularity (say 8),  and then one of the utility heuristics could be discarded and 3-D optimization (with higher depth and granularity )could continue from there… nothing in the HALo software precludes this.

HAL0 is software built to build portfolios.  It uses algorithms from software my partner and I developed in grad school to solve engineering problems– algorithms that built upon evolutionary algorithms, AI, machine learning and heuristic algorithms.  HAL0 also incorporates ideas and insights that I have had in the intervening 8 years.  Incorporated into its software DNA are features that I find extremely important:  robustness, scalability and extensibility.

Today HAL0 can construct portfolios comprised of stocks, ETFs, and highly-liquid bonds and commodities.   I have not yet figured out a satisfactory way to include options, futures, or assets such as non-negotiable CDs into the optimization engine.  Nor have I implemented multi-threading nor distributed computing, though the software is designed from the ground up to support these scalability features.

HAL0 is in the late alpha-testing phase.  I plan to have a web-based beta-testing model ready by the end of 2012.

Disclaimer:  Do not make adjustments to your investment portfolio without first consulting a registered investment adviser (RIA), CFP or other investment professional.

# Financial Software: Heuristics Explained

## A Baseball Analogy

Imagine you’re the general manager of a Major League ball club.  Your primary job is to construct (and maintain) a team of players  that will win lots of games, while keeping the total player payroll as low as possible.  When considering a hypothetical roster a baseball GM has two primary objectives in mind:

1. Total annual payroll (plus any associated “luxury tax”)
2. Expected season wins (and post-season wins)

These objectives can also be called heuristics — rules of thumb to help find solutions to complex problems.   These heuristics can be turned into numbers (quantified) by creating cost functions or utility functions.  Please don’t let all of this jargon disembolden you; we are merely talking a little baseball here.

The cost function function for payroll is just that… the total annual salaries for a proposed roster.  It is called a cost function because cost is something we are trying to minimize.  Expected wins is called a utility function, because utility is good, and we want to maximize it.

Now, accurately predicting number of wins for a hypothetical (or real) roster of players is a real challenge.  Every scout and adviser is going to have his or her own ideas or heuristics.  Just watch Moneyball to see what I mean.  To turn any given roster into a utility score a GM could write a proposed roster on a whiteboard and point-blank ask each advisory “How many wins will this team produce?”  The GM could average these predictions and, boom!, that’s an utility function.  The GM could also hire a computer scientist and statistician to code up a utility function for any proposed roster relying on a chosen set of stats.

Either way, now the GM has can evaluate any proposed roster based on two metrics: cost and wins.  These data can be plotted, and quickly patterns will emerge.  Some proposed rosters will be both more expensive and less “winning” than others.  These rosters are said to be dominated, and they can be removed from consideration.  Once all the dominated rosters are eliminated, what remains is a series of dots that form a curve.  As one moves up that curve, one finds more winning, but more expensive rosters.  Moving the other way, the payroll cost is less, but the expected wins decrease.  This curve resembles what financial folks call an efficient frontier — the expected risk/reward tradeoff for an optimized portfolio selected from a basket of securities.

## Back to Portfolio Optimization Software

The baseball analogy above tries to explain mathematical concepts without resorting to math.   OK, I did use a few math words, but no equations!

There are several differences between a baseball roster and an investment portfolio.  Key differences from an investment portfolio are:  1) You can own multiple shares of a stock or ETF (but have only 1 of any player),  2) You can trade stocks/ETFs virtually whenever you want.

Nonetheless, the baseball analogy is useful in illustrating what Sigma1 Software will be able to do for fund managers and investors.  Instead of building a baseball roster, you are building an investment portfolio.  In the classic “CAPM” investing model, the cost function is standard deviation (risk), and the utility function is expected returnHistorical standard deviation is easy to compute, but expected return is much harder to accurately compute.

Now, if you are an active fund manager, you probably have in-house analysts paid to help you pick stocks (just like GM’s have scouts).  But scouting reports from analysts do not a portfolio make… even if your analysts are giving you positive-alpha stock picks. A robust asset allocation strategy is necessary to build a robust portfolio out of your chosen list of securities.

## The Vision for Sigma1 Portfolio Software

#### A Vision for Financial Professionals

It started with the desire to create software that would allow me to build a better portfolio for my proprietary trading fund — Software that could optimize portfolios using heuristics, cost functions, and utility functions of my own choosing.   I wanted to create portfolio software for investment managers that:

• Allows them to select their own list of securities (or chosen dynamically from all investable securities)
• Takes advantage of one or more “seed portfolios” if desired
• Allows proprietary heuristics, cost functions, market models, etc. to plug seamlessly into the optimization engine
• Isn’t limited to linear or Gaussian risk-analysis measures
• Runs in minutes or hours, not days
• Is capable of efficiently utilizing distributed and parallel computing resources — Scalability

#### A Vision for “Retail” Investors

For retail investors, the general investing public, I envision scaled-down versions of the professional portfolio optimization software.  The retail investor software will run as an application on a web server.  A free version will provide portfolio optimization for a small basket of user-chosen securities, perhaps limiting portfolio size to 10.   A paid-subscription plan will offer more features and allow retail users to build larger portfolios.

To keep the software easy to use, a variety of ready-to-use heuristics will be available.  These are likely to include:

• Standard deviation
• Historic best-year and worst-year analysis
• Beta (versus common indices)
• Diversification measures (e.g. sector, market-cap)
• Price-to-earnings
• Proprietary expected-return predictors

Personally the easiest part of the financial software business is software development.  I have been involved with sales before and feel reasonably confident about this aspect of the business.  The primary challenge for me is marketing.

Sales is a face-to-face process.  Software development is either a solo process or a collaborative process usually involving a small group of developers.  Marketing is very different.  It is a one-to-many (or few-to-many) situation.  Striking a chord with the “many” is a perpetual challenge because the feedback is indirect and slow.  With marketing, I miss the face-to-face feedback and real-time personal interaction.

Knowing that marketing is not my strongest point, I have put extra effort into SEO, SEM, social media, and web marketing.  Over the past couple weeks I have purchased about 20 new domains.  Market and entrepreneurial research has shown me that a good idea, a good product, and a good domain name are not sufficient to achieve my business goals.  I realize that solid branding and trademarks are also important.

As a holder of 4 U.S. patents, I understand the importance of IP protection.  However, I am ideologically opposed to patents on software, algorithms, and “business processes.”   Therefore I feel that I must focus on branding, trademark protection, trade-secret protection, and copyright protection.

My redoubled marketing efforts have been exhausting and I hope they will pay off.  Next I plan to get back to software creation and refinement.

# Portfolio Software: Day 8

Software development seems to inevitably take longer than scheduled.  I thought I’d have a working alpha model by “Day 4”, but it took me until “Day 7”.  Happily, yesterday my program produced its first algorithmically-generated portfolios.  These portfolios were generated from a small “universe” of stocks optimized using simple heuristics.  To test my new algorithm, I designed the two extremes of the search-space to have known solutions.  The solutions between the extremes along the test efficient frontier, however, have no obvious closed-form solutions.  One of the two trial portfolio heuristics is, by design, extremely non-linear as well as non-monotonic.

So far, on relatively small data sets, the run time is very good.  This is despite being coded in an interpreted language, and code that contains several known inefficiencies (such as repeating heuristic computations repeatedly on the same portfolio… caching will solve this particular issue).  I am now well positioned to begin refining the algorithms’ parameters and heuristics as well as to make run time improvement.

I have taken care, and extra time to build extensibility and testability (and of course revision control) into my Linux-based software development environment.  For example the portfolio software supports n-dimensions of analysis heuristics, not just 2 or 3.  Additionally the security selection space has no built-in limits.  Selecting from all listed, investable securities available on Earth is possible.  So long as the portfolio population is constrained (to say <= 100), the investable securities list can be very large.  Similarly, portfolios can contain many securities (1000+) without significant slow-down.

Regression testing can be a bit of a challenge with rand() being part of the of algorithm.  However srand() is very, very helpful in creating targeted software regression tests.  So far, I’ve been able to maintain regression-based testability for the entire program.

I also set aside some SEO, SEM, social media time on this project.  While the SEO and SEM efforts are very tedious, they are critical to building market awareness.  The social media aspect is somewhat more fun, and occasionally pays dividends that extend beyond the potential marketing benefits.

All in all I am relatively happy with the progress to date.  Sigma1 now has working, readable, extensible code for portfolio optimization.  The current software is pre-alpha, and very likely to have undiscovered bugs and numerous opportunities for efficiency and rate-of-convergence improvement.  At least I believe the code has arrived at the initial proof of concept stage.  This is only the “end of the beginning”.   Much work remains to improve the golden (Ruby) version of the software.  Once the Ruby code has sufficiently “gelled”, then begins the task of duplicating it with a C/C++ version.  I intend to refine both the Ruby and C/C++ versions so that they produce identical results in regression.   This will be a tedious process, but is extremely likely to find and squash subtle bugs.

# Portfolio Software Development: Day 3

## Portfolio Software: Plain English

Yesterday I wrote an early version of financial software to help users improve their investing portfolios.  This software has the ability to solve financial problems in a very different way than taught in graduate-level finance classes.   Rather than relying solely on a type of mathematics called statistical analysis, Sigma1 software uses techniques from computer science called artificial intelligence or AI.  (I prefer the term machine intelligence because there is nothing artificial about the intelligence results produced by a solid AI algorithm.  If you doubt this, I challenge you to beat Chessmaster 11 running on your PC… on max difficulty.)

My idea has been to develop a sophisticated program that would allow institutional investors such as fund managers to  “plug in” their proprietary valuation models and come up with solid portfolios in minutes or hours, rather than days or weeks using brute-force techniques.    As I was working, I realized that smaller “normal” investors could also benefit from a simplified version of Sigma1 software.

Rather than sell this lite version of portfolio-opt software I may provide a free version on a website.  The free version would have limitations on both the number of securities and the “depth” of analysis and reporting.  For example the user may only be able to enter a maximum of 20 securities in their current (or proposed) starting portfolio.  The free web version would quickly suggest an asset-allocation mix of those securities that is (potentially) safer with the same expected return or (potentially) equally safe with a higher expected return.

If the free web version is popular enough, Sigma1 may introduce a paid web subscription service that allows a larger portfolio, a wider selection of securities, more detailed reports and even sample portfolios to “blend” with the investor’s favorite tickers.

Even after the free web version is released, I plan to refine the advanced institutional version of the software.  I plan to use it to improve the composition of the Sigma1 proprietary trading fund.  I also intend to develop a world-class product that institutional investors will want to have access to… for a very reasonable price.

At this time I have zero interest in sharing the source code or specific concepts underlying the current and future Sigma1 software.  Many of these ideas stem from work in my undergrad engineering and computer science studies.  They have developed in my graduate work in finance and engineering.   The realization that the techniques I have developed for engineering, game-theory, poker and number theory apply most directly to portfolio construction and optimization hints at the possibility that I have hit upon one of those rare ideas that strike gold.  Not academic gold; real “gold” with real financial value.

I love academic research and open-source software.  I don’t intend to keep the concepts and code that Sigma1 is developing locked up forever.  If the Sigma1 financial software is financially successful enough, I hope to release pieces of it to the open-source community over time.  (Conversely, if the software does  not ultimately find a lucrative market, I will eventually release it too 🙂 )

## Portfolio Optimization Software: Tech Speak

Yesterday I wrote the key pieces of an algorithm to build and optimize securities portfolios.   The remaining pieces: heuristics and selection should be relatively easy to code.   The coding and testing was very quick  1) because I’ve written similar optimizers many times before, 2) because I had 2 days to think about it as I was driving and 3) because I wrote it in Ruby.

Based on previous experience (and depending on the complexity of the heuristics), run-times should be swift for portfolios of 500 securities or less. In previous research I’ve been able to use distributed computing when the heuristics/analysis dominated run-time.  Generally the optimizer has not been the limiting factor for speed.

I plan to start with relatively simple heuristics to test the portfolio-optimization software.  Likely the first test will merely compute the (near-optimal) efficient frontier for a basket of securities, plotting 3-year standard deviation of various portfolios on the frontier versus expected return.  If I wish I may even compare the results to efficient frontiers constructed with classic methods using covariance matrices.

Once I create a Ruby prototype I plan to re-code the software in C/C++, both for execution speed and for the relative IP-protection provided by releasing only compiled binary executables.

# Sigma1 Financial Software: Development Begins

I started Sigma1 with \$35,000 in seed capital, a Linux workstation and a domain name I acquired in auction for \$760.  The original plan was to create a revolutionary hedge fund with accredited investors as clients.  I started studying for the Series 65 exam and all went well until I started reading about securities laws and various legal case studies.  I gradually realized two things:

1. U.S. Securities Law is very restrictive, even for “lightly regulated” hedge funds
2. The legal start-up costs for a hedge fund were much higher than I anticipated

The first realization was the most devastating to my plans.  The innovative fee structure I wished to use was likely to face serious legal challenges to implement. Without a revolutionary fee structure, more favorable to clients, the Sigma1 Fund would be hard to differentiate from the hundreds of other funds already available.

The second objective of Sigma1 has been to develop proprietary financial software.  Until now the Sigma1 Proprietary Trading Fund has been constructed based on research, pencil-and-paper securities analysis and some rudimentary Excel simulations.  Some quantitative analysis has been applied, but without the mathematical rigor I prefer.   That is about to change.

I recently devised a way to apply techniques developed while studying Electrical Engineering and Finance in grad school.  In a nutshell, I will apply evolutionary algorithms to optimize portfolio construction.  The same fundamental techniques my electrical engineering colleagues and I used to explore and optimize around the random perturbations inherent in fabricated silicon circuits can be used to optimize portfolios by efficiently exploiting conventional (linear) and unconventional (non-linear) correlations between diverse assets.

I have sequestered myself in a beautiful, tranquil location while on a well-earned sabbatical from work.  While evolutionary algorithms will be a significant part of the software suite I will develop, I also intend to incorporate heuristics and machine-learning techniques as well.  Similarly I intend to use techniques from CAPM such as efficient-frontiers, but only as a first-order guide.  Many of the limitations of CAPM (and Fama-French enhancements thereof) consist on their intrinsic reliance on Gaussian or “normal-distribution” statistical models.  Such models do not properly model long-tail events, nor asymmetrical distributions, nor even log-normal distributions.  Classic CAPM models even struggle with geometric-mean of expected or passed returns and generally use arithmetic means to preserve the use of linear systems analysis.  Heuristic algorithms and other AI techniques need not use such assumptions as a mathematical crutch.   The software I intend to develop should be able to find near-optimal solutions to financial problems that classic statistical methods “solve” only by making grossly inaccurate assumptions about probability distributions.

My intention is to develop one or more software products for fund managers that will aid in portfolio analysis, construction and refinement.

# Wall Street Interview

Years ago, a successful friend of mine was telling me stories about his early Wall Street interviews with a big-name investing house.   One stood out to me.   The question:

If you had to invest \$1,000,000 for a client, and your had only two choices, which would you choose?   (A) “Invest” the whole \$1,000,000 on red or black at the roulette wheel.  (B) “Invest” on red or black \$1000 at a time, one thousand times.

My friend said he knew the right answer, to that question and most of the others.  I believe he was offered this particular job, but declined it in lieu of better offers elsewhere.  Anyhow, he asked what my answer would be.

I said (B).  If single zero roulette, the client can expect to lose on 1/37 (about 2.7%);  if double zero, 2/38 or about 5.3%.   My friend said, sorry, wrong answer.  If you lose money for a high-net-worth client, even 2.7%, they are likely to be disappointed and take their business elsewhere.  If you double their money, a roughly 50/50 proposition, you will have an ecstatic client who will stick their \$2,000,000 with you for years.  If you lose their whole \$1,000,000 they will be disappointed and walk away, but “them’s the breaks.”

This story resonates with me to this day.  This is an absurd question from a financial standpoint, but it is a powerful question on ethics.  The business rationale behind answer (A) is valid.  However, I chose to work for a company where the correct answer is (B).