sobota, 18 maja 2013

HFT invited to a land of new opportunities

The markets are broken.

I've thought, nothing will beat an epic fall of Accenture in May 2010. From $40 to $0.01.

But we've received Andarko yestarday... $90 to $0.01 in mere 45 milliseconds!

Source: Nanex

The fall in Andarko price probably affected the value of the S&P500 index by 1 point.

I wonder whether anyone either sold some ES futures just before manipulating the Andarko price, or bought them just after the mini flash crash?

A single point is not much, but may be tempting enough.

This reminds me: the Warsaw Stock Exchange (WSE) has recently changed its equity futures settlement price rules. While the settlement price of the index futures is based on the average of the index over some time, the final settlement price of equity futures depends on the last price of the underlying stock.

Since WSE has been running on the NYSE's UTP for a month now, new HFT players shouldn't have any problems with adapting and making the prices right ;)

Recent (mostly) HFT-related posts: http://www.reakkt.com/search/label/high-frequency%20trading

HFT-related news: https://pinboard.in/u:mjaniec/t:high_frequency_trading/

piątek, 17 maja 2013

Mission accomplished: S&P500 = 1666.66

Source: Google Finance

It was 666 in March 2009:

Source: Stooq

That makes 1000 points, or 150% in 4 years.


But for opening short position, I need much more than faint signals.

I'm sure, it will come - in one way, or another...

czwartek, 16 maja 2013

I will come back to that later

Some time ago I wrote about generating safe investment strategy by combining many low correlated investment models.

Recently I've been working on a family of models based on one common concept - short term return prediction.

Seems, it may actually work :)

I have run a number of test and so far results are encouraging:


The above chart presents strategy returns over 250 sessions between 2011-11-23 and 2013-04-12.
(some sessions are missing for lack of common data for some days)

Lines of different colors represent sub-models used. The thick purple line represents the combined model.

The correlation between some sub-models is pretty high - that may be used for reduction of the number of sub-models used.

> cor(test.arr[,,"return"])
             M1        M2        M3        M4        M5      mean
M1    1.0000000 0.3565054 0.2471695 0.3712636 0.1614239 0.4081393
M2    0.3565054 1.0000000 0.1567697 0.1935882 0.1805843 0.2852754
M3    0.2471695 0.1567697 1.0000000 0.5065645 0.4060609 0.5138838
M4    0.3712636 0.1935882 0.5065645 1.0000000 0.3663719 0.6328662
M5    0.1614239 0.1805843 0.4060609 0.3663719 1.0000000 0.5846763
mean  0.4081393 0.2852754 0.5138838 0.6328662 0.5846763 1.0000000

The returns of all sub-models were positive over the test period:

> stats
          M1      M2      M3      M4      M5      mean             
total     0.7488  0.5927  1.1036  0.5844  1.0368  1.0415
mean      0.0029  0.0023  0.0044  0.0023  0.0041  0.0041
drawdown -0.1331 -0.1181 -0.1674 -0.1461 -0.1563 -0.1804



The combined model was positive for all test periods and assets used for tests so far.

The individual returns are low, but it seems it is possible to safely leverage the strategy 2-3x. I haven't completed yet the analysis of the frequency of portfolio re-balancing yet, too.

As I've mentioned in the title of this post, I'm going to return to this strategy and probably its sibling a little bit later...




piątek, 10 maja 2013

Illiquidity trap

Another difficult year for some investment funds

Some Polish absolute return investment funds are facing a though year - again.

Investor FIZ is down -12.96% and Opera FIZ felt -12.43% YTD.

This may not sound too bad for the recent investors in some of the John Paulson's funds.

However, if you take a longer perspective, the numbers start to look much more ugly.

Investor FIZ is down -68.71% from its peak in October 2007, while Opera FIZ decreased by -80.45% from June 2007.

I understand that substantial drawdowns may occasionally happen to even the best managers.

They are often connected either with elevated market volatility or slow market convergence process.

To demonstrate the later case let's take a look on a potential a pair trading involving BRENT and WTI crudes:


Source: Stooq

The fundamental price difference between them is mostly connected with transportation costs. Hence, the spread should be pretty stable and one should be able to quite easily arbitrage the temporary premium or discount in the price of one of these commodities.

However, as you can see above, some other factors can "temporarily" push the spread to the extremes.

If one used historical price data to model the possible spread distribution and opened opposite positions (long WTI, short BRENT) based on such a model in mid 2011, the widening spread could have either caused significant drawdown or forced the over-leveraged investor to close the trade.

But it was always possible to close such a trade! And it narrowed eventually, enough to produce a profit for the patient investor.

Unfortunately, there is very little hope for Opera FIZ and Investor FIZ investors...


The value of Opera FIZ certificates has been flat for a couple of years. And we should expect the same from Investors FIZ... :(

The reason is quite simple.

A significant part of these funds' assets is trapped in illiquid investments.

In the Investor FIZ portfolio one may find such "gems" as Tamex:


Source: Stooq

Tamex is listed on the NewConnect alternative market, and sometimes its shares are not traded at all for dozens of days.

Another "interesting" case is Indian Spice Mobile:


According to the latest Investor FIZ financial statement, the fund has Spice Mobile shares worth over PLN 6.3 million. Meanwhile the company's 30 day average volume is... PLN 6,205. The maximum daily turnover over the recent year was PLN 456k.

It is hardly possible to liquidate the position Investor FIZ has!

Similarly, Opera FIZ is stuck with illiquid and unprofitable/indebted private equity holdings like Termisil and SkyCash. It is hard to predict, whether these companies will become successful or be sold at a profit. What's clear however, they lock significant part of or even siphon off the fund's capital and make its return to growth extremely challenging.

Unfortunately there seems to be more skeletons in the closets at both these funds.

Marking to - totally illiquid - markets

Valuation of funds' assets is usually based on their market price. For example if a fund owns 1,000 shares of some listed company and the recent price of one share is 100, the accounting value of this holding is 1,000 times 100 or 100,000.

The problem here is, this valuation depends on the marginal price of the asset.

It is OK, as long as your position is small relative to the market turnover of this particular company.

However, such approach is very misleading when liquidity is low.

In such a situation, one should estimate the value of the asset based on the current, short term historical or eventually short term predicted liquidity.

In the case of the above mentioned Investor FIZ holdings - Tamex and Spice Mobile - the realistic value is close to zero. 

If Investor FIZ had decided to dump its shares on the market, they either would have tanked or it would not been possible at all.

Meanwhile, Tamex and Spice Mobility constitute some 11% of Investor FIZ assets.

Marking to magic

The situation is more complex with unlisted private equity holdings, such as Termsil and SkyCash.

Most often such assets are valued using discounted cash flow method (DCF), comparison method or adjusted purchasing price.

Each of these models is very sensitive to its assumptions and parameters. One can practically set any desired value in quite a broad range.

According to the most recent Opera FIZ financial statement, Termisil and SkyCash accounted for more than 20% of the funds' assets.

The real power of diversification

I have a problem with so called Modern Portfolio Theory.

To make it work, one "just need" to know returns of the particular shares to be put into the portfolio.

Having returns, you can easily calculate variances and covariances needed to optimize the structure of the portfolio - i.e. select the weights of the assets.

However, you need to know (estimate) the future returns!

And as Niels Bohr said, prediction is very difficult, especially about the future.

So, is there any other potential value of the portfolio diversification?

Actually, yes - it can reduce the liquidity risk.

A good example here may be the Renaissance Institutional Equity Fund (RIEF).

It is a younger (but bigger) sibling of the Renaissance Medallion Fund mentioned in my previous post.

At the end of 2012, RIEF manged USD 34.36 billion.

These assets were dispersed over 2,815 holdings. Hence the average single position represented just 0.0355%, and the largest 1.25% of the fund's portfolio.

The important benefit of such a wide diversification is that any single asset cannot significantly affect the whole portfolio.

The market and correlation risk are still present though. However, when you combine asset diversification with strategy diversification, it may be possible to significantly reduce the overall risk and generate positive returns.


środa, 8 maja 2013

Computation complexity makes beating Renaissance's Medallion not easy

Presumably the best hedge fund in the history - Renaissance Technologies' Medallion Fund - has averaged 35% annual return after fees over 11 year.

Since RenTec shares approximately 40% of the profits generated by the fund on top of the 5% annual management fee, gross returns should be closer to 50% per year.

I have been wondering how hard it is to generate such high returns independent on market conditions. As I mentioned some time ago, with the perfect future knowledge you can achieve virtually any return you want ;)

Unfortunately, even if one is able to score big once, repeating the success may be challenging - take John Paulson's story as a cautionary example.

Hence, Medallion's persistence is even more interesting.

As an experiment I attempted to generate purely random investment strategy that satisfies tree criteria:
  1. annual strategy return is positive
  2. annual strategy return is higher than market return over the same period
  3. annual strategy return is 50% per year or slightly higher
These three conditions must be met at any time.

The strategy tested operated on S&P500 index.

Fig. Random Test - price, daily returns, volatility, returns 1Y, difficulty

Even that 50% annual return is minuscule in comparison with the maximum theoretical return, generating successful strategy may be quite computationally challenging at times. Over the last 4 years, the complexity varied by some 17 000 (seventeen thousand times)!


Fig. Maximum Theoretical vs Desired Returns 1Y

Fig. Random Test - difficulty of generating desired strategy

In addition, even that complexity is inversely correlated with volatility, the correlation is not perfect:

> cor(returns[,"intensity"],tail(v.year,l),method="kendall")
[1] -0.8658321

Definitely market volatility makes generating high returns easier, but seems not to be the only factor at play.

Note: the strategy was generated on the daily data, while Medallion most probably operates in the HFT regime. Higher frequency increases the maximum theoretical return and - at least theoretically - makes generating higher returns easier.

Fig. Random Test - Volatility

It is also worth mentioning that the market conditions over the recent 9 months seem to paradoxically be pretty challenging for generating high returns. What's more, complexity has been increased for quite some time now. 

Is Fed/ECB/BoJ's quantitative easing responsible for that? Is it possible that this situation leads to the herding behavior among investors? What will happen when they start unwinding positions in a situation when assessment of liquidity may be misleading for high activity of high frequency traders?


Fig. S&P500 over 30 years - note falling volume

środa, 27 marca 2013

Potential arbitrage opportunity in Bitcoin

The recent turmoil in Cyprus seems to accelerated the rapid increase in value of virtual currency Bitcoin.

As a result, the price of mtgoxUSD, the Bitcoin denominated in USD and traded on mtgox, increased by 85% between March 1st and March 26th.

What's more, mtgoxUSD grew by 283% over a year.

Chart: mtgoxUSD price from 2012-03-27 till 2013-03-26, data source: bitcoincharts.com

The annual volume of mtgoxUSD reached 267 million USD (in the meantime, the turnover of mtgoxEUR approached 17 million EUR).

Since mtgoxUSD should equal mtgoxEUR * EURUSD, this raises the question, whether is it possible to find an arbitrage opportunity between these three assets, similar to the one between EURJPY, EURUSD and USDJPY, described in September 2010.

I wasn't able to find adequate information about historical BTC spreads, but based on the EOD data for mtgoxUSD, mtgoxEUR and EURUSD, it seems there may exists pretty consistent difference that may be exploited:

Chart: Potential arbitrage opportunity between mtgoxUSD and mtgoxEUR*EURUSD, EOD data, 1 year

Over the previous year, the differences between mtgoxUSD and mtgoxEUR*EURUSD fluctuated between -4% and +4%, creating potential arbitrage opportunity.

To verify this preliminary observation, one should use historical intraday BTC spreads and EURUSD data.

Some additional information on bitcoin: https://pinboard.in/u:mjaniec/t:bitcoin/


niedziela, 17 marca 2013

European Lehman moment in slow motion?

Fot. Buldozer parked in front of the bank in Cyprus

EU and IMF announced their bail-out package for Cyprus on Saturday.

According to its terms, up to 9.9% of the deposits held by Cypriot banks will be forcefully converted into banks equity. To prevent bank runs, all the funds were frozen and electronic transfers blocked till banks open on Tuesday. No wonder this caused a swift and very nervous reaction of the people in Cyprus.

Cyprus may be a tiny country on the outskirts of the European Union. Hardly anyone should care about what's going on there, right?

Not exactly.

First of all, the confiscation of the part of money held by people in banks is a violation of the deposit guarantees introduced in the EU in the wake of the financial crisis. If the guarantee was broken in Cyprus once why it cannot be broken in other EU country, again? Why to confiscate (sorry, forcibly convert to illiquid assets) only 10% of the deposits and not 25% or more? Meanwhile the EU-wide guarantee was shelved in September 2012 under German pressure. Trust in the Eurozone banks has just been seriously shaken.

Second, there are more then 100 brokerages operating from Cyprus. Even that some of them keep their clients' money outside the island, others don't. Since many of these brokerages provide FX, CFD and commodities trading, they encourage high leverage. A 10% haircut on your margin may be very painful. Some margin calls are to be expected and some leveraged positions may be rapidly unwinded. The actual effect may be much stronger than directly assumed from the nominal size of the margins. Even if you are not forced to close your positions, you will very seriously consider changing your broker and moving funds out of Cyprus and any broker that keeps funds in the Eurozone.


Third, it is believed that some 50% of the deposits in the Cypriot banks belong to the wealthy Russians. Most probably not only to the Russians, but also citizens and businesses from other Eastern European countries willing to optimize their tax burden and reluctant to share information about their assets with their home fiscal authorities. Even that they are unable to save the 10% taken by the EU and IMF, they've already started to think hardly about where to relocated the rest of their money. The farther from the EU the better is my guess. The Singapore or the Middle East may be interesting candidates. For the Switzerland turned recently too vulnerable to the EU-USA pressure.

czwartek, 7 marca 2013

We do not lose money


From the Michael Covel's book on trend following one can come to conclusion that trend followers do not generate loses. They only experience some temporary drawdowns....

Sometimes some of these "drawdowns" can strangely turn into catastrophic blowouts that wipe out trend follower's fund. Shit happens even to the wizards of trend following, it seems...

But how it is possible that trend followers experience major drawdowns at all using tight stop-losses in the range of a couple of percentage points?
(my colleague suggested that these drawdowns are in fact results of numerous exists caused by stop-losses from incorrectly identified trends)

Still, at least the trend followers apparently have some plan and discipline many of the other monkeys are lacking.

czwartek, 28 lutego 2013

Monkey business



A few years ago it was suggested that monkeys can beat professional asset managers at picking stocks to invest in. Even though the result of the experiment conducted by the WSJ in 1988 was not conclusive, the idea disturbed the investment community a little.

But it seems some professional asset managers had found a creative way to take advantage of the random portfolio selection effect. If monkeys can - at least sometimes - beat professional at the game, why not to increase our chances by multiplying strategies / funds and boast success... in some of the funds under management!

There are usually two ways to make money in the asset management business: one can either take a share of the profits generated by the fund, or charge some annual management fee. Both of these fees have an asymmetric structure, beneficial to the manager - in the first case he gains when the fund increases in value, while he does not lose any serious money when the value of the fund collapses. The second fee is connected only with size of the fund / assets under management and not - at least directly - with its performance / value.

Hence, in many cases it is enough to amass a large enough asset pool and charge the fund participants / investors irrespective of fund results.

In order to draw investors you need  two things: some limited track record or apparently convincing investment story, and an extensive sales network. With that, you are ready to show your true investment incompetence without worrying about your income... :(

Since many fund managers have problems beating the market and sometimes can make terrible mistake, what is the difference between average fund manager and the monkey then? Monkeys seems fair.


wtorek, 19 lutego 2013

Perfect time for testing peak detection models

An experimental peak detection model I've been working recently strengthens the signals generated by other methods - FTSE is a sell.

Fig. Experimental Peak Detection Model - FTSE, 2013-02-18

A few days ago I wrote about my implementation of TD Sequential indicator. The indicator was (prematurely) screaming sell FTSE for a couple of months and for a dozen or so percentages. I stressed that I was not sure about the soundness of the method nor correctness of my implementation, but the TD Sequential signals coincided quite well with readings I was getting from Extremum Detection System (EDS).

A major shortcoming of EDS was the asymmetry in detecting peaks and troughs. I've been working on that issue for some time, and even that I'm not sure yet about the results yet, I present here a novel peak detection method which I currently investigate.

It seems that we are now in a perfect moment for testing peak detection methods.. Most other peak detection tools I know are confused by the current market behavior. Also, even if we cannot use trend following methods for predicting future - they were not designed for that - we can use them as trend health measures. And they tell the market will continue trending up.

What will prevail?