Quant Macro Investing

Risk Taking Disciplined

Four Ways of Looking at Twitter

Data visualization is cool. It’s also becoming ever more useful, as the vibrant online community of data visualizers (programmers, designers, artists, and statisticians — sometimes all in one person) grows and the tools to execute their visions improve.

Jeff Clark is part of this community. He, like many data visualization enthusiasts, fell into it after being inspired by pioneer Martin Wattenberg‘s landmark treemap that visualized the stock market.

Clark’s latest work shows much promise. He’s built four engines that visualize that giant pile of data known as Twitter. All four basically search words used in tweets, then look for relationships to other words or to other Tweeters. They function in almost real time.

“Twitter is an obvious data source for lots of text information,” says Clark. “It’s actually proven to be a great playground for testing out data visualization ideas.” Clark readily admits not all the visualizations are the product of his design genius. It’s his programming skills that allow him to build engines that drive the visualizations. “I spend a fair amount of time looking at what’s out there. I’ll take what someone did visually and use a different data source. Twitter Spectrum was based on things people search for on Google. Chris Harrison did interesting work that looks really great and I thought, I can do something like that that’s based on live data. So I brought it to Twitter.”

His tools are definitely early stages, but even now, it’s easy to imagine where they could be taken.

Take TwitterVenn. You enter three search terms and the app returns a venn diagram showing frequency of use of each term and frequency of overlap of the terms in a single tweet. As a bonus, it shows a small word map of the most common terms related to each search term; tweets per day for each term by itself and each combination of terms; and a recent tweet. I entered “apple, google, microsoft.” Here’s what a got:


Right away I see Apple tweets are dominating, not surprisingly. But notice the high frequency of unexpected words like “win” “free” and “capacitive” used with the term “apple.” That suggests marketing (spam?) of apple products via Twitter, i.e. “Win a free iPad…”.

I was shocked at the relative infrequency of “google” tweets. In fact there were on average more tweets that included both “microsoft” and “google” than ones that just mentioned “google.”

So then I went to Twitter Spectrum, a similar tool that compares two search terms and shows which words are most commonly associated with each term and which words are most commonly used in tweets with both terms. Here’s the “google, microsoft” Twitter Spectrum:


I love that the word “ugh” is dead center between Google and Microsoft. But the prominence of social media terms on the blue side versus search terms on the red side is fascinating. It looks like two armies marching at each other ready to fight different wars.

Clark has also created TwitArcs. This one, I feel, is still a work in progress and Clark says “visually I like it but it might be the least useful so far.” In this case, you type in a tweeter’s handle and it returns a stream of that person’s tweets with arcs that link common words between tweets (on the right) and common retweeters (on the left). Rolling your mouse over highlights the last tweet in the arc. Here’s a TwitArc of @timoreilly:


Finally, the Stream Graph. Enter a search term and Clark’s engine returns the frequency of the most common words found with your search term for the last 1,000 tweets. You see a literal flow of conversation. You can also highlight one term to see how its frequency changed over time and you’ll see the most recent tweets that include both your search term and that highlighted term.

Sometimes 1,000 tweets with your term may span weeks. For my search term, “Tiger Woods” which I entered yesterday afternoon right after news that he’d speak publicly broke, 1,000 tweets covered about 20 minutes. Here’s the “Tiger Woods” stream graph with “silence” highlighted:


It isn’t hard to imagine how this may be applicable to business. I can already see eager marketers watching the stream flow by as their commercial debuts during next year’s Super Bowl.

Clark, like many data visualizers, believes we’re on the front end of a revolution in information presentation. “There’s a lot of work done called scientific visualization or business intelligence graphics,” he says. “And it’s pragmatic, trying to solve practical problem. It’s all standard, a bar chart or pie. But those standard ways are not adequate when you’re trying to mine a richer data space. The world is full of complex data and we’re just starting to get the tools to make sense of it. We’re looking for new ways of presenting data.”

For the original file, please click here.

February 23, 2010 Posted by | Uncategorized | Leave a comment

Margin Debt & Stock Market Returns

I ran a little experiment to see how the growth or decline of NYSE margin debt correlates with stock market returns. Before conducting the experiment, I expected that high rates of margin debt growth would mark periods of speculative excess, and therefore result in low future stock market returns.

The average 1yr rate of margin debt growth on the NYSE since 1959 is 11.18%.

For my experiment, I calculated rolling forward 2yr cumulative returns on the S&P 500 for all periods since 1959. Next, I divided the periods since 1959 into ‘above average’ and ‘below average’ margin debt growth groups.

Here are the results:

1. Average 2yr stock market return after all periods: 22.97%

2. Average 2yr return after periods with below average margin debt growth: 23.27%

3. Average 2yr return after periods with above average margin debt growth: 18.72%

Bottom Line: the results illustrate a moderate-to-weak relationship between above average margin debt growth and below average future stock returns.

Incidentally, 2yr returns after margin debt grew by 40% and 60% were 6.97% and 6.7% respectively. This supports the thesis that above average margin debt growth leads to below average stock market returns. However, it also shows that the relationship is not linear since the stock market returns stopped declining by a meaningful degree after margin debt growth surpassed 40%. Further clouding the relationship, there also were periods (e.g. 1983) with very high margin debt growth and double-digit stock market returns.

How fast is margin debt growing today? For the 12mths ending December 2009 NYSE margin debt grew by 23.66%. But given the results of my experiment, I wouldn’t rely on margin debt growth to anticipate future market returns.

This is not advice. None of this information is guaranteed to be accurate and should not be relied on. Investing involves risk and you could lose all your money. Consult a financial advisor before making any investing decisions.

For the original file, please click here

February 23, 2010 Posted by | Uncategorized | Leave a comment

Copper/Gold Ratio


For the link, please click here.

February 23, 2010 Posted by | Uncategorized | Leave a comment

(Internal) China exposure

China exposure for below.  They have bonds or perpetual outstanding:

WHB 0302.hk

BoC HK   2388.HK

BEA     0023.hk

Ka Wah Bank (CITIC Ka Wah?)

February 22, 2010 Posted by | Internal Research | Leave a comment

(Internal) CB Prospectus

go bloomberg ticker


2778 HK Equity


Pick the CB, do DES

Then right hand side RHS, go Prospectus



DBSSP 11       – CT2+125

UOBSP 19       – CT5+225

UOBSP13        245/235       3.30/3.20    103.80/104.12  135/125      Aa2 /*-/A-

OCBC 7.75% 2011  XS0132030759  offer 108.67

UOBSP 5.796% Perp  KYG9289K2003 offer 96.25

Dahsing 6.253%  Perp XS0287630932 offer 94.50

KaWah 9.125% Perp XS0148849390 offer 107.25

Winghan 6% Perp XS0296645012 offer 95.25

February 22, 2010 Posted by | Internal Research | Leave a comment



6th Feb 2010


接着,我跟她說了一個小故事:著名棒球隊波士頓紅襪(Boston Red Sox)的班主約翰.亨利(John W. Henry),就是堅持使用簡單的量化模型的基金經理之一。亨利很早就參與大豆和玉米的期貨交易;1976 年,他開始摸索使用量化投資方法;1981年,他的投資公司正式開張,並以自己名字的縮寫JWH來命名,是當時全球最大、面向散戶的另類投資公司。

JWH 使用的交易模型,主要是機械式地捕捉各種價格趨勢和逆向趨勢。以亨利自己的話說,就是「發現長期趨勢,不去理會短期的波動;堅持使用量化模型投資,將人工干預降到最低;積極採取風險管理策略,包括止蝕;全球分散投資。」JWH 的策略,在過去二十多年來鮮有變化,目光只盯着一個指標:「趨勢」,然後「在人們對資訊反應的過程中,尋找偏差帶來的機會」。誰說簡單說賺不到錢?


full article:






名字created by me








「就是created by me。」



Anjaylia眨眨杏眼,「對呀,你不覺得很神奇嗎?量化的意思,是按照事先定好的規則來投資。舉個簡單的例子,如果有一個人每天都於早上10時30分把中石油(857)的股價,跟它前面三個交易日的收市價比較。假設他定好的規則是,如現價高於之前三天其中兩天的收市價,他即買入一萬股,然後在當天收市前15 分鐘沽售;否則,就按兵不動。





當她一再重複「你不覺得很神奇嗎」這句話時,我感覺很詭異。我好像正在跟Hello Kitty討論尼采。





我侃侃而談,「所謂連續時間金融分析,背後有一個假設,就是股價或滙率等金融價格連續不斷地變動。變動的百分比(不是價格本身的變化),符合我們常說的鐘形正態分布(normal distribution),而上一個變化和下一個變化之間又沒有任何關係。在這樣條件下,各種金融工具都可以此方法定價,尤其是衍生工具。」



「可是,長期資本管理一坐,就把46億美元搞沒了!」看不出這小妮子還關心財經新聞,而且記性甚好。我不禁笑道:「哈哈,這只怪肥尾(fat tail)惹的禍!」









接着,我跟她說了一個小故事:著名棒球隊波士頓紅襪(Boston Red Sox)的班主約翰.亨利(John W. Henry),就是堅持使用簡單的量化模型的基金經理之一。亨利很早就參與大豆和玉米的期貨交易;1976 年,他開始摸索使用量化投資方法;1981年,他的投資公司正式開張,並以自己名字的縮寫JWH來命名,是當時全球最大、面向散戶的另類投資公司。

JWH 使用的交易模型,主要是機械式地捕捉各種價格趨勢和逆向趨勢。以亨利自己的話說,就是「發現長期趨勢,不去理會短期的波動;堅持使用量化模型投資,將人工干預降到最低;積極採取風險管理策略,包括止蝕;全球分散投資。」JWH 的策略,在過去二十多年來鮮有變化,目光只盯着一個指標:「趨勢」,然後「在人們對資訊反應的過程中,尋找偏差帶來的機會」。誰說簡單說賺不到錢?

Anjaylia淡然地走到我身後的書櫃,玉手一掃,竟揚出大堆灰塵。「這裏一大堆財經書,有關於畢非德的、索羅斯的、彼得林治(Peter Lynch)的、羅傑斯(Jim Rogers)的……但似乎用來裝飾居多。放在你案頭的,卻永遠都是西蒙斯的零碎資料。」果然心細如塵。



February 7, 2010 Posted by | Case Study | 1 Comment

February 4, 2010 Seven Days Each Month Beats the Market — By a Lot


Since 1932, most of the S&P 500’s capital gain has come during a seven-day period at the turn of each month—specifically, the last four trading days and the first three trading days of each month. This represents about one-third of the total trading days. During the rest of the month, the stock market actually lost money.


Here are the numbers: Since the beginning of 1932, the S&P 500 has gained nearly 14,000% which is about 6.5% annualized. Investing in just the last four days and first three days of each month would have returned over 63,000% (not including trading costs). Annualized, that’s 8.6%. However, if you consider that it’s really only 32% of the time, the true annualized rate is over 28%.

The rest of the month — the other 68% of the time — has resulted in a combined loss of close to 78%.

Let me add some important caveats. First, I’m not offering this as trading advice. I’m merely showing that the market has historically experienced outsized gains at the turn of each month. Remember that trading in and out of the market is costly and these results don’t include taxes or commissions.

Secondly, this only refers to capital gains not dividends. A very large part of the market’s total return is due to dividends, and if you’re only invested one-third of the time, you’re going to lose out.

Having said that, here’s a graph showing what turn-of-the-month investing looks like. The S&P 500 is the red line. The blue line is performance during the seven-day period and the rest of the month is the black line.

February 5, 2010 Posted by | Case Study | Leave a comment