Machine Learning in Finance & Economy

Shreya Jain
10 min readJul 7, 2020

--

This is going to be a series of posts or a network/graph of stories, if I may, on Machine Learning in Finance and economy. I believe a profound understanding of the sector where AI is being used is equally important as the models themselves. Therefore, each post would either delve into the finance sector fundamentals or machine learning models.

This is also to consolidate my learnings and understandings of the FinTech sector. Although I’ve always been immensely interested in this field, I never ended up taking a structured course on the same. I followed the top-down approach to understand concepts and algorithms around this sector, mainly by going through the work of well-acclaimed investors/authors, newsletters, and general discussions.

I’ll kick start this series with the concept of currency trading and the instruments used for them.

Foreign Exchange market or trading of currencies:

This strategy has been relevant since the 70s and continues to form the largest financial market in the world. It comprises of more than $5 trillion per day in transactions as it spans currency trading activity in various exchanges, institutions, and banks all over the world. At this rate, it dwarfs even the major stock markets such as the NYSE, London Stock Exchange, and Tokyo Stock Exchange combined!

Simply put, forex trading is when people buy and sell currencies intending to make money on the difference between the two currencies.

They will buy currency ‘A’ against currency ‘B’ in the belief that the price of A will increase against B after some time. If the currency does indeed increase in value, they will close their trade with a gain. However, if the currency decreases in value, then the trader will incur a loss.

When you trade forex on a platform you are trading it as an Over the Counter (OTC) transactions. This means that you speculate on the movement of currencies against each other but don’t take physical ownership of the actual asset (in this case, money). You only take the resulting profit (or in some cases loss).

The exchange rate is one of the most important indicators of a countries economic well-being. A high rate means they can import or buy goods and services easily, whereas a low rate means they can sell or export easily. This is why central banks’ monetary policies are often working to get a good balance on their rates. The last statement will be explained in detail in this post.

Determinants of exchange rates:

Several factors affect the value of a country’s currency in relation to other currencies. The importance and weight of any one of the below factors may shift and should be considered in combination.

I. Economic factors:

A. Inflation rates:

Inflation is a sustained increase in the general price level of goods and services in an economy over a period of time.

Typically, a currency loses value with a high inflation rate. This is because inflation erodes purchasing power, thus demand, for that particular currency.

However, a currency may sometimes strengthen when inflation rises because of expectations that the central bank will raise short-term interest rates to combat rising inflation. Let me explain the last statement in detail in the next section.

B. Interest rates:

Every country has a central bank that serves as an institution that the Government uses to regulate the economy. Reserve Bank of India, in India’s scenario, lends short term money to banks, essentially to control credit availability, inflation, and economic growth. The colloquial term for this is the Repo rate.

When inflation is high, central bankers will often increase interest rates to slow the economy down and bring inflation back into an acceptable range. This increase in this short-term interest rate by the RBI would ultimately mean more interest to be paid by businesses to banks. This would incentivize less borrowing from banks, thus keeping a check on the currency in circulation. With interest rates up, it becomes more attractive for foreign investors to move funds into the country for deposit and to buy bonds. To do so, they need to purchase the countries’ currency.

C. Balance of trade levels and trends:

A country’s current account reflects the balance of trade and earnings on foreign investment. It consists of a total number of transactions including its exports, imports, debt, etc. A deficit in the current account due to spending more of its currency on importing products than it is earning through the sale of exports causes depreciation.

A fiscal deficit situation occurs when the government’s expenditure exceeds its income. This difference is calculated both in absolute terms and also as a percentage of the Gross Domestic Product (GDP) of the country.

D. Economic growth and health:

Reports such as GDP, employment levels, retail sales, capacity utilization, and others, detail the levels of a country’s economic growth and health. Generally, the more healthy and robust a country’s economy, the better its currency will perform, and the more demand for it there will be.

II. Political conditions:

A country’s political state and economic performance can affect its currency strength. A country with less risk for political turmoil is more attractive to foreign investors, as a result, drawing investment away from other countries with more political and economic stability. An increase in foreign capital, in turn, leads to an appreciation in the value of its domestic currency. A country with sound financial and trade policy does not give any room for uncertainty in the value of its currency. But, a country prone to political confusion may see a depreciation in exchange rates.

III. Market Speculation:

If a country’s currency value is expected to rise, investors will demand more of that currency in order to make a profit in the near future. As a result, the value of the currency will rise due to the increase in demand. With this increase in currency, value comes a rise in the exchange rate as well.

Popular instruments to carry out the trade:

Before we delve into the depth of each instrument, first let’s understand what a derivative is.

A derivative is a financial security(equity or debt) with a value that is reliant upon or derived from, an underlying asset or group of assets — a benchmark. The derivative itself is a contract between two or more parties, and the derivative derives its price from fluctuations in the underlying asset. Like a bet.

Another thing to note here is people trade in stock derivative rather than trading in underlying securities directly. Stock options don’t simply follow the stock returns. Their payoffs form a more complex pattern. And if followed properly, they can fundamentally change one’s investments. We’ll take an example in the Options section.

Definition of a derivative

I. Swap:

Swaps are another common type of derivative, often used to exchange one kind of cash flow with another.

For example, a trader might use an interest rate swap to switch from a variable interest rate loan to a fixed interest rate loan, or vice versa. A company, X, pays a variable interest rate of 7% on a loan of on the principal amount. It wants to mitigate the risk of paying a higher interest rate should the rate increase in the future. Now, X creates a swap with company Y by paying a fixed interest rate of 8% (a 1% higher), and in return, Y pays an interest of 7% on the same principal amount to X. So, company Y is making a 1% profit here.

Scenario I: If the interest rate increases to 10%, then the company Y pays the differential 2% on the loan. Here, company X has safeguarded its position by paying out a max of 8% on the loan.

Scenario II: If the interest rate decreases to 5%, Company Y makes a profit, while Company X pays the differential 3% to Company X.

In both cases, Company X is paying a fixed interest rate of 8% and Company Y is making a loss or profit depending on the scenario.

Swaps can also be constructed to exchange currency exchange rate risk or the risk of default on a loan or cash flows from other business activities. Swaps related to the cash flows and potential defaults of mortgage bonds are an extremely popular kind of derivative — a bit too popular. In the past. It was the counterparty risk of swaps like this that eventually spiraled into the credit crisis of 2008.

Popular use-cases: Interest rate swaps, Currency swaps, Inflation swaps, Commodity swaps, Credit Default Swap

II. Options:

Options are financial derivatives that give buyers the right, but not the obligation, to buy or sell an underlying asset at an agreed-upon price and date.

Options contracts usually represent 100 shares of the underlying security, and the buyer will pay a premium fee for each contract. Option prices are based on 3 elements of its underlying stock:

  1. Time to expiration: Time frame within which an option can be exercised.
  2. Underlying stock price/ Strike price: A pre-determined/agreed-upon price at which the shares of the stock will be exchanged if the option is exercised.
  3. Volatility: The price of the premiums are high for a more volatile stock as it incurs more risk.

CALL and PUT Options/Execution of the trade:

An option is a security sold from one investor to another that represents an agreement between the two parties. The buyer of the option pays a premium to the option writer (the person selling the derivative). In exchange for the payment, the buyer is given the right/option to buy or sell the investment to or from the other party at a pre-determined price at some time in the future.

The right to buy the share from the option writer is called CALL Option and the right to see is called the PUT Option.

CALL Option bets on the increase in the price of the share.

PUT Option bets on the decrease in the price of the share.

Profitability in the trade is determined by the difference between the strike price and the market price at the time of expiration.

Why stock options are preferred over direct buying of stocks? The downside risk of the falling stock price can be limited as the buyer can choose not to exercise that option at all. So, the money lost is just the premium paid. Or they can choose to buy the shares instead by exercising the PUT option and sell them at the strike price. It acts like an insurance by limiting the downside risk while still captilizing on the stock movement. Another characteristic of insurance that’s replicated here is having to pay premiums to insure your position until the expiration date.

These transactions are executed over an exchange.

Popular use-cases: Lines of credit, real-estate

III. Futures:

Futures contracts are an agreement between two parties for the purchase and delivery of an asset at an agreed-upon price at a future date. Traders will use a futures contract to hedge their risk or speculate on the price of an underlying asset. The parties involved in the futures transaction are obligated to fulfill a commitment to buy or sell the underlying asset.

Components of a future’s contract:

  1. Trading hours: Each product has its own specific trading hours.
  2. Tick size: The minimum price increment a particular contract can fluctuate.
  3. Contract size: Each commodity or a financial instrument has a standardized contract size that doesn’t change.
  4. Contract Value: Current market value of the commodity represented in a futures contract.
  5. Delivery: Contracts are either financially or physically settled. Financially settled futures contract expire into cash at expiration. Whereas, physically settled contracts expire directly into physical commodities.

Example:

When you believe the recession is coming, you feel the investors would flock to the Gold as a safe haven, thereby increasing its price. If the Spot price (price at the time of contract expiration) increases, then you make a profit by selling.

But if you believe that in order to stimuate the economy, the Government and the Central Bank will encourage investors to leave gold and invest in stock markets, the gold prices would be depressed. Then you’ll be able to buy gold at the lower Spot price and sell at higher Forward price to make profits.

Risks: It amplifies how much you can gain and you can lose from a contract. It requires you to keep only a margin as the deposit on the position. Therefore, many traders can choose to exercise this particular strategy even when they are not capable of repaying it in full should it backfire. If the price drops significantly it opens the door to pretty substantial losses.

The futures instrument originated as a way for companies to hedge their costs but are they are being continually used as investment strategies.

Popular use-cases: Currency future, Interest rate future, Soft commodities market

IV. Forwards

A forward contract is a customized contract between two parties to buy or sell an asset at a specified price on a future date.

Unlike standard futures contracts, a forward contract can be customized to a commodity, amount, and delivery date. Commodities traded can be grains, precious metals, natural gas, oil, or even poultry. They’re not traded on an exchange but only over-the-counter.

Risk involved:

While their OTC nature makes it easier to customize terms, the lack of a centralized clearinghouse also gives rise to a higher degree of default risk. As OTC products, forward contracts carry a greater degree of counterparty risk for both buyers and sellers.

Counterparty risks are a kind of credit risk in that the buyer or seller may not be able to live up to the obligations outlined in the contract. If one party of the contract becomes insolvent, the other party may have no recourse and could lose the value of its position.

Popular use-cases: Hedge currency, interest rate risks

Derivatives can be used to hedge a position, speculate on the directional movement of an underlying asset, or give leverage to holdings. Their value comes from the fluctuations of the values of the underlying asset.

Pros and cons of derivative trading:

Pros: Lock in prices, Hedge against risk, Can be leveraged, Diversify portfolio

Cons: Hard to value, Subject to counterparty default (if OTC), Complex to understand, Sensitive to supply and demand factors

--

--

Shreya Jain

Product | Data Observability | Machine Learning | AdTech