Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
100% found this document useful (1 vote)
1K views

Advanced Algorithmic Trading

Uploaded by

Mohini Thakur
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
1K views

Advanced Algorithmic Trading

Uploaded by

Mohini Thakur
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

Advanced Algorithmic Trading

Disclaimer
This workshop is for educational purposes only and does not constitute an offer to
sell, a solicitation to buy, or a recommendation for any security; nor does it
constitute an offer to provide investment advisory or other services by the
speakers. Nothing contained herein constitutes investment advice or offers any
opinion with respect to the suitability of any security and any views expressed
herein should not be taken as advice to buy, sell, or hold any security or as an
endorsement of any security or company. The speakers are not responsible for the
losses incurred due to the buying and selling of securities.
Outline
● How price moves ?

● Building a Trading Strategy

● Backtest

● Trading strategy analysis

● Resources of finding Trading Strategies


Market Microstructure

Source: ResearchGate
Outline
● How price moves ?

● Building a Trading Strategy

● Backtest

● Trading strategy analysis

● Resources of finding Trading Strategies


Ideation
● White paper: Academia, Institutional, Financial Journals.

● Blog/Articles: Research articles, Institutional blogs, Independent Traders blogs

● Economic Theory: Macro/Micro-economics, underlyings fundamentals

● Price patterns: Volatility, Trend, news reactions, price anomalies

● Alternative data: News/Twitter sentiments, Corporate flights, Web-scraping


COVID Crash Prediction
Data
● Price : OHLC Bar, Trades, NBBO etc

● Volume: Time Bar and Tick by Tick Size.

● Order Book: Limit order book (LOB)

● Fundamentals: PE ratio, Profit/Loss, Quick ratio, EV/EBITDA etc

● Sentiments: Market sentiments and News sentiments

● Alternative data
Betting Sizing
● Risk Management: Proper bet sizing helps manage risk by controlling the amount of capital at stake
in each trade. Effective risk management is vital to preserving capital and avoiding significant
drawdowns.

● Optimal Returns: Bet sizing strategies can be designed to optimize returns over the long run. An
effective bet sizing strategy contributes to overall profitability and improved risk-adjusted returns.

● Consistency: Consistency in bet sizing allows traders to establish a systematic approach to their
trading activities. Consistent bet sizing also aids in tracking and evaluating trading performance over
time, enabling traders to make data-driven adjustments to their strategies.
(i) Fixed Bet Size
This strategy involves placing a
fixed dollar amount or percentage
of capital on each trade, regardless
of the risk or potential reward. For
example, a trader may decide to
invest $1,000 or 2% of their
portfolio on every trade. This
approach provides consistency but
does not take into account the
specific risk levels of individual
trades.
(ii) Kelly Criterion
The Kelly Criterion is a formula that
calculates the optimal position size
based on the probability of success and
the potential reward-to-risk ratio. It takes
into account both the trader's edge and
the volatility of the instrument being
traded. The formula suggests the
percentage of capital to be allocated,
which is proportional to the expected
return and inversely proportional to the
risk.
(iii) Volatility Scaling
Volatility scaling, also known as
volatility-based position sizing,
is a strategy that adjusts the
position size of a trade based
on the volatility of the underlying
asset. The concept behind
volatility scaling is to allocate a
larger position size when the
asset's volatility is lower and a
smaller position size when the
volatility is higher.
Outline
● How price moves ?

● Building a Trading Strategy

● Backtest

● Trading strategy analysis

● Resources of finding Trading Strategies


Motivation behind Backtesting
● Does the trading strategy you have
hypothesised even perform ?

● Backtest is a process of testing the


historical performance of a trading
strategy. It is used as to check the if a
strategy works on past and what
performance we can expect in future.

● A backtest is a simulation which can be


used for sanity check on the hypothesis
behind the strategy and various factors
under a given scenario of the market.

● Backtest is not an experiment and


shouldn’t aimed to prove profitability of a
strategy as it is only historical
performance.
Seven Sins of Quantitative Investing*
1. Survivorship bias: Ignoring the stocks that have gone bust or delisted in past and only considering the
existing stocks in the sample. This can lead to overestimation of historical performance. E.g.- Only
considering the current composition of SP500.

2. Look-ahead bias: Using information that is not available at the current moment.

3. Storytelling: Making up a story ex-post to justify some random pattern in the result.

4. Data snooping: Using the test sample for tuning the strategy and improving the backtest.

5. Transaction cost: Ignoring the transaction cost results inaccurate backtest results. While including
transaction cost some strategies that were profitable earlier may fail.

6. Outliers: A backtest is severely skewed if it performance (profit or loss) is heavily dependent on few
extreme outcomes that is observed in past. E.g.: Financial crash, Tech Boom.

7. Shorting: Shorting involves finding lender who can lend securities, which is dependent on inventory,
relative demand and markets.
Types of Backtest algorithms

Vectorized For Loop Event Driven

● Vectorized the ● The backtest is ● Uses market


backtesting loop executed using a for simulation and runs
using Numpy/Pandas loop. the backtest as
events takes place.
● Fastest ● Slower than
vectorized. ● Slowest
● Not a reliable
backtest. Is used as a ● Not a reliable ● The most reliable
sanity check. backtest. Is used as a backtest.
sanity check.
● Easy to implement. ● Difficult to implement.
● Easy to implement.
Outline
● How price moves ?

● Building a Trading Strategy

● Backtest

● Trading strategy analysis

● Resources of finding Trading Strategies


Risk and Performance Metrics (1)
● Cumulative Returns

● Annualized Return
Risk and Performance Metrics (2)
● Annualized Volatility

● Annualized Sharpe Ratio


Risk and Performance Metrics (3)
● Skewness

Source: wikipedia

● Kurtosis
Risk and Performance Metrics (4)
● Maximum Drawdown
Risk and Performance Metrics (5)
● VaR (Value at Risk)

Source: wikipedia
Outline
● How price moves ?

● Building a Trading Strategy

● Backtest

● Trading strategy analysis

● Resources of finding Trading Strategies


(i) QuantPedia : https://quantpedia.com/
(ii) Research Papers
● SSRN: https://www.ssrn.com/

● arXiv: https://arxiv.org/

● RePEc: http://repec.org/
(iii) Blogs/Articles
● Medium : https://medium.com/

● Quantocracy: https://quantocracy.com/

● ML Quant: https://www.ml-quant.com/
References
● Michael Halls-Moore. Successful Algorithmic Trading

● Yves Hilpisch. Python for Finance

● Chan, 2013. Algorithmic Trading: Winning Strategies and Their Rationale

● Lopez de Prado, 2018. Advances in Financial Machine Learning

● Luo et al. [2014]. “Seven Sins of Quantitative Investing”

● Arnott, Robert D. and Harvey, Campbell R. and Markowitz, Harry, A Backtesting Protocol in the
Era of Machine Learning (November 21, 2018). Available at SSRN:
https://ssrn.com/abstract=3275654 or http://dx.doi.org/10.2139/ssrn.3275654

● Bailey, David H. and Borwein, Jonathan and Borwein, Jonathan and López de Prado, Marcos
and López de Prado, Marcos and Zhu, Qiji Jim, Pseudo-Mathematics and Financial
Charlatanism: The Effects of Backtest Overfitting on Out-of-Sample Performance (April 1,
2014). Notices of the American Mathematical Society, 61(5), May 2014, pp.458-471, Available
at SSRN: https://ssrn.com/abstract=2308659 or http://dx.doi.org/10.2139/ssrn.2308659
QNA

You might also like