Week In Review 06/25/2017

MSCI includes Chinese stocks in its global index

  • Reuters on China’s poor corporate governance: China ranks ninth out of 11 Asian economies for corporate governance, according to the ACGA. Its overall scores have declined since 2014.
  • FT on the market’s reaction to the decision: “MSCI’s move means mainland equities, known as A-shares, will next year be included in its flagship emerging markets index, obliging the estimated $1.6tn of investment funds that track the index to buy the stocks.”
  • Fortune on the stocks included: “In total, those 222 companies are worth $3.8 trillion in combined market value, but will account for a mere 0.7% of the MSCI’s emerging market index.”

Continue reading “Week In Review 06/25/2017”

Programming #10: AI Sudoku

Sudoku is one of those NP-Complete problems that brute force solutions have a problem with. Consider a board with a single blank space, we would have to work through 9 possibilities to find the right answer. For two blank spaces, we would work through 9 possibilities for the first space, and then for each of those possibilities, 9 for the second.

This simplifies to a time complexity of O(n^m) where n is the number of possibilities for each square (9 in normal Sudoku) and m is the number of blank spaces. A hard Sudoku problem with 50 blank spaces would take about 5.15 * 1047 computations, which would take longer than the age of the universe to solve with a decent computer.

This is where artificial intelligence (AI) comes into play. Think of AI less as a Skynet robot and more as a set of hacks to solve exponential problems like Sudoku. Code for this post can be found here.
Continue reading “Programming #10: AI Sudoku”

Week In Review 06/18/2017

Fed Raises Rates

  • From 1.00 percent to 1.25 percent: The Fed also gave a first clear outline on its plan to reduce its $4.2 trillion portfolio of Treasury bonds and mortgage-backed securities, most of which were purchased in the wake of the 2007-2009 financial crisis and recession.”
  • Neel Kashkari continues to dissent: “In short, the economy is sending mixed signals: a tight labor market and weakening inflation.”

Continue reading “Week In Review 06/18/2017”

Investment Theory #21: Klarman’s 1999 Letter

I’ve been awol while studying for the CFA. With level 3 hopefully behind me, I’m going to get back into the habit of writing. Let’s jump back into our series on the 1990’s with Seth Klarman’s letters as our guide to the period.

Klarman is a well-respected value investor who founded the Baupost Group in 1982. Since then he has generated an average annual return of 19%. Klarman’s investing philosophy can be summed up by the title of his book Margin of Safety: Risk-Averse Value Investing Strategies for the Thoughtful Investor.

This series of posts will reflect on Klarman’s activity during the period 1995 to 2001. Links to past posts: 1995, 1996, 1997, 1998

Continue reading “Investment Theory #21: Klarman’s 1999 Letter”

Human Nature #19: Hedonic Adaptation

Imagine you’re on vacation in some exotic tropical location. You relax on the beach and take in the amazing view. The next day, you do the same but find it isn’t as amazing as the first day – so you add some aged scotch to the equation and like magic the feeling is back. Same thing the next day, but this time you add a cigar, or a massage, or something else to boost the experience. Each day, the same thing. That great feeling you are searching for requires more and more just to stay the same.

Everything is amazing and nobody is happy. The brilliant Louis CK bit on the subject goes something like this: “I was sitting on an airplane that had high-speed internet – the newest thing. It breaks down shortly into the flight. The guy next to me goes ‘this is bullshit’. How quickly the world owes him something he knew existed only 10 seconds ago.”

Psychologists refer to this phenomenon as hedonic adaptation. It is the observed tendency of humans to quickly return to a relatively stable level of happiness despite major positive or negative changes in one’s life. In Daniel Kahneman’s words:

People are exposed to many messages that encourage them to believe that a change of weight, scent, hair color (or coverage), car, clothes, or many other aspects will produce a marked improvement in their happiness. Our research suggests a moral, and a warning: Nothing that you focus on will make as much difference as you think.

Continue reading “Human Nature #19: Hedonic Adaptation”

Investment Theory #20: Klarman’s 1998 Letter

Lately, it appears a fresh wave of animal spirits has gripped the markets — just look at the post-election rally in equities. Investors seem to have bought into the narrative that tax cuts and deregulation will jump-start the economy, while at the same time ignoring the risks inherent in an “America-First” protectionist agenda.

In times of market loftiness, it serves us well to reexamine how similar cycles have played out in the past, and there is probably no better case study than Seth Klarman’s handling of the late 1990s. Klarman is a well-respected value investor who founded the Baupost Group in 1982. Since then he has generated an average annual return of 19%. Klarman’s investing philosophy can be summed up by the title of his book Margin of Safety: Risk-Averse Value Investing Strategies for the Thoughtful Investor.

This series of posts will reflect on Klarman’s activity during the period 1995 to 2001. Links to past posts: 1995, 1996, 1997

Continue reading “Investment Theory #20: Klarman’s 1998 Letter”

Programming #9: Style and Testing

We would be remiss in our study of programming if we did not devote some time to the crafting of quality code. This subject can be a bit subjective and many programmers have a dogmatic attachment to what they believe qualifies as quality code. Luckily for us, some standards have emerged. The Python Enhancement Proposal (PEP 8) is the go-to style guide for Python code. The Google Python Style Guide is another great resource. For an interactive guide, consider Code Like a Pythonista.

This post will go through an example of crafting readable code to solve a problem. The code can be found on Github. We will stick to some best practices as summarized nicely in the Zen of Python:

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren’t special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one—and preferably only one—obvious way to do it.
Although that way may not be obvious at first unless you’re Dutch.
Now is better than never.
Although never is often better than right now.
If the implementation is hard to explain, it’s a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea—let’s do more of those!

Continue reading “Programming #9: Style and Testing”