The post Turtle Trading appeared first on Wiki @ AlgoTrading101.

]]>Turtle trading refers to the way a group of traders in the 1980s traded. This group, who is known as the turtle traders, made $175 million in 5 years using a fixed strategy that was taught to them.

**Description**

History of the Turtle Traders

In the 1980s, Richard Dennis and William Eckhardt developed a systematic trading system that turned $5,000 into $100 million (a lot of money in the 1980s).

Dennis believed successful traders can be trained while Eckhardt believed they are born with a gift for trading. To settle this debate, they started an experiment that will go on to be world famous.

**Turtle Experiment**

Dennis picked people off the streets, interviewed them and selected a handful for the experiment. He and Eckhardt taught these traders (they were called the Turtles) how to trade for two weeks.

They gave the Turtles money to manage after the training.

Why the name “Turtles”? Dennis, visited a turtle farm in Singapore and believed he could “grow” traders and efficiently as they grow turtles there.

**The result of the experiment**

The Turtles made $175 million in 5 years.

**The Turtle Trading Strategy**

The Turtle Traders used a long term breakout strategy. They mainly traded Forex and commodity futures.

Their strategy is based on fixed rules and the traders are required to abide by it strictly.

__Entries and Exits__

Whenever an asset rise significantly, they will long (i.e. buy) the asset. They will long more as the asset continues to rise.

Whenever an asset falls significantly, they will short (i.e. bet that it falls) the asset. They will short more as the asset continues to fall.

In both long and short trades, they will close the trade when it moves significantly against them. This means that they give back some profits near the end of the trade. However, it also means that they will stick will a trend for a long time.

As it takes discipline not to close a trade when taking on a significant loss. Many Turtle Traders fail to make the cut due to the lack of discipline in this aspect.

__Position Sizing and Risk Management__

The Turtle Traders strength is their position sizing (how much to bet) and risk management

They use the volatility of the markets to determine how much to trade. The more volatile the markets are, the less they bet per trade.

Their trades are spread over many different assets so as to diversify their risks. The traders’ overall positions can’t be overwhelming long or short.

**The Original Turtle Trading Strategy**

Link: The Original Turtle Trading Strategy – Tradingblox.com

**The Turtle Trading Strategy Today**

There is little evidence that the original trading strategy works today.

However, many former Turtle Traders continued to be successful traders, using techniques that are similar but not identical, to the original Turtle Trading Strategy

** Links to Other Explanations**

**Related Terms**

The post Turtle Trading appeared first on Wiki @ AlgoTrading101.

]]>The post Stochastic Calculus appeared first on Wiki @ AlgoTrading101.

]]>**Definition**

Stochastic calculus is a way to conduct regular calculus when there is a random element.

*Regular calculus is the study of how things change and the rate at which they change.*

**Description**

Think of stochastic calculus as the analysis of regular calculus + randomness.

**Regular Calculus**

Regular calculus studies the rate at which things changes.

- At W, there is 0 change
- At X, there is an increasing increase
- At Y, there is a constant increase
- At Z, there is a decreasing increase

The red lines indicate the rate of increase at the black dots.

As the red lines become steeper, the increase in values is going up at a faster pace.

Imagine that we are climbing up a ladder, but now we are climbing up at a faster pace.

**Randomness**

Let’s talk about randomness before combining this with the earlier section on regular calculus.

This is what a bunch of random charts look like:

This behavior is described as Brownian motion.

This means that their behaviour is random, but over the long run and with enough samples, their overall movement resembles a bell shape. In other words, they are normally distributed.

This randomness is not so random after all. The end result of all these random movements is a bell shaped output. (See the bell shape by tilting your head to the right.)

That means that most of the data points end in the middle while the rest are spread out across the sides.

*More info on Normal Distribution: **Normal Distribution – MathIsFun*

In Brownian motion, the values can be negative. However, stock prices can’t be negative.

Thus, in finance, we use geometric Brownian motion to model our stock prices.

Geometric Brownian motion (GBM) is essentially regular Brownian motion but with an upward drift.

The end result of all these GBM movements is a skewed bell shaped output.

This skewed bell-shaped curve no longer resembles a normal distribution. It now resembles a log-normal distribution.

**Stochastic Calculus = Regular Calculus + Randomness**

When we zoom in on a curve chart, we get a nice curve line. We can then measure the rate of increase using those slopes.

Now let’s look at a chart with randomness.

If we zoom in, we see that it looks… somewhat the same.

We can keep zooming in but we will not be able to find a smooth curve. Without a smooth curve, we can’t draw those slope lines productively.

Thus, normal calculus will fail here. This is why we need stochastic calculus.

**Stochastic Calculus Mathematics**

The main aspects of stochastic calculus revolve around Itô calculus, named after Kiyoshi Itô.

The main equation in Itô calculus is Itô’s lemma. This equation takes into account Brownian motion.

Itô’s lemma:

Explanation: Change in X = Constant A * change in time + Constant B * change due to randomness as modeled by Brownian motion.

Which means the change in the value of a variable = some constant value over time + change due to randomness multiplied by another constant.

*More info on the derivation of Itô’s lemma: **Derivation of Itô’s lemma by Math Partner*

A variation of Itô’s lemma that uses GBM is:

Before we explain it. Let’s replace X (a regular variable) with S (stock price) so that you can visualize this better.

In this case, we try to link the equation to finance. Let S be stock price.

Explanation: Change in S = Constant A * Current S * change in time + Constant B * Current S * change due to randomness as modeled by GBM

Which means the change in the stock price = current stock price multiplied by some constant value over time +

current stock price + change due to randomness multiplied by another constant.

That should intuitively make sense as over time, the change of the stock price is based on some overall trend (the Constant A part) and an element of randomness (the Constant B part and randomness part).

Constant A and Constant B are usually derived by analyzing historical market data.

**Finance and Stochastic Calculus**

This is where we relate everything we’ve just said to finance.

In 1900, Louis Bachelier, a mathematician, first introduced the idea of using geometric Brownian motion (GBM) on stock prices.

His theory is later built upon by Robert Merton and Paul Samuelson in their work on options pricing. They won an Nobel Prize in Economics for it.

Essentially, these mathematicians argue that GBM can be used to model stock prices because it is said that:

- The GBM process has only positive values. Stock prices only has positive values.
- Expected value of the data in the next time period has nothing to do with the last time period. Similarly, it is said that the expected value of the stock price in the next time period has nothing to do with the last time period
- The GBM chart is rough and random. Stock prices look rough and random.
- Calculations with GBM processes are relatively easy

However, those points above are debatable.

- In reality, the randomness and volatility changes over time. In GBM, the volatility is assumed to be constant.
- In reality, there are sudden jumps in prices. In GBM, there are not.
- In reality, the stock prices may not be random and log-normally distributed in the long run. In GBM, they are.

Stochastic calculus as applied to finance, is a form of pseudo science. There are assumptions that may not hold in real-life. Some of the assumptions are there for the convenience of mathematical modelling.

**Black Scholes Model – Application to Finance**

The most famous application of stochastic calculus to finance is to price options (options are a special financial instrument that gives the holder the choice to buy or sell an asset at a certain price).

The main intuition is that the price of an option is the cost of hedging it.

By hedging, we mean that we can separately create a combination of stocks and cash to mimic the market exposure of the option.

Thus, the cost of this hedging process should be the price that option is worth.

Price of option = cost of hedging with stock and cash.

Now, we can calculate the price of the option if we assume that the stock can be modeled using Ito’s lemma, which brings us back to the equation above:

Using the above equation and the fact that the price of the option = cost of hedging with stock and cash, we can derive our Black-Scholes equation

Black-Scholes Equation

We are not going to do the derivation here as it is too technical.

*Here is the derivation: **Paul Wilmott on Quantitative Finance, Chapter 5, Black-Scholes*

Once you solve that equation and turn it into a form that we can plug in figures and use, you’ll get the Black-Scholes Formula:

*This is how you get from the equation to the formula: *

** Links to Other Explanations**

- Outline of Stochastic Calculus (Video) – Maths Partner
- Geometric Brownian Motion – Wikipedia
- Black-Scholes Model – Wikipedia
- Black-Scholes Equation – Wikipedia

**Related Terms**

The post Stochastic Calculus appeared first on Wiki @ AlgoTrading101.

]]>The post Options Trading Basics appeared first on Wiki @ AlgoTrading101.

]]>An option gives the option holder a choice to buy or sell a pre-agreed asset at a certain pre-agreed price.

**Description**

There are 2 main types of options: 1) Call option and 2) Put option.

Call options gives the option holder a choice to *buy* a pre-agreed asset at a certain pre-agreed price.

Put options gives the option holder a choice to *sell *a pre-agreed asset at a certain pre-agreed price.

This pre-agreed asset is called the underlying asset, in other words, it is the asset that is attached to this option.

This pre-agreed price is called the strike price.

**Example of an Option Trade**

*Call option example:*

Trader A buys the Apple’s call option at strike price $190. In this case, Apple is the underlying asset.

Let’s assume Apple is trading at $180 today. Trader A’s call option is not very valuable as we can buy Apple stock directly for $180. Thus, we don’t want to exercise the choice to buy it at $190 (a more expensive price).

If Apple goes to $200 tomorrow, Trader A’s call option becomes more valuable. We can now exercise our choice to buy Apple at $190 and immediately sell Apple at the exchange for $200 (a $10 profit).

*Put option example:*

Trader B buys the Google’s put option at strike price $1200.

Let’s assume Google is trading at $1300 today. Trader B’s put option is not very valuable as we can sell Google in the market for $1300. Thus, we don’t want to exercise the choice to sell it at $1200 (a lower price).

If Google drops to $1100 tomorrow, Trader B’s put option becomes more valuable. We can now immediately buy Google from the exchange at $1100 and exercise our choice to sell Google at $1200 (a $100 profit).

**Payoff Charts**

We use charts to get a better look at our payoffs, i.e. how much we will make (or lose) as the underlying asset’s price moves.

From the diagram above, we can see that when the payoff is:

- $50. The payoff is $0.
- $40. The payoff is $10.
- $30. The payoff is $20.
- $20. The payoff is $30.

This makes sense as if we own this put option when the underlying is $30, we can immediately buy the underlying from the exchange at $30, and exercise our choice to sell it at $50. Thus, netting a $20 profit.

To exercise an option means to buy or sell the underlying assets at the pre-agreed strike price.

**Moneyness**

Moneyness describes how we name options at different profit or loss levels. There are 3 terms used to describe this:

- In-the-money (ITM): Our payoff is positive.
- At-the-money (ATM): Our payoff is zero. Strike price = Underlying asset’s price.
- Out-of-the-money (OTM): Our payoff is zero (or negative after considering the cost of the option).
- For call options, strike price is greater than underlying asset’s price.
- For put options, strike price is less than underlying asset’s price.

**Expiration**

Options expire at a certain pre-agreed date.

If the options holder did not exercise the option by then, the option becomes worthless if it is ATM or OTM. If the option is ITM, it will be automatically exercised.

**Cost of Options (Premiums)**

If the stock goes higher than your call option strike price, you make profits. If it doesn’t, you don’t make losses. It might seem like a deal too good to be true.

And yes, it is.

The catch is that you need to pay to buy call or put options. The costs of the option is known as the premium.

The premium goes up as the the option gets more ITM as we need to take into account the profit already accumulated by this option.

The premium goes down as the option gets less ITM as we need to take into account that the profit is far in sight.

The premium shifts your diagram down, as you need to earn the premium amount before you go on to make a profit.

This is an example of some of Apple’s options as viewed in a trading terminal:

**Selling Options**

Traders are able to sell options too. The payoff will be the exact opposite of that of an option buyer.

In this case we are selling that option without first owning it. When you do that, you are said to have shorted that option.

Option buyers pay a premium and hope that the option goes ITM.

Option sellers receive a premium and hope that the option does not go ITM.

In this aspect, options seller have a limit on how much they can make but their potential losses are unlimited. Vice versa for option buyers.

**Option Combinations – Strategies**

You can combine different options to create unique structures. Here is a short non-exhaustive list:

- Straddle
- Put Spreads
- Iron Condor

*Straddle*

When Trader A buys a call option and a put option at the same strike price, the resulting position is a long straddle.

The above is your payoff diagram when you long a straddle.

You long a straddle when you want to bet that there is going to be a big move, but you’re not sure if the move will be up or down.

The cost of this trade is double that of a regular call or put option.

The above is your payoff diagram when you short a straddle.

This involves selling a call and put option at the same strike price.

You short a straddle when you want to bet that there isn’t going to be much movement.

*Put Spread*

When Trader A sells a put option at strike price A and buys a put at strike price B (where B is greater than A), the resulting position is a long put spread.

The rationale of this trade is that you want to bet that the underlying asset will fall by a little. But you want some insurance to protect yourself if the price rises.

The long put option at strike price B will provide that insurance. The cost of this insurance is the premium of that put option.

A long put spread is also known as a bear put spread or vertical spread.

When Trader A buys a put option at strike price A and sells a put at strike price B (where B is greater than A), the resulting position is a short put spread.

The rationale of this trade is that you want to bet that the underlying asset will rise by a little. But you want some insurance to protect yourself if the price falls.

The long put option at strike price A will provide that insurance. The cost of this insurance is the premium of that put option.

A short put spread is also known as a bull put spread or vertical spread.

*Iron Condor*

The iron condor is formed by buying a put option at strike A, selling a put option at strike B, selling a call option at strike C and buying a call option at strike D.

The rationale of this trade is that you want to bet that the underlying stock price will stay between B and C.

You give up some profits (when the underlying is between B and C) in order to gain some premiums from selling 2 options, to reduce the cost of this structure.

*We have only listed 3 option strategies that can be made by combining options and stocks. Here are 40 more option strategies: **Options Strategies – Optionsplaybook.com*

**Why Trade Options**

- To create creative trades by trading structures as seen in the above section.
- To hedge certain exposure. Think of this as buying insurance on your trades by giving up potential gains.
- To leverage. Option premiums are relatively low compared to the potential gains. (This doesn’t mean trading options is generally profitable.)

**Regular Options**

These are common options that are traded in the markets.

*American Options*

These are the most common options which can be exercised anytime. Despite it’s name, it has nothing to do with American stocks.

*European Options*

These are options which can only be exercised on expiration. Despite it’s name, it has nothing to do with European stocks.

**Exotic Options**

There also exist unique options with quirky features.

*Barrier Options*

These come into existence or become worthless once the underlying asset reaches a certain pre-agreed price.

*Asian Options*

Asian options’ payoffs are determined by the average price of the underlying asset over a pre-set period of time.

*Basket Options*

Basket Options are based on more than one underlying asset. The payoff of the basket option is based on the average price of a group of underlying assets.

*Lookback Options*

Lookback options have no strike price initially. On the expiry date, the option holder will choose a strike price among all the prices that have occurred during the lifetime of the option. Usually the holder will choose the most favorable strike price.

*We have covered 4 exotic options, read about another 8 more here: **What are Exotic Options – Corporate Finance Institute.*

** Links to Other Explanations**

**Related Terms**

The post Options Trading Basics appeared first on Wiki @ AlgoTrading101.

]]>The post Backtesting Biases and Risks appeared first on Wiki @ AlgoTrading101.

]]>Backtesting biases refer to how the results of a trading strategy backtest can be misleading.

**Description**

Here are the 8 common biases:

- Black Swan Reconciliation
- Survivorship Bias
- Spreads
- Cost of carry/Holding costs
- Inaccurate Price Simulation
- Change in Contract Specifications
- Look-ahead Bias
- Curve-Fitting and Optimization Bias

**Bias 1 – Black Swan Reconciliation**

Black swan events refer to events that come as a surprise and have a huge impact.

Brokers and exchanges may alter the prices of assets after a volatile price moves (black swan events). There are 2 types of alteration.

__Type 1 – Changing the fill price__

After an unexpected large price move, brokers and exchanges might change the prices that you got filled on your trades.

*Example*

EURUSD is trading at 1.1300. A black swan event occurs and EURUSD spikes up 2000 pips (to 1.3300) (1 pip = $0.0001).

You long EURUSD 1000 pips into the 2000 pips move. You are long EURUSD at 1.2300. It is now trading at 1.3300. You close the trade at a 1000 pips profit.

A few hours after the trade, you receive an email saying that “In view of this unexpected event, all trades will be cleared at 1.1800 price”.

Your 2000 pips profit becomes a 500 pips loss. Your account gets wiped out.

Real example: Saxo Trades Lawsuits With Clients After Swiss Currency Turmoil

__Type 2 – Changing their historical price__

After an unexpected large price move, brokers and exchanges might not change the prices that you got filled on your trades.

However, they alter the price on the historical charts and data. Thus, the prices you see in your charts are different (almost always worse) than the prices you get in live trading.

In your backtests, you might have bought Apple shares at $180, but in real life, you would have gotten those shares at $250.

**Bias 2 – Survivorship Bias**

Survivorship bias, or survival bias, refers to the fact that people overlook entities/processes that failed because they only see successful entities/processes.

__Example__

We are selecting a bunch of stocks to trade. We create a list of criteria to identify potentially successful stocks.

Next, we filter the universe of stocks listed in the US based on these criteria.

And with that, survivorship bias just got to us. This universe of stocks only includes stocks that survive. There may be stocks that are delisted but fit our criteria.

We need to consider those stocks as well to give us an idea of how sound our strategy is.

**Bias 3 – Spreads**

The difference between the price we can buy at (bid price) and the price we can sell at (ask price) is called the spread.

Spreads change in real time. It depends on the buyers and sellers on exchanges, or brokers.

During volatile events, spreads usually widen, sometimes by a 100 times.

Without accurate bid and ask data, these spread widening events will make our backtests inaccurate.

**Bias 4 – Cost of carry/Holding costs**

If you are leveraged (you trade a size larger your capital by borrowing from the broker), shorting or trading a derivative, you might need to pay interest to hold your positions.

This interest represents the fees needed to cover the capital loaned to you, or the costs to hold any underlying assets.

These holding costs might vary without warning during the lifetime of a trade. Hence, it is difficult to estimate these costs in your backtest.

__Example__

The usual interest cost to short a stock is less than 2% a year.

However, for a period in early 2019, the cost to short Tilray, a cannabis stock shot up to over 800% a year.

**Bias 5 – Inaccurate Price Simulation**

Not all backtesters replicate the exact historical price movement, some use simulated fake price movements.

This might not be significant if you make a few trades a year and analyze the market using end-of-day data.

However, your backtest results will be greatly skewed if your strategy is related to scalping (price action and movement) and fires many trade per day on lower timeframe data.

**Bias 6 – Change in Contract Specifications**

An exchange or broker may change the contract specifications (i.e. details) of their products.

For instance, they may increase margin requirements, change the settlement specifications or contract size of their products. These may lead to jumps in market prices.

The main takeaway here is – in such cases, do not take a price change at face value. Your P&L may not change proportionally to a price change.

For instance, increasing the margin requirement for silver may cause silver prices to fall. In your backtest, your short silver position may look like it is doing well. However, if you had traded that move in real-life, you may get a margin call and be forced to close the position.

__Real-life examples__

- Margin change didn’t cause silver slide – CME
- ICE Changes Gold Contracts Specifications, Opts for Physical Delivery of Bullion

**Bias 7 – Look-ahead Bias**

Look-ahead bias involves having prior knowledge of how the market behaves before running a backtest.

__Example__

You want to run a strategy that takes advantage of trends. You look for assets that trend and discard those that don’t trend.

You then run a backtest on these assets using a trending strategy. Unsurprisingly, your strategy does well.

These tests are not useful as you have only chosen assets that you know would have done well in your backtests.

**Bias 8 – Curve-Fitting and Optimization Bias**

Curve fitting is the process of adapting a trading system so closely to the past that it becomes ineffective in the future.

Optimizing strategies too closely to past data will result in inflexibility to adapt to the future. Hence, it leads to poor performance in the future.

We need to adapt our trading strategies to signals in historical data, not noise.

** Links to Other Explanations**

- Backtesting Biases and How To avoid them – Auquan
- Backtesting bias and how we avoid it – Keepstock
- 9 Mistakes Quants Make that Cause Backtest to Lie – Dr Balch

**Related Terms**

- Algorithmic Trading Strategies
- Backtesting (Upcoming)
- Market Inefficiencies

The post Backtesting Biases and Risks appeared first on Wiki @ AlgoTrading101.

]]>The post Big Data appeared first on Wiki @ AlgoTrading101.

]]>Big data is a field that involves analyzing and managing huge amounts of data.

**Description**

Similar to smaller data sets, the usual aim of big data is to derive insights from large data sets.

There isn’t a specific size to determine if a data set is big enough to be considered big data.

A data set can be considered big data if the organization has difficulty using traditional methods, software and database to manage their data.

**Characteristics of Big Data**

__Volume__

This refers to the quantity of data.

__Velocity__

This refers to the speed at which the data is received and needs processing.

Data from real-time sources usually requires much faster management and processing capabilities, especially when the insights from the data need to be extracted quickly.

__Variety__

This refers to the type of data. The common types are:

- Text
- Numbers
- Audio
- Imagery
- Video

Another way to categorize data is structured vs unstructured data.

Structured data is organised and formatted in a way that is easily searchable, processed and analyzed.

Unstructured data has no pre-defined organization or format. This makes it harder to search, process and analyze.

__Veracity__

This refers to accuracy of the data.

__Value__

This refers to how much useful insights can be derived from the data.

__Variability__

This refers to the consistency of the flow of data. The creation of some data peak during certain times, days or months, but slow down during other times.

__Complexity__

This refers to how complex it is to clean, match, link and manage the data. This characteristic is especially important when there are multiple data sources.

**Big data in Industries**

Big data is common in the following industries:

- Manufacturing
- Media
- Government
- Social Media
- Finance
- Healthcare
- Insurance
- Technology

**Examples of Big Data in Action**

- Millions of surveillance cameras capture videos of the public across the country. Machine learning is then used to identify faces.
- Spotify tracks the data of its users. It then analyzes this data to recommend the users music they might like.
- Uber generates and uses a huge amount of data regarding drivers, their vehicles, locations, every trip from every vehicle. These data are analyzed to predict the demand, supply, location of the drivers and decide whether to slap on a surcharge.

** Links to Complicated Explanations**

**Related Terms**

The post Big Data appeared first on Wiki @ AlgoTrading101.

]]>The post High-Frequency Trading appeared first on Wiki @ AlgoTrading101.

]]>High-frequency trading (HFT) describes trading that require high computing and communication speeds.

**Description**

HFT is characterized by high communication and computing speed, large number of trades, low profit per trade and expensive software infrastructure.

High-frequency traders use communication speed to profit and outwit other traders.

**Strategy types**

__Arbitrage__

*Main article: Arbitrage*

Arbitrage trades happen when an asset is priced differently on 2 exchanges and a trader buys the cheaper one while shorting the pricier one.

__Reaction to news__

When a major news is released, the trader who reacts the fastest wins. In this case, the high-frequency trader needs to analyze the news and fire the trade before everyone else

__Latency Arbitrage__

When a traditional (slower) hedge fund buys a large amount of Stock A, a HFT hedge fund will detect that.

The HFT hedge fund will then buy all the Stock A on the other exchanges and sell it back to the slower hedge fund for a small profit.

The HFT hedge fund might do this millions of times over a day.

__Statistical Arbitrage__

A large number of similar stocks might move in a similar manner. When any of the stocks diverge, the high-frequency trader will buy the cheaper one and/or short the pricier one.

__Index Arbitrage__

An index or exchange-traded fund is designed to track the returns of an index such as the S&P500.

__Other strategies__

HFT is a secretive field. Once a strategy is revealed and the other funds join in, the profit opportunity disappears fast.

Thus, many new strategies are innovated everyday and are not known to the general public.

**Investment in infrastructure**

HFT funds spend hundreds of millions on hardware and software infrastructure to reduce their computing and communication speed by the milliseconds.

Since relative speed is more important than absolute speed, HFT funds constantly try to be faster than their rivals.

Investments in infrastructure includes building a straight tunnel to lay communication lines and shifting their servers right beside the exchange’s servers.

**Examples of Popular High-Frequency Firms**

- Virtu Financial
- Citadel Securities
- Two Sigma Securities
- Tower Research Capital

** Links to Complicated Explanations**

**Related Terms**

- Statistical Arbitrage (Coming soon)
- Exchange-traded fund (Coming soon)
- Machine Learning

The post High-Frequency Trading appeared first on Wiki @ AlgoTrading101.

]]>The post Data Science appeared first on Wiki @ AlgoTrading101.

]]>Data science is a field that focuses on extracting useful information from data.

**Description**

The aim of data science is to get predictive or useful information from data.

Data science has become a buzzword that can be broadly used to represent business analytics, business intelligence and predictive modeling.

**3 Concepts of Data Science**

Data science combines the fields of strategy, statistics and programming.

__Strategy__

Since the aim of data science is to extract useful information for a certain goal, data scientists need to understand the goal well.

Examples of such goals are to:

- Improve business revenue
- Lower business costs
- Find trading opportunities in the markets
- Solve engineering tasks
- Create self-driving cars

Once the data scientist understands the goal and its underlying mechanics, he or she will be able to devise an appropriate strategy to analyze and extract information that will be useful for that goal.

__Statistics__

The data scientist needs good knowledge of statistics in order to analyze the data in an appropriate way.

Misusing statistics might lead to results that are misleading or erroneous.

Machine learning and big data management are complementary skills here.

__Programming__

Programming skills are needed for the data scientist to apply their statistical skill to the data.

**Examples of Data Science**

- Google uses its vast amount of data to determine which search results are the most relevant.
- Netflix applies machine learning to its users’ data to determine what shows are they more likely keen on.
- Paypal analyzes its users and their transactions to spot possible fraud.

** Links to Complicated Explanations**

**Related Terms**

The post Data Science appeared first on Wiki @ AlgoTrading101.

]]>The post Cryptocurrency appeared first on Wiki @ AlgoTrading101.

]]>Cryptocurrencies are digital money.

**Description**

Cryptocurrencies are digital money that are tracked using a virtual accounting system called the blockchain.

Cryptocurrencies are stored in virtual wallets. The blockchain records the number of cryptocurrency coins every wallet has and all the transfers that have ever occurred.

Anyone can verify the transactions in the blockchain by setting up computers or servers to ensure all the transactions tally.

In exchange, they are rewarded with coins for their work. Those who do this are called miners.

The most common cryptocurrency coins are Bitcoin (BTC) and Ethereum (ETH).

**3 Broad Uses of Cryptocurrencies**

There are many cryptocurrencies with different uses. They fall into 3 broad categories.

__Store of value, medium of exchange__

Cryptocurrencies can be spent to buy goods or services. In this aspect, they are similar to fiat currencies or gold.

__Smart contracts__

A smart contract is a code that enforces certain action when an event occurred.

Example: If Wallet A receives Coin X, Wallet A will return Coin Y to the sender of Coin X.

In this case, the smart contract is attached to Wallet A. The action and events coded onto the smart contract has to be digitally trackable.

Smart contracts can interact with non-digital events if an entity is appointed to input the results of the non-digital event. This entity is known as an oracle.

Example: If the temperature in City X falls below 32 degrees Fahrenheit, based on weather.com, Wallet A must send 10 coins to Wallet B. In this case, weather.com is the oracle.

__Asset tracking__

Cryptocurrencies can be pegged to an external value such as the US Dollar or Gold.

However, it is up to the creator of that cryptocurrency to devise a way to ensure that the cryptocurrency accurately tracks the external asset.

The most common way to do this is to store the external asset and issue only the equivalent value in cryptocurrency coins.

For instance, if Crypto X is pegged to the value of the US dollar, it might store 1 billion USD in its bank and issue out 1 billion USD worth of Coin X.

**Storing Cryptocurrencies**

Cryptocurrencies are stored in virtual wallets.

Most wallets are designed to only store certain cryptocurrencies. If you have 2 different coins, you will usually need 2 different wallets.

**Transaction Mechanics**

Transferring of coins are usually cheap and fast.

Wallets and smart contracts submit a transfer request to the blockchain and the miners will add that transaction to it.

**Characteristics of Transactions**

__Irreversible__

After a transaction has been confirmed by the miners, it cannot be reversed.

__Semi-anonymous__

Wallets are not connected to real-world identities.

__Fast and Global__

Transactions can be completed within seconds or minutes.

This time does not change even if the person you are sending the coins to is physically far away.

You can send coins to anyone around the world

__Permissionless __

No one can prevent you from setting up wallets, and sending/receiving coins. (You do need access to the Internet though.)

**Examples of Popular Cryptocurrencies**

- Bitcoin
- Ethereum
- Ripple
- Litecoin
- EOS

** Links to Complicated Explanations**

**Related Terms**

The post Cryptocurrency appeared first on Wiki @ AlgoTrading101.

]]>The post Arbitrage appeared first on Wiki @ AlgoTrading101.

]]>An arbitrage happens when an asset is priced differently on 2 exchanges and a trader buys the cheaper one while shorting the pricier one.

**Description**

There are 3 main methods to execute an arbitrage trade.

__First – Betting on Convergence__

Buy asset A on exchange X and simultaneously short asset A on exchange Y.

In this trade, we assume that the price of asset A on exchange X and Y will converge eventually.

However, there is a risk that the price does not converge if there are external market constraints – such as an exchange halting fund withdrawals, or certain countries limit currency inflow/outflow.

This requires you to pay an interest cost to short asset A on exchange Y.

__Second – Moving Assets__

Buy asset A on exchange X, transfer asset A to exchange Y, sell it for a higher price.

The risk here relates to time. If the price difference disappears during the time it takes for the asset transfer to happen, the trader might not be able to sell the asset for a higher (profitable) price on exchange Y.

This requires you to pay a cost to transfer assets between exchanges.

__Third – Moving Assets with Insurance__

This is a hybrid of the above 2 methods.

Buy asset A on exchange X and simultaneously short asset A on exchange Y.

Next, transfer asset A to exchange Y, close your short trade with the transferred asset.

In this trade, you need to pay both the cost of shorting and asset transfer.

**Risk-Free vs Low Risk**

Ideally, an arbitrage trade is risk-free. In practice, the risks might be low but is not completely risk-free.

Here are some of the common risks:

- Time risk
- Exchange risk
- Counterparty risk
- Regulation risk
- Country-related risk
- Execution risk
- Liquidity risk
- Default risk

**Arbitrage involving more than 2 assets**

Arbitrage can occur when there are more than 2 assets. This is common in the Forex markets.

Currency arbitrage in 3 currency pairs occurs when their prices don’t match up.

For instance, if CurACurB = 2 and CurBCurC = 4, CurACurC should be 8.

Thus, if CurACurC is not 8, we can enter an arbitrage trade.

*CurA represents Currency A. *

*CurACurB = 2 means that it takes 2 units of CurB to buy 1 unit of CurA.*

**Examples**

- In mid-2017, cryptocurrencies were priced 30% higher in Korea than in other countries. This is because there was a limitation by the Korean government on capital outflows.
- Gold futures were priced different in COMEX (futures exchange in US) and TOCOM (futures exchange in Japan) in the early 2000s, even after taking into consideration of the currency exchange rate.
- If CurACurB = 2, CurBCurC = 4, CurACurC is 16. We long CurACurB, CurBCurC and short CurACurC.

** Links to Complicated Explanations**

**Related Terms**

- Statistical Arbitrage (Coming soon)
- Position Sizing (Coming soon)
- Market Inefficiencies

The post Arbitrage appeared first on Wiki @ AlgoTrading101.

]]>The post Machine Learning appeared first on Wiki @ AlgoTrading101.

]]>Machine learning techniques enable computers to do things without being told explicitly how to do them.

**Description**

The essence of machine learning is the ability for computers to learn by analyzing data or through its own experience.

__Traditional Computing Rules:__

If an image has 4 legs, fur, pointy ears and whiskers, label it as a cat.

__Machine Learning Rules:__

We give the computer 1000 cat pictures and 1000 pictures that are not cats. After analyzing these 2000 pictures, the computer will be able to tell if a picture contains a cat.

**Advantages of Machine Learning**

- Being able to analyze large quantities of data without being explicitly told what to look for
- Being able to understand texts (in large quantities and different languages)
- Being able to interpret images
- Being able to come up with creative solutions
- Being able to analyze and output a prediction fast

**Machine Learning Training Techniques**

Machine learning techniques are essentially methods to train a computer. A computer has to be trained before it can perform on its own.

There are 3 main types of training techniques – 1) Supervised Learning, 2) Unsupervised Learning and 3) Reinforcement Learning

__Supervised Learning__

We train our computers with data that is labelled correctly.

The above cat example uses a supervised training method. The computer analyzes the labelled cat data and creates a set of rules on its own to decide what defines a cat.

__Unsupervised Learning__

The computer is given a set of data without labels, and it has to make sense of it.

Unsupervised learning is mainly used to find patterns and common traits between the data points.

For instance, a computer is given 1000 unlabeled pictures of horses and 1000 unlabeled pictures of dogs. It is then tasked to divide the pictures into 2 piles.

__Reinforcement Learning__

The computer is told what its objective is, then tries to figure out the best way to achieve it.

For example, we are trying to teach a robot with 2 legs to walk. The robot uses reinforcement learning to walk in many different ways until it finds the optimal way to move.

In 2019, Google’s DeepMind developed AlphaStar (a computer trained using reinforcement learning), a Starcraft 2 gaming robot. This robot defeated one of the world’s top Starcraft 2 players.

**Programming Languages**

The common programming languages used to code machine learning techniques are:

- Python
- C++
- Javascript
- R

**Difference between Machine Learning (ML) and Artificial Intelligence (AI)**

AI is a broad concept that covers the idea that machines can do tasks and behave in ways that we consider are smart and independent.

ML is concerned with getting machines to improve and learning through data or experience.

**Examples of Machine Learning Use Cases**

- ML enables your email system to differentiate spam and legitimate emails
- ML enables a computer to recognize your voice and understand your commands
- ML enables your surveillance cameras to recognize millions of faces a day
- ML helps social media companies identify what your likes and dislikes are

**Examples of Popular ML Training Techniques/Algorithms**

- Naïve Bayes Classifier Algorithm
- K Means Clustering Algorithm
- Support Vector Machine Algorithm
- Apriori Algorithm
- Linear Regression
- Logistic Regression
- Artificial Neural Networks
- Random Forests
- Decision Trees
- K Nearest Neighbors
- Convolution Neural Network
- Recurrent Neural Network

** Links to Complicated Explanations**

**Related Terms**

- Python
- Algorithmic Trading Strategies
- Deep Learning

The post Machine Learning appeared first on Wiki @ AlgoTrading101.

]]>