Tuesday, December 25, 2007

Year End Investment Roundup

At the end of each year I take some time out to assess how my investments are performing and make some changes based on the latest outlook. Writing this down helps me understand what I did right and wrong and see if the arguments for new investment positions ring true. In the past I've exchanged these opinion pieces via email with friends who also invest, but this year I thought I'll blog it so everyone can see each other's comments. Most of the ideas below are derived from friends and well known investors such as Jim Rogers, Barry Rithotz, and others. Check out Barry's blog for a great source of data.


This year has been full of some well anticipated drama in the financial and housing sectors. I began shorting builder stocks in late 2005, building supply in 2006, and financials in early 2007. I was too early on the builder stocks and experienced a good deal of pain initially - most of these positions hit the stop losses I put in place on all shorts and the positions were undone. In 2006 I put in place a new set of builder shorts, this time concentrating on the weaker builders - those with poor momentum, profitability and high debt such as SPF. This worked out well because the weaker builders didn't rise with the pack and started their decline early. The two main building related shorts I put in place declined 80% and 50% respectively. Unfortunately I didn't replicate the size of the initial position. The lesson is that I need to increase the size of my positions generally, particularly when the outcome is so certain. I've found that I'm usually right about the long term direction of macroeconomic outcomes but usually early on the timing. To actually make substantive money shorting, this means I need to wait until both the sector and the stocks themselves are in decline before shorting. Since its hard to spot a trend in the first few weeks, I have to expect to place the bet several times after being undone by a stop loss without losing confidence and decreasing the size of the position. In fact I need to do the opposite - increase the size of the position with time as with time I know I'm closer to the expected outcome. Nothing new here - this short technique is well covered in the 1923 classic Reminiscences of a Stock Operator by Edwin Lefevre.

My long positions have done somewhat better. The energy and emerging market positions I took in the last few years did really well. Some of the best were Eastern Europe fund EUROX, Indian banks IBN and HDB (thanks to Gary Bhatia for those picks), Indian fund IIF, and in energy XOM and KMP. I was underexposed to China - my one China related fund WBIGX returned 23% annually over the last 5 years but underperformed the Chinese indexes substantially. Given how predictably poor the performance of US stock markets has been over the last years relative to most international markets, I should have taken larger international positions and reduced the size of my US long positions.

In late 2004 I put a good deal of money into the Yen and the Japanese Nikkie Index on the theory that the fundamentals in Japan were turning around after a 20 year slump. This investment did well for about a year and then flatlined. Some of the fundamentals still look good - the financial sector is deregulating, Toyota, Honda, and others are doing well, and the saving rate is so high that a slight shift in domestic sentiment in favor of stocks could easily double the market there. Most Japanese savings are in cash and government bonds earning very low yields. On the negative side, the population is much older than emerging markets and continues to get older, which can preclude aggressive investment. What's lacking is the "animal spirits" to revive domestic interest in the market - it may take another 5-10 years before a new generation that doesn't remember the debacle of 1992-2000 takes over. I'm interested in what you guys think on this one - I may be early, or just wrong.

Long Term Outlook (10 years)

Viewed both from a fundamental and a technical standpoint, I believe the outlook for most US based asset classes (stock, bond, residential real estate) is bleak and rapidly worsening. The dollar is dramatically overvalued given our gigantic current account deficits. Foreign governments control the US exchange rate, and they are slowly but surely diversifying away from the dollar. The dollar is in the middle of a multi year decline against virtually all other currencies, so this is merely an observation of well established trend. In a recent Bloomberg interview, Jim Rogers who made a bundle predicting earlier currency and commodity trends, said he is moving all his assets out of the US dollar into yen, renminbi and swiss francs. To quote "The US dollar is and has been the world's reserve currency. That's in the process of changing. The pound sterling, which used to be the world's reserve currency, lost 80% of its value as it went through the process of losing its status as the world's reserve currency." Rogers expects the renminbi to triple or quadruple over the next decade.

The historical engine of US growth - government investment in academia and places like Bell Labs, has lagged GDP growth and real inflation over the last 15 years. Note that in the link, official BLS inflation figures are used to compute constant dollar outlay. As discussed elsewhere in this post, these numbers significantly understate real inflation. Many people assume this slack will be taken up by private investors like VCs, but if you've ever raised money for a startup you know that VCs don't knowingly invest in anything that has a payout of longer than 5 years. Most technologies have payouts in the 10-20 year range. If you took a look at where the innovation is happening in key fields like software, biotech, and energy most of it was US based 10 years ago, now I'd say more than half is outside the US. Silicon Valley remains the best place in the world for productizing technology but its only a matter of time before other parts of the world build the investment infrastructure to replicate it.

US based assets like residential real estate and stocks are overvalued when compared to fundamentals and international comparables. In hot markets, the full cost buying a house is almost double the cost of renting one, and home ownership rates are well above historical averages. We now know why this occurred - lose lending standards and investment driven buying. Both these underlying causes have reversed themselves.

Looking at stocks, P/Es for US stocks may seem low compared to Chinese or Indian stocks. China and India together have population about 6x that of the US. Yes they're mostly poor, but that's changing fast - if only 30% of their population moves into the middle class they will each equal the whole population of the US. In the next 10-20 years we should expect that each of these economies by themselves will be bigger in GDP terms than the US. This may seem like a shocking prediction, but if we compare China to say Taiwan, Korea, or Japan of 1946 there are many similarities - an educated and motivated population, a government committed to building economic advantage, and lots of cheap labor. Those economies grew several thousand percent in GDP and stock index terms in 20 years. The difference is that China has 10x the population of the current #2 GDP country - Japan. So most Chinese and Indian stocks should be viewed as growth stocks, with 1000%+ growth likely over the next decades. Taking up the issue of comparative P/E again, when evaluating a growth stock, P/E is largely irrelevant. PEG, Sales growth, competitive advantage, and size of market are better indicators. Throw in the likelyhood of a 20% or more dollar decline over the next few years and there's no likely scenario where US stock indices outperform China or Indian stock indices over the next 20 years. All the verbiage above is just reason to expect the trend over the last 5 years to continue - see this chart at the bottom of the page to compare what various international sectors have done.

Looking at US bonds, the decision is even easier - who wants to get a 5-10% return in a currency that is declining and an inflation rate that is well above the yield? For those of you that believe that inflation is low, read this - the CPI numbers you hear about in the news are just plain wrong. Its tough to get an accurate number since the government misreports it, but just think about how much the major components of what you buy - housing, gas, food have gone up and its easy to see that holding a bond at 6% is losing money, even before you factor in the likelyhood of higher future inflation and thus a decline in the price of the bond.

Based on the above, I've sold most of my US based stock and all my bond investments in favor of investing primarily in stocks and currencies in China, India, Brazil, and Eastern Europe. I'm holding the stocks and funds listed earlier and waiting for a dip before loading up on more Chinese and Indian investments. When the dip occurs, I'm considering financial sector investments in these countries that benefit from protectionism and gain from overall GDP growth. China Life (LFC), a major insurer is one idea, I'm looking for more. The recent concentration of miners in the commodities markets also make for monopoly profit potential - BHP and Rio Tinto. I'd also like to find some good agricultural commodity plays, but haven't found any yet - let me know if you have any ideas. There's RJA but its not very liquid. I will also buy into the major indexes of each country when the dip occurs using ETFs.

In addition to the now well known Chinese and Indian growth stories, there are other smaller and riskier countries whose indexes have gotten hot recently - Vietnam, Turkey, Saudi Arabia, etc. Several of these smaller markets have experience big run ups in the last year. I'm less optimistic about the long term prospects for these markets because they lack the vast supply of cheap labor and economies of scale that can accrue to large economies. However since some of them are rising from tiny bases, there may be some good short term opportunities among them. Frankly I just don't know enough to warrant placing any bets. Any ideas readers?

The few US based long positions I hold are stocks that do well in high inflation environments, have big technology advantages, have substantial foreign revenue, and/or gain with commodity prices. XOM, GOOG, Apple, and KMP fit the bill.

Near Term Outlook (1 year)
Volatility can be your friend or your enemy. Many US based investment pundits still position emerging market stocks as risky investments. From the above you can probably see that in the long term, I think US based stocks are much more risky. The volatility of Chinese and Indian stocks is what you want to get big gains. However in the short term, 10% daily swings in price can be unnerving. For money you want to use for other purposes inside of 7-10 years, the hot markets of India and China are risky. I have a bucket of money, about half my portfolio in various tax exempt and foreign accounts that I have no plans to use before retirement, at least 20 years away. 100% of that is going into long positions in foreign markets and currencies. However the other half of my portfolio which I plan to use to buy a house in the next year is mostly in cash and US based short positions. Why? Because there's high likelyhood of a significant decline in global markets in the next year. The US is at the end of the typical 4 year investment cycle, and foreign markets have seen huge gains in the last few years - the probability of a pullback is increasing. If the US goes into recession there will be a mild global short term pullback, probably a good buying opportunity internationally.

So what about those shorts? The banks, the builders, the building suppliers, the mortgage bankers have all seen dramatic declines already. I've closed out shorts on SPF, RSTO, and CFC after 50-80% declines. I'm considering shorting Citi and maybe some of the mortgage insurers, even though they are all well down already. The bet is that the housing market will continue to decline (likely) and there are some real bankruptcy potentials for the financials that have big exposure (less likely but possible). A better bet might be to identify areas that are lagging correlates to housing, like consumer retail spending, but I haven't had a chance to determine what the best areas are. Any ideas would be appreciated.

An area I'm currently shorting is the NASDAQ. In past US downturns we've seen the NASDAQ take a big hit, because corporate technology purchases are partially discretionary spending, and partly due to P/E compression on the many high tech story stocks. This time the NASDAQ is less overheated than last time, however the contraction in spending will still occur. There's also another force at work that may damage the major tech companies like Oracle, Microsoft, NTAP, EMC, IBM and others. That force is open source software and a new architecture for web based software. A survey I recently completed of 30 top Web companies like Google and Facebook shows that web companies have largely abandoned the hardware and software sold by the US tech majors in favor of internally built software based on open source software and commodity hardware. In addition, I'm seeing the leading edge of small business - startups - begin to adopt web based software instead of Microsoft's desktop and server software - think Google (and Yahoo) apps for small business. For the last few months I've been using Google Apps for small biz side by side with Microsoft's latest desktop apps and OS and find that the Google stuff is dramatically superior in most respects. Eventually this new architecture will spill over the early adopter parts in the enterprise, cutting off the major's primary source of profits. A recession just might be the trigger to force a architecture reevaluation, particularly in the hard hit banking/investment sector that have been tech early adopters.

I'm looking forward to hearing what you think.

Tuesday, November 27, 2007

Best IDE for Rails on Linux

Recently I went shopping for a new IDE. I was developing on a 1GB Linux machine using the Aptana packaging of RadRails on top of Eclipse. A new Aptana release came out that pushed the RAM usage past 1GB. I was also getting increasingly annoyed at RadRails - autocompletion was more of a hindrance than a help, search was poorly designed, and weird behavior resulted on long lines. Nevertheless the level of Rails and Ruby integration was nice - there was no going back to VIM.

My trip to the Google open source shopping mall yielded a few positive reviews of the Netbeans IDE Beta 2. I installed it and there's no going back. After about a week of usage I'm still exploring NetBeans functionality so there may be some things I'm missing, but here's what I like about Netbeans so far:

1. Autocompletion works. For rhtml, for ruby, for css. It helps rather than gets in the way.
2. Long lines, no problem
3. Still a memory hog, but uses less RAM than Eclipse.
4. Easier to install than Aptana/Eclipse/Radrails
5. Support for in-IDE Mongrel execution, log display and debugging.
6. Most of the stuff you want in an IDE, if somewhat less than Eclipse. Most of the Rails specific functionality is presented when you right click the name of a project in the left hand navigation bar. Plugin installation, subversion integration, etc. lives here. I haven't tested any of this yet because I usually use the command line, but its there if you need it.

There was only one gotcha so far. The 1GB Linux machine was running Redhat ES 4, a two year old version. For some reason the fonts in Netbeans were screwed up on that machine, but not on my other Fedora 7 machine. So I switched machines and coded happily ever after.

You can download the ruby version of netbeans here.

Thursday, September 27, 2007

Compare yourself to open source, not proprietary offerings

I often hear from enterprise IT focused startups that one of the reasons they are going to be successful is that they will have a lower price than [name of top vendor in their product class]. This is very tempting today because its easy to use commodity hardware, put some software on top, and sell it with healthy margins way below what the larger enterprise server/software/networking/storage vendors do.

Unfortunately these types of product plans usually fail for two reasons. First, using commodity hardware isn't a cost advantage, since its available to anyone. You'll have competition at that lower price point, lots of it.

The second reason is open source and advertising supported online services. Its increasingly hard to find product categories that are not addressed by one or both. To beat free you need to have functionality that people prefer. If you're free too, well you still need to have functionality that people prefer.

If you're reading this and you're from a web company or have experience with open source, all this will seem obvious to you, but judging from the list of recently funded startups, there are many entrepreneurs and VCs that haven't grokked it yet. If you come from the enterprise IT world, either as a vendor or a customer, you might look around at the enterprise's Microsoft .NET web infrastructure, their Oracle database, their EMC storage, and think that open source is just a cute toy used only by the long hairs. The problem is that today the enterprise is a late adopter - not a good indicator of where opportunity lies for startups. The late adopters aren't going to buy your widget because you don't have 50 site references, integration with their legacy stuff, or a sales force that can take them on boondoggles to Pebble Beach. So you have to be able to beat the open source or free online competitor used by the early adopters. The early adopters are other startups, government research labs, academia, and web companies. And the software stack for early adopters is rapidly converging on 100% open source, with whatever they've developed in-house layered on top. On the hardware side, its getting harder and harder to find proprietary stuff beyond Intel servers, SATA disk, and a few routers and load balancers.

So if the product segment you're targeting has open source (or free online) competitors, compare yourself in terms of price performance to the open source solutions, not to the proprietary stuff that the late adopters are buying. Does this mean you have to be open source as well? Maybe. Open source conveys so many benefits beyond price that early adopters now prefer it because of superior (and free) support from the community of users, ease of customization, performance, and quality. If your widget is an order of magnitude better on a dimension critical to users, you might overcome these advantages despite being proprietary, but you better be really sure users value your product.

How to determine if your product will sell, part 1

Over the last two years I've consulted with a number of startups, sometimes helping them launch products, sometimes writing product plans, sometimes helping them raise funding. I've also looked at over three dozen product plans either via interviewing or competitive analysis. Most of these companies are founded by people smarter than me with Ph.D.s from fancy computer science departments.

Despite the quality of the teams, I've found that many startups seem to miss one fundamental principle. That is that the product has to deliver value that a customer cares about. Seems pretty obvious huh? Unfortunately I'd say about half the startups are working on products that don't deliver any value that a customer cares about. Even after they test the product with customers or launch the product and get minimal adoption these startups continue on, sometimes for years, with the same product plan. Hope springs eternal, perhaps because the entrepreneurial bias towards optimism clouds a frank analysis.

Determining value is not rocket science - do some focus groups, test the product yourself, compare the product to competitive solutions. One source of the confusion seems to come from how to measure "value to the customer." Something that I see often is the customer is asked "Do you want X?", where X is a feature that is unique to the product the startup is working on. The customer usually says yes, because more is better. This yes is taken as proof that the product plan is a winner, if only [fill in obstacle of the month].

So how do you measure value? Obviously adoption is one clue, but usually we need some indication early on when designing the product. The thought process I use is

                differentiation x customer's problem rank
value =    ______________________________

                  relative price

Differentiation is the feature set unique to your product - presumably these features solve one or more customer problems. Customer problem rank is the priority of the problems the product addresses. For example, if you're selling a product that solves three minor annoyances near the bottom of the customer's priority list, chances are your product will not be noticed. On the other hand if it solves the top priority, chances are your product will be purchased. Relative price is the price of the product, compared to both competitors and to substitutes.

Again the above seems pretty simple, but most of the time these components are not accurately grasped. To measure the priority of the problems the product solves you really have to understand the entire environment the product is used in. Maybe you're selling a new type of ethernet router which is undeniably faster than every other router. But the customer won't buy it if their bottleneck is in the server.

To address this I explicitly ask the customer what their problem ranking is at the start of every customer interview. Not just about the category of products I'm working on, but overall. If the customer says something vague like "Its important", don't take it as a given that the benefit is high on their priority list. For an item to be high on the priority list two things are usually true:

1. There has to be a visible monetary benefit to the customer that will substantially impact their business bottom line. Dollars saved or dollars earned. This is of course an business focused question - for consumer goods, there are other considerations.

2. Ask the customer where they would use the product. If the customer is really interested in your product, they will immediately begin thinking about this anyway. If they aren't thinking about it, they're probably not serious. This question will also help identify dependencies and integration points that can make or break your product.

Often product categories go through adoption cycles that may last years - during the 90's enterprises and ISPs were buying routers like hotcakes because the router was a bottleneck. The faster router could win the deal, but after a while, the category ceases to grow, the vendor list shortens to two or three, and upstarts won't get much traction regardless of how differentiated their product is because the customer simply doesn't have any issue with that category of products. If your startup is working in a category like this, you either have to be an order of magnitude cheaper, or you should consider a different market.

Since price is often a differentiator claimed by startups, I'll address price in a future post.

Wednesday, September 26, 2007

Synchronous Communication + Profiles + ?

The last few months I've been working on a Facebook application that brings together some ideas that seem under-developed on the web. The idea combines synchronous communication with Facebook (or MySpace) profiles, a people matching algorithm, and a variable fourth element. The fourth element defines the "for what" interaction between the people.

One example of this idea is a "web presence" application that works with a browser plugin. The plugin detects the URL you're browsing at any given time, and it finds other people who are browsing that same URL. It then creates a toolbar on one side of your browser and shows you the profile pictures and names of other people browsing the same URL. If there are many users on the same URL, it employs a matching algorithm to show only those who have similar interests. Where does it get the pictures, names and interests? The Facebook API.

So if you're single and watching a video on YouTube, you might see a cute woman's picture come up on the toolbar, you click her image, send her an IM and/or the IM client will setup a 1-1 audio and video link between the two of you so you can talk about the video. Much like meeting someone at a party. The matching algorithm ensures that you only meet people in your geography, age, and interest group. On a more serious note, maybe you're reading your favorite programmer's blog, and you see the name of another programmer reading the same blog post about Rails fragment caching techniques. You click on his image an initiate a conversation about solving similar problems on your respective projects.

There are several sites and plugins that do part of what I just described. Weblin and Peeko Chat do some of what I just described, but don't integrate the essential element of existing Facebook profiles. These are key for two reasons - first Facebook provides a potentially viral distribution mechanism, and second the application is just anonymous chat without it, which just not interesting. On the other hand, most of the IM clients like MSN Messenger and Skype enable synchronous communication but you can only talk to people whose screen names you know, not strangers who share the same interests. These clients also have a laborious contact -add procedure, so are not good for spontaneous conversations with people you don't know.

Social networking sites are growing like weeds around us, but few leverage real time two way interaction - sites like facebook, digg, youtube are all about asynchronous exchange of information. Asynchronous interaction is somewhat of a legacy of inadequate technology - we humans tend to prefer real time interaction and real time gratification, so its safe to predict that the general concept will see adoption. One example is sites like http://www.crunchbase.com/company/woome who are making online dating a real time application.

Given that the backend infrastructure for live 1-1 video, audio, and chat is non-trivial and applicable to many types of sites, this also means that offering a turnkey backend infrastructure as a service might be a good idea.

Anyone interested?

Tuesday, September 4, 2007

Rails Restful Routes for Facebook

So you start a new Ruby on Rails application specifically for Facebook. You want to hang with the cool kids, so you're using RESTful routes, but you find out that all facebook callbacks are POSTs, which doesn't work with the default Rails RESTful routes because the default paths rely on the full vocabulary of HTTP verbs to disambiguate actions.

To address this I first tried using resources options such as

:member => { :edit => :post }

This added the needed routes based on POST, but left the url helpers creating GETs. So instead I went with named routes, creating a new set of url helpers prefixed with the name of the action. All the helpers except index act on and thus refer to the singular resource. I googled around for an example specific to facebook with no luck, so the below might save someone some time. Lets say you have a users class, and each user has_many gifts. To setup the users class to work with facebook, put this in routes.rb:

map.with_options :controller => 'users' do |user|
user.new_user 'users/new', :action => 'new', :conditions => { :method => :post }
user.index_users 'users/index', :action => 'index', :conditions => { :method => :post }
user.show_user 'users/:id/show', :action => 'show', :id => /\d+/, :conditions => { :method => :post }
user.create_user 'users/create', :action => 'create', :conditions => { :method => :post }
user.edit_user 'users/:id/edit', :action => 'edit', :id => /\d+/, :conditions => { :method => :post }
user.update_user 'users/:id/update', :action => 'update', :id => /\d+/, :conditions => { :method => :post }
user.destroy_user 'users/:id/destroy', :action => 'destroy', :id => /\d+/, :conditions => { :method => :post }

Next, you want routes for gifts, nested with users, so add this:

map.with_options :controller => 'gift' do |gift|

gift.new_gift 'users/:user_id/gift/new', :action => 'new', :user_id => /\d+/, :conditions => { :method => :post }

gift.index_gift 'users/:user_id/gift/index', :action => 'index', :user_id => /\d+/, :conditions => { :method => :post }

gift.show_gift 'users/:user_id/gift/:id/show', :action => 'show', :user_id => /\d+/, :id => /\d+/, :conditions => { :method => :post }

gift.create_gift 'users/:user_id/gift/create', :action => 'create', :user_id => /\d+/, :conditions => { :method => :post }

gift.edit_gift 'users/:user_id/gift/:id/edit', :action => 'edit', :user_id => /\d+/, :id => /\d+/, :conditions => { :method => :post }

gift.update_gift 'users/:user_id/gift/:id/update', :action => 'update', :user_id => /\d+/, :id => /\d+/, :conditions => { :method => :post }

gift.destroy_gift 'users/:user_id/gift/:id/destroy', :action => 'destroy', :user_id => /\d+/, :id => /\d+/, :conditions => { :method => :post }


Run 'sake routes' to see the routes produced. Nice.