Friday, 24 November 2017

A Tale of Two Currencies

In 1965, the Singapore dollar and Ringgit Malaysia were on parity i.e. S$1.00=RM1.00. From 1973, Ringgit began its long slide against the Singapore currency. Why was this so? Especially when resource-rich Malaysia should have an appreciating Ringgit rather than the other way around.

The Strengthening SGD vs RM:



US-Singapore
1985 : US$1 = S$2.31
2017 : US$1 = S$1.35 (23 November)

US-Malaysia
1978 : US$1 = RM2.10
2017 : US$1 = RM4.12 (23 November)


The performance of a currency is very much decided by the country’s monetary policy as much as its fiscal position – GDP growth, fiscal budget deficits, foreign reserves, trade surpluses/deficits, debt level and perceived confidence.

Monetary policy is in respect of three areas:

exchange rate
capital control and funds management
money supply and interest rates

No country can control all three levers together – it’s either one or the other.

Singapore focuses on price stability while Malaysia focuses on interest rates for economic growth and price stability. Monetary Authority of Singapore (MAS) prefers the currency to appreciate while Malaysia has an unstated bias towards a weak currency.

At a glance, Malaysia’s fundamentals remain reasonable, except for:

high household debt;
fiscal deficits for over 20 years;
“fluctuating” oil prices;
perception of low forex reserves;
political scandals like 1MDB;
over 40% of short term bonds held by foreigners – which will impact the exchange rate if there is an exodus;
relative increase in currency in circulation; and
inflationary effect of GST

That may be the case but the real reasons remain speculative and with speculators. Market makers create the volume and banks are at the heart of the matter as much as Governments.

Friday, 17 November 2017

Machine Learning – A Simple Example for Stock Market Prediction

Machine Learning (ML) is an application or methodology to analyse input data and then predict an output value using statistical analysis.  It is getting popular in finance and the investing industry.  The basic idea of ML in investing is feeding all available data to a computer and let the algorithm learn the relationship between the data and stock price movement.

Traditionally, finance and economics data have been analysed statistically to find their relationships with KLCI.  Recently, all other variables which are indirectly or not related to KLCI such as weather, traffic conditions, concert ticket sales, celebrity news and others, have been included in the ML algorithm.

Let’s do a simple experiment, using Google Trend data to predict Kuala Lumpur Composite Index (KLCI).  Three search-terms – “Malaysia”, “1MDB”, and “KLCI” were selected.  The popularity of each search-term over time were plotted together with KLCI.  Chart 1 is search-term “Malaysia” and KLCI; Chart 2 is search-term “1MDB” and KLCI; while Chart 3 is search-term “KLCI” and KLCI.





Based on a cursory inspection, Charts 1 and 2 do not reveal any strong relationship between search-term and KLCI movement.  Although there was a sharp drop in KLCI when the popularity of “1MDB” surged in Aug 2015, the subsequent surge did not move KLCI drastically.  Chart 3, on the other hand, is more interesting as each time the popularity of search-term “KLCI” peaked, the KLCI tend to reverse its downtrend movement.

Next, these data were then analysed using basic machine learning algorithm.  Generally, there are two main types of machine learning used in quantitative finance – Regression, and Classification.  For simplicity purpose, Classification method is chosen for this analysis (Read more here).

The KLCI data was transformed into “Up”, “Down”, “Flat”, and “Dunno” by calculating the weekly closing price changes.  Example, if week 2 closing price is higher than week 1 closing price, week 2 will be classified as “Up”.  The “Down”, and “Flat” were calculated similarly.  Additionally, the “Dunno” category was introduced to eliminate noises for the region where no high search popularity occurred.

A time lag effect was also introduced into the model to “predict” whether KLCI will be “Up”, “Down”, “Flat”, or “Dunno” in the coming week.  As such, current week search-term results will affect following week’s KLCI behaviour.

Several algorithms were tested and k-nearest neighbours (KNN) algorithm was chosen as the accuracy is the highest amongst others.  See Pictures 1 and 2 for details.

Picture 1.

Picture 2.


Now, let’s run a hypothetical test case to predict KLCI movement.  In Test case 1, assuming the search-term popularity for “Malaysia”, “1MDB”, and “KLCI” are 2, 1, and 25 respectively.  This means “Malaysia” and “1MDB” search traffics are almost flat but “KLCI” search traffic increased by 25%.  The KNN algorithm predicted the KLCI will go down in the following week.  In Test case 5, both “Malaysia and “1MDB” are almost flat but “KLCI” retreated from a high peak.  The KNN algorithm predicated the KLCI will go up in the coming week.  The machine learning algorithm is giving similar results as eye-balling observation.  Table 1 shows KLCI movement predicted by KNN algorithm based on various test cases.



Above is just an illustrative example of how Google Trend and machine learning algorithm works.  Actual algorithm trading requires more intensive research and data processing effort! 

Friday, 10 November 2017

Cryptocurrency: 21st Century Bane or Boon?

Satoshi Nakamoto, inventor of Bitcoin, never intended to invent a currency. It was a “peer to peer electronic cash system”. The key part was that he found a way to build a decentralized cash system with every peer in the network having a list of all transactions.

A simple definition would be “limited entries in a database no one can change without fulfilling specific conditions”.

 Source: Blockgeeks

The transaction is known immediately by the whole network and gets confirmed after a specific amount of time. It can’t be reversed and is not forgeable. It is part of an immutable record of historical transactions – the so-called block chain.

Crytocurrencies are built on cryptography. They are not secured by people or by trust but by math. We could describe properties of crytocurrencies into transactional and monetary properties.

Transactional properties will include: irreversible; pseudonymous; fast and global; secure; permissionless.

Source: Blockgeeks

Monetary properties will be controlled by supply and no debt but bearer – it’s a system of IOUs.

It is revolutionary in impact. It is an attack on banks and governments over monetary transactions of their citizens. It is an attack on the scope of monetary policy – i.e. central banks control of inflation or deflation is now irrelevant. Cryptocurrencies are changing the world. Step by step. We can either standby on the sidelines and observe it or become part of history in the making.

Notes:  There is a follow up on previous article "India’s GST of 28%:  Is This A Valid Benchmark?".  Please go to this link (Read more here) for the update. 

Friday, 3 November 2017

War and Capital Markets!

We often read headlines relating stock market declines with regional military tensions.  On 28 Aug 2017, North Korea fired a missile that flew over Japan before falling into the Pacific Ocean, which triggered a regional market sell-off where Asian, European and American markets all opened sharply lower, shed 1% roughly.

Mark Ambruster, CFA, published an article in Enterprising Investor (Read more here), examining the capital market performance during times of war.  His data shows that war does not necessarily imply lacklustre returns for US stocks.  Quite the contrary, stocks have outperformed their long-term averages during wars.  Bonds, which are deemed safe harbour during tumultuous times perform below historical averages during periods of wars  See below table for details.



He is in the opinion that the future direction of capital market is dependent on economic growth, earnings, valuation, interest rates, inflation, and a host of other factors; history suggests that any market decline due to war should be short-lived.