0% found this document useful (0 votes)
50 views

Chapter 1 - Quantitative Trading Overview

The document discusses quantitative trading, which utilizes automated systems and algorithms for executing trades based on historical data, contrasting it with fundamental and technical analysis. It outlines the characteristics, pros and cons of quantitative trading, including efficiency, scalability, and the need for programming expertise. Additionally, it covers components such as strategy identification, backtesting, execution systems, and risk management, emphasizing the importance of a scientific approach in developing trading strategies.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views

Chapter 1 - Quantitative Trading Overview

The document discusses quantitative trading, which utilizes automated systems and algorithms for executing trades based on historical data, contrasting it with fundamental and technical analysis. It outlines the characteristics, pros and cons of quantitative trading, including efficiency, scalability, and the need for programming expertise. Additionally, it covers components such as strategy identification, backtesting, execution systems, and risk management, emphasizing the importance of a scientific approach in developing trading strategies.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 51

ARTIFICIAL INTELLIGENCE IN

TRADING
weak form phù hợp dói TA
semi strong form phù hợp dói FA
strong form hong phù hợp dói nào
CHAPTER 1 – QUANTITATIVE TRADING
OVERVIEW

- Fundamental ana: đánh giá gtri nội tại và mua khi price < gtri nội tại, phù hợp với long term. khó định giá, phù hợp với NĐT
- Technical ana: dự đoán xu hướng thay đổi dựa trên bỉu đồ giá và khối lượng mua khi xuất hiện signal, liên quan đến đầu tư ngắn
hạn rủi ro hơn vì có thể bị nhiễu tại thị trường, phù hợp với nhà đầu cơ

đo nội tại bằng các chỉ số

TS. – HUB 08/02/2023 1


CONTENTS
C 1.1 Quantitative Trading concepts
HA
PT
ER
1.2 Characteristics of Quantitative trading
1
1.3 Pros and cons

1.4 Quantitative trading components

1.5 Quantitative trading procedure


TS. – HUB 08/02/2023 2
1.1 Quantitative Trading concepts

Quantitative trading is the use of an automated system to execute


transactions in a predetermined manner using a certain algorithm with no
human involvement.
Synonyms: automated/ systematic/ algorithmic trading

Halls-Moore, 2012
TS. – HUB 08/02/2023 3
1.1 Quantitative Trading concepts

Quantitative trading is the trading of securities based strictly on the buy/sell


decisions of computer algorithms. The computer algorithms are designed and
perhaps programmed by the traders themselves, based on the historical
performance of the encoded strategy tested against historical financial data
Chan, 2013
TS. – HUB 08/02/2023 4
1.1 Quantitative Trading concepts

TS. – HUB 08/02/2023 5


1.2 Quantitative Trading characteristics
Quantitative trading vs Technical analysis?

What happens for the “head


and shoulders pattern” in the
image?

TS. – HUB 08/02/2023 6


TS. – HUB 08/02/2023 7
1.2 Quantitative Trading characteristics
Quantitative trading vs Technical analysis?
Technical analysis can be part of a quantitative trading system if it can be fully encoded as
computer programs. (AVOID subjective and UNquantifiable)
Quantitative Trading includes Technical analysis: revenue, cash flow, debt-to-equity
ratio…

→ Computer
*** can watch thousands
convert information of such
into bits companies
and bytes all at once
that the computer can
understand → quantitative trading
TS. – HUB 08/02/2023 8
1.2 Quantitative Trading characteristics
Scalability
Easy to be scalable (huge number using leverage)
Having steadily increasing profits (NOT 200%/year likely dot-com or
software firm)

Little demand on time


Due to automated algorithms

TS. – HUB 08/02/2023 9


1.2 Quantitative Trading characteristics

Nonnecessity of Marketing
quantitative trading allows you to focus exclusively on your product
(the strategy and the software)

TS. – HUB 08/02/2023 10


1.3 Pros and cons
Pros
Historical Assessment
Performance can be ascertained on historical market data, which is
(hopefully) representative of future market data
called: “backtesting” → providing insight into whether a strategy is likely
to be protable in the future.
TS. – HUB 08/02/2023 11
1.3 Pros and cons
Pros
Efficiency
With a fully automated system → no need to be constantly monitoring the
markets for price action or news input.
Automatically adjust leverage and risk factors dynamically, directly
responding to market dynamics in real-time → impossible manual trading
TS. – HUB 08/02/2023 12
1.3 Pros and cons
Pros
No Discretionary Input
Fear and greed can motivate to carrying out discretionary trading, but it’s
not sufficient in automated trading system.
→ Parameters could be changed by human, but it’s not in trading procedure.

TS. – HUB 08/02/2023 13


1.3 Pros and cons
Pros
Comparison
Systematic strategies provide statistical information on both historical and
current performance → Comparing number of metrics instantly
→ more advantage than a discretionary setting, which only tracks profit &
loss and unregconize potential drawdown risk.
TS. – HUB 08/02/2023 14
1.3 Pros and cons
Pros
Higher frequencies
Systematic strategies provide 24/7 working for many markets at same time
with an automated setting→ These strategies are simply impossible for a
human to carry out.

TS. – HUB 08/02/2023 15


1.3 Pros and cons
Cons
Capital Requirements
Transaction costs: minimum account balance; data extraction for trading;
colocate a server in an exchange; more robust internet connection and
powerful (and thus expensive) desktop machines → increases the monthly
costs
TS. – HUB 08/02/2023 16
1.3 Pros and cons
Cons
Programming Expertise
Requiring the algorithmic trader to be relatively procient both in programming
and scientic modelling.

TS. – HUB 08/02/2023 17


1.3 Pros and cons
Why Python?
Easy learning
Tremendous libraries
Speed of execution
Trade execution: Interactive Brokers (IBypy)
License
TS. – HUB 08/02/2023 18
1.4 Quantitative trading components

Risk Identification
Management

Execution
Backtesting
System

TS. – HUB 08/02/2023 19


1.4 Quantitative trading components
a) Strategy Identification?
Finding an idea is not tough but validating the idea is
really tough.

What is your plan?


Sharing and fixing
TS. – HUB 08/02/2023 20
1.4 Quantitative trading components
a) Strategy Identification?
A mean-reverting strategy: long-term mean on a
“price series” exist, but short term deviations from
this mean will eventually revert.

Example:

TS. – HUB 08/02/2023 21


1.4 Quantitative trading components
a) Strategy Identification?
A momentum strategy: attempts to exploit investor
psychology and big fund structure by "hitching a
ride" on a market trend → momentum in one
direction, and follow the trend until it reverses.
Example:

TS. – HUB 08/02/2023 22


1.4 Quantitative trading components
a) Strategy Identification?
Frequency Trading: low? (> ); high? ( ), or
ultra-high? ( )

TS. – HUB 08/02/2023 23


1.4 Quantitative trading components
a) Strategy Identification?
Your goals?
What if you get 10% profit/year? Worthy? Discuss

TS. – HUB 08/02/2023 24


1.4 Quantitative trading components
a) Strategy Identification?
Your goals?

Be steady if your assets fluctuated. Keep in mind the


long-term profit, not short-term

TS. – HUB 08/02/2023 25


1.4 Quantitative trading components
b) Backtesting
Provide evidence that the strategy is profitable when applied to both
historical and out-of-sample data

Note: 3 common types of bias: look-ahead, survivorship and data-snooping bias

Availability and cleanliness of historical data, and transaction costs


TS. – HUB 08/02/2023 26
1.4 Quantitative trading components
b) Backtesting
Survivorship bias: some trading algorithms were better in the past, not
well working in recent years. Why?
→ stocks are missing → backtesting is not good anymore
→ judging the suitability of a strategy, one must pay particular attention
to its performance in the most recent few years.
TS. – HUB 08/02/2023 27
1.4 Quantitative trading components
b) Backtesting
Data-snooping bias: If you build a trading strategy that has 100 parameters, the
historical performance then will look fantastic, but poor future performance. Why?

→ historical accidents in the past that will not repeat themselves in the future

TS. – HUB 08/02/2023 28


1.4 Quantitative trading components
b) Backtesting những diễn biến trong tlai lặp lại tương đồng trong qk
-> chiến lược đúng theo backtesting

Transaction costs: commission fees charged by the broker (more frequent


trading, more costs paid) (called: liquidity costs)
IF you buy & sell securities using limit orders, you could avoid the
liquidity costs but incur opportunity costs → limit orders may not be
executed →
TS. – HUB 08/02/2023 29
1.4 Quantitative trading components
b) Backtesting
Transaction costs: market impact since you buy a large number of shares
for a stock → move the prices higher

TS. – HUB 08/02/2023 30


1.4 Quantitative trading components
b) Backtesting
“regime shifts”: occur because of changes in securities market regulation
→ financial time series is often nonstationary, due to all of the reasons
given earlier →

TS. – HUB 08/02/2023 31


1.4 Quantitative trading components
b) Backtesting metrics
kỳ vọng > 1: tốt

take risk 1% trả lại LN bao nhieu %

TS. – HUB 08/02/2023 32


1.4 Quantitative trading components
b) Backtesting metrics
Sharpe ratio
An investor owns the portfolio return at 18% last year. The
current risk-free rate is 3%. The standard deviation of the
portfolio was 12%. What is the Sharpe ratio?
What happens since the expected return to 15% and portfolio’s
volatility to drop to 8%, meanwhile the risk-free is the same?
Problem_Sharpe Ration Calculation.xlxs (file 1)
TS. – HUB 08/02/2023 33
1.4 Quantitative trading components
b) Backtesting metrics
Sharpe ratio types:
Buy and hold strategy: keeping an asset to the end of a period.
Example (file 2) (risk-free rate =4%/year; trading days = 252)
Long-short market neutral strategy (hedging strategy): at the
time we buy stock A, we shorted an equal $ amount from a
broker as a hedge → we close both positions at the end.
Example (file2).
TS. – HUB 08/02/2023 34
1.4 Quantitative trading components
b) Backtesting metrics
Maximum drawndown

TS. – HUB 08/02/2023 35


1.4 Quantitative trading components
b) Backtesting metrics
Maximum drawndown
Example (file2)

TS. – HUB 08/02/2023 36


1.4 Quantitative trading components
b) Backtesting metrics
What about Annual Return? Discuss
*Annual Return: varied values if using AR due to the
varying dominator in the formula
For example: leverage return is calculated by account
equity; unleveraged return by market value → not
reliability
TS. – HUB 08/02/2023 37
1.4 Quantitative trading components
c) Execution System
The list of trades generated by the strategy are sent and executed.
For LFT strategies, manual and semi-manual techniques are common.
For HFT strategies it is necessary to create a fully automated execution
mechanism.

TS. – HUB 08/02/2023 38


1.4 Quantitative trading components
c) Execution System
Minimizing transaction costs
Commissions fees: charged by the brokerage
Slippage: between your intended ask and actually value
Spread: between the bid/ask price of the security being traded
TS. – HUB 08/02/2023 39
1.4 Quantitative trading components
c) Execution System
Interface to a brokerage
+ calling up your broker on the telephone
+ fully-automated high-performance Application Programming Interface
(API)
→ Good to automating the execution of trades AMAP
TS. – HUB 08/02/2023 40
1.4 Quantitative trading components
c) Execution System
Interface to a brokerage
LFT: backtesting software (MATLAB, Excel) are good for lower frequency,
simpler strategies
HFT: Python
UFT (Ultra-high): C/C++
TS. – HUB 08/02/2023 41
1.4 Quantitative trading components
c) Execution System
Some notations
Transaction costs can make the difference between an extremely
profitable Sharpe ratio and a terrible Sharpe ratio
Divergence of strategy performance from backtested performance,
especially in HFT (bugs in the execution system, regime shifts…)
TS. – HUB 08/02/2023 42
1.4 Quantitative trading components
d) Risk-management
Risk: everything that could possibly interfere with the trading
implementation.
Ex: technological risk (servers at exchange suddenly have malfunction);
brokerage risk (bankrupt: FTX, Terra)

TS. – HUB 08/02/2023 43


1.4 Quantitative trading components
d) Risk-management
Risk management also seeks optimal capital allocation (capital is
allocated to a set of different strategies), which is a branch of portfolio
theory.
Refer to Keely criterion

TS. – HUB 08/02/2023 44


1.4 Quantitative trading components
d) Risk-management
Risk management also deals with own psychological issue
+ cognitive biases; loss aversion - losing position not be closed due to the
pain of having a loss; profits can be taken too early because of losing fear.
+ recency bias: focus on recent events instead of longer term.
+ emotional biases: fear and greed due to under- or over-leveraging

TS. – HUB 08/02/2023 45


1.5 Quantitative Trading procedure

Scientific Method
What is the scientific approach?

Question → Hypothesis → Testing → Analysis

TS. – HUB 08/02/2023 46


1.5 Quantitative Trading procedure

Scientific Method
Question → Hypothesis → Testing → Analysis

Question (based on OBSERVATIONS): “Is there any relationship


between Gold Price (GPR) and Economic shocks? (ESH)”
TS. – HUB 08/02/2023 47
1.5 Quantitative Trading procedure
Scientific Method
Question → Hypothesis → Testing → Analysis
Hypothesis: explain the observed behaviour
Null Hypothesis: “There is no relationship between two series” (the price
spread is a random walk)
Alternative Hypothesis: There is relationship between two series
TS. – HUB 08/02/2023 48
1.5 Quantitative Trading procedure

Scientific Method
Question → Hypothesis → Testing → Analysis

Testing the hypothesis: Stationary? Cointegration?

TS. – HUB 08/02/2023 49


1.5 Quantitative Trading procedure

Scientific Method
Question → Hypothesis → Testing → Analysis

Analysis: based on the statistical findings, we conclude the strategy.

TS. – HUB 08/02/2023 50


1.5 Quantitative Trading procedure

Scientific Method
What happens if we use another approach, i.e, data mining or black-
box ones? (using a large of input parameters to test strategy?)
→ it is dicult (if not impossible) to determine why a strategy fails.
(due to a lot of parameters)
TS. – HUB 08/02/2023 51

You might also like