SlideShare a Scribd company logo
Get started with algorithmic trading
From Python installation to backtesting your
first strategy
Vivek Krishnamoorthy
26th August 2021
All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti.
All investments and trading in the stock market involve risk. Any decisions to
place trades in the financial markets, including trading in stock or options or
other financial instruments is a personal decision that should only be made after
thorough research, including a personal risk and financial assessment and the
engagement of professional assistance to the extent you believe necessary. The
trading strategies or related information mentioned in this presentation is for
informational purposes only.
2
DISCLAIMER
All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti.
● About us
● About the speaker
● Objectives
● Installing Python
● The key libraries that we use
● Trying stuff with market data (the Pythonic way!)
● Steps to building a quant trading strategy
● And what data do we use there?
● Backtest a sample trading strategy (on our workstation)
● How about a trading strategy on Blueshift (a cloud-based research and
trading platform)?
● Is that all it takes? (Hint: No)
● The fine print: What I haven’t touched upon
● Conclusion
3
Today’s agenda
Note:
The blue parts covered on the slide deck
The orange parts via a Jupyter Notebook
The green parts on the Blueshift platform
All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti.
About us
4
All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti.
Vivek Krishnamoorthy
● Head – Research & Content, QuantInsti
● Over 15 years of experience in industry and academia in leading institutions
across India, Singapore and Canada
● Co-author of
■ “Python basics: With illustrations from the financial markets” (2019)
■ “A rough-and-ready guide to algorithmic trading” (2020)
● Bachelors’ in electronics & telecom engineering from VESIT (Mumbai
University), and an MBA from NTU Singapore.
5
About the speaker
All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti.
Objectives
All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti.
● To give you a whistle-stop tour of the most popular tools used in algo trading.
Specifically, we’ll touch upon
■ Python and its data science stack
■ Additional libraries used in quant finance
■ Backtesting
■ Blueshift
7
Objectives
All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti.
Installing Python
All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti.
● Broadly two ways
■ Directly: So we go to python.org and download
■ Via distributions: Many choices here
● Anaconda (recommended)
● Miniconda
● PyCharm
● Active State and lots more...
9
Installing Python
All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti.
● Using the command-line interface
○ By directly typing ‘python’ or ‘ipython’ at the Anaconda prompt
● Jupyter Notebook
○ A browser based interface which allows you to interleave code, output,
explanations in a single file
● JupyterLab
○ Similar to Jupyter Notebook
● Spyder IDE
○ Standard GUI similar to languages like MATLAB, R, C++, etc.
10
Accessing Python
All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti.
The libraries that matter to us
All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti.
Algorithmic Trading: Definition(s!)
12
Python and its constellation of frequently used libraries
All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti.
Playing with market data
(Pythonically!)
All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti.
Steps to build a quant trading
strategy
All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. 15
Steps to build a quant trading strategy
• Code the
strategy/rules
using a suitable
programming
language like
Python
• In case you don’t
program, there
are tools and
functionalities
integrated
within trading
platforms to
help build your
strategy
• Process to
validate your
strategy by
testing its
performance on
historical data
• Gauge how it
would have
performed
based on
metrics like
Dollar PnL,
Percentage of
profitable
trades, Sharpe
Ratio, etc.
• Paper trade
your filtered
strategies on
real market
data (NOT in
the real
markets)
• Can be done via
paper trading
using demo
accounts or
simulators
• No actual
buying or selling
happens here
• Let the strategy
do its job in the
live markets
now!
• Monitor
performance
and manage
operational
risks
Convert
the rules
into code
Backtest
on
historical
data
Paper
trade/
Demo
trade
Live
trading
• Can be from past
experience, data
analysis,
research or just a
hunch!
• Think about
what, why and
when to buy/sell?
• Decide the
Entry/Exit
conditions for
each trade
Idea
All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti.
And what data do we use?
All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. 17
Types of data
Market data
• Price
• Volume
• Open Interest, etc.
Technical indicators
• Moving Averages
• RSI
• Bollinger Bands, etc.
Fundamental info.
• Company specific
• Macro - GDP, inflation
etc.
Alternative data
• News
• Twitter sentiments
• Satellite image data, etc.
All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti.
Backtesting a sample trading
strategy (on our workstations)
All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti.
Taking a spin on Blueshift (a cloud-
based research and trading
platform)
All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti.
Is that all it takes? (Hint: No)
All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. 21
Quant finance: An interdisciplinary field
All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti.
The fine print: What I haven’t
touched upon
All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti.
● The backtests we ran on our workstation as well as on Blueshift are only the
starting point
● We arrived at the strategies arbitrarily. In reality, it takes effort to find
durable and consistently profitable strategies
● Can we rely on the results of the backtests we just ran? Definitely not. There
were many simplifying assumptions made like buying and selling at open or
close. This is realistically not possible due to slippage.
● We also have to consider transaction costs, taxes, brokerage.
● The key is create a portfolio of trading strategies which should together
(hopefully!) give us reliable returns.
23
The fine print
All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti.
Concluding words
All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. 25
Concluding words
● Unlike the perception, algo trading does not have to be complicated!
● Some of the most successful strategies have very simple ideas like
averages and standard deviations behind them.
● Make realistic plans i.e. automating your workflow part-by-part. For
ex. the # of assets you scan can be automated (while trading can still
be manual)
● There are no shortcuts
● It’s not a sprint, it’s a marathon
All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. 26
Quantra:
Interactive
Courses
QuantInsti
Blogs
Books by
QuantInsti
Blueshift: Research
& Trading Platform
Continue the learning
All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti.
Q and A
27
All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti.
Complete
Webinar
Recording
28
All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti.
Thank you for
your time and
attention. :)
29

More Related Content

More from QuantInsti

Big Data And The Future Of Retail Investing
Big Data And The Future Of Retail InvestingBig Data And The Future Of Retail Investing
Big Data And The Future Of Retail Investing
QuantInsti
 
Backtest of Short Straddles on SPX Index
Backtest of Short Straddles on SPX IndexBacktest of Short Straddles on SPX Index
Backtest of Short Straddles on SPX Index
QuantInsti
 
Pairs Trading In the Brazilian Stock Market
Pairs Trading In the Brazilian Stock MarketPairs Trading In the Brazilian Stock Market
Pairs Trading In the Brazilian Stock Market
QuantInsti
 
How To Set Up Automated Trading
How To Set Up Automated TradingHow To Set Up Automated Trading
How To Set Up Automated Trading
QuantInsti
 
How To Set Up Automated Trading
How To Set Up Automated TradingHow To Set Up Automated Trading
How To Set Up Automated Trading
QuantInsti
 
Quantitative Data Analysis of Cryptocurrencies
Quantitative Data Analysis of CryptocurrenciesQuantitative Data Analysis of Cryptocurrencies
Quantitative Data Analysis of Cryptocurrencies
QuantInsti
 
Introduction to Quantitative Trading - Investment Management Club of Yale Uni...
Introduction to Quantitative Trading - Investment Management Club of Yale Uni...Introduction to Quantitative Trading - Investment Management Club of Yale Uni...
Introduction to Quantitative Trading - Investment Management Club of Yale Uni...
QuantInsti
 
How to automate an options day trading strategy
How to automate an options day trading strategyHow to automate an options day trading strategy
How to automate an options day trading strategy
QuantInsti
 
Predict daily stock prices with random forest classifier, technical indicator...
Predict daily stock prices with random forest classifier, technical indicator...Predict daily stock prices with random forest classifier, technical indicator...
Predict daily stock prices with random forest classifier, technical indicator...
QuantInsti
 
How Pandemics Impact the Financial Markets - A Quantitative Analysis
How Pandemics Impact the Financial Markets - A Quantitative AnalysisHow Pandemics Impact the Financial Markets - A Quantitative Analysis
How Pandemics Impact the Financial Markets - A Quantitative Analysis
QuantInsti
 
Masterclass: Natural Language Processing in Trading with Terry Benzschawel & ...
Masterclass: Natural Language Processing in Trading with Terry Benzschawel & ...Masterclass: Natural Language Processing in Trading with Terry Benzschawel & ...
Masterclass: Natural Language Processing in Trading with Terry Benzschawel & ...
QuantInsti
 
Webinar on Algorithmic Trading - Why make the move? with Vivek Krishnamoorthy...
Webinar on Algorithmic Trading - Why make the move? with Vivek Krishnamoorthy...Webinar on Algorithmic Trading - Why make the move? with Vivek Krishnamoorthy...
Webinar on Algorithmic Trading - Why make the move? with Vivek Krishnamoorthy...
QuantInsti
 
Backtesting And Live Trading With Interactive Brokers Using Python With Dr. H...
Backtesting And Live Trading With Interactive Brokers Using Python With Dr. H...Backtesting And Live Trading With Interactive Brokers Using Python With Dr. H...
Backtesting And Live Trading With Interactive Brokers Using Python With Dr. H...
QuantInsti
 
Algorithmic Trading in FX Market By Dr. Alexis Stenfors
Algorithmic Trading in FX Market By Dr. Alexis StenforsAlgorithmic Trading in FX Market By Dr. Alexis Stenfors
Algorithmic Trading in FX Market By Dr. Alexis Stenfors
QuantInsti
 
Risk Management: Maximising Long-Term Growth Presentation
Risk Management: Maximising Long-Term Growth PresentationRisk Management: Maximising Long-Term Growth Presentation
Risk Management: Maximising Long-Term Growth Presentation
QuantInsti
 
How EPAT Can Help You! Presentation
How EPAT Can Help You! PresentationHow EPAT Can Help You! Presentation
How EPAT Can Help You! Presentation
QuantInsti
 
Modelling Trading Strategies In Equities Presentation
Modelling Trading Strategies In Equities PresentationModelling Trading Strategies In Equities Presentation
Modelling Trading Strategies In Equities Presentation
QuantInsti
 
Webinar Mean Reversion Strategies Presentation
Webinar Mean Reversion Strategies PresentationWebinar Mean Reversion Strategies Presentation
Webinar Mean Reversion Strategies Presentation
QuantInsti
 
AMA Session On Algorithmic Trading Presentation
AMA Session On Algorithmic Trading PresentationAMA Session On Algorithmic Trading Presentation
AMA Session On Algorithmic Trading Presentation
QuantInsti
 
Classification of quantitative trading strategies webinar ppt
Classification of quantitative trading strategies webinar pptClassification of quantitative trading strategies webinar ppt
Classification of quantitative trading strategies webinar ppt
QuantInsti
 

More from QuantInsti (20)

Big Data And The Future Of Retail Investing
Big Data And The Future Of Retail InvestingBig Data And The Future Of Retail Investing
Big Data And The Future Of Retail Investing
 
Backtest of Short Straddles on SPX Index
Backtest of Short Straddles on SPX IndexBacktest of Short Straddles on SPX Index
Backtest of Short Straddles on SPX Index
 
Pairs Trading In the Brazilian Stock Market
Pairs Trading In the Brazilian Stock MarketPairs Trading In the Brazilian Stock Market
Pairs Trading In the Brazilian Stock Market
 
How To Set Up Automated Trading
How To Set Up Automated TradingHow To Set Up Automated Trading
How To Set Up Automated Trading
 
How To Set Up Automated Trading
How To Set Up Automated TradingHow To Set Up Automated Trading
How To Set Up Automated Trading
 
Quantitative Data Analysis of Cryptocurrencies
Quantitative Data Analysis of CryptocurrenciesQuantitative Data Analysis of Cryptocurrencies
Quantitative Data Analysis of Cryptocurrencies
 
Introduction to Quantitative Trading - Investment Management Club of Yale Uni...
Introduction to Quantitative Trading - Investment Management Club of Yale Uni...Introduction to Quantitative Trading - Investment Management Club of Yale Uni...
Introduction to Quantitative Trading - Investment Management Club of Yale Uni...
 
How to automate an options day trading strategy
How to automate an options day trading strategyHow to automate an options day trading strategy
How to automate an options day trading strategy
 
Predict daily stock prices with random forest classifier, technical indicator...
Predict daily stock prices with random forest classifier, technical indicator...Predict daily stock prices with random forest classifier, technical indicator...
Predict daily stock prices with random forest classifier, technical indicator...
 
How Pandemics Impact the Financial Markets - A Quantitative Analysis
How Pandemics Impact the Financial Markets - A Quantitative AnalysisHow Pandemics Impact the Financial Markets - A Quantitative Analysis
How Pandemics Impact the Financial Markets - A Quantitative Analysis
 
Masterclass: Natural Language Processing in Trading with Terry Benzschawel & ...
Masterclass: Natural Language Processing in Trading with Terry Benzschawel & ...Masterclass: Natural Language Processing in Trading with Terry Benzschawel & ...
Masterclass: Natural Language Processing in Trading with Terry Benzschawel & ...
 
Webinar on Algorithmic Trading - Why make the move? with Vivek Krishnamoorthy...
Webinar on Algorithmic Trading - Why make the move? with Vivek Krishnamoorthy...Webinar on Algorithmic Trading - Why make the move? with Vivek Krishnamoorthy...
Webinar on Algorithmic Trading - Why make the move? with Vivek Krishnamoorthy...
 
Backtesting And Live Trading With Interactive Brokers Using Python With Dr. H...
Backtesting And Live Trading With Interactive Brokers Using Python With Dr. H...Backtesting And Live Trading With Interactive Brokers Using Python With Dr. H...
Backtesting And Live Trading With Interactive Brokers Using Python With Dr. H...
 
Algorithmic Trading in FX Market By Dr. Alexis Stenfors
Algorithmic Trading in FX Market By Dr. Alexis StenforsAlgorithmic Trading in FX Market By Dr. Alexis Stenfors
Algorithmic Trading in FX Market By Dr. Alexis Stenfors
 
Risk Management: Maximising Long-Term Growth Presentation
Risk Management: Maximising Long-Term Growth PresentationRisk Management: Maximising Long-Term Growth Presentation
Risk Management: Maximising Long-Term Growth Presentation
 
How EPAT Can Help You! Presentation
How EPAT Can Help You! PresentationHow EPAT Can Help You! Presentation
How EPAT Can Help You! Presentation
 
Modelling Trading Strategies In Equities Presentation
Modelling Trading Strategies In Equities PresentationModelling Trading Strategies In Equities Presentation
Modelling Trading Strategies In Equities Presentation
 
Webinar Mean Reversion Strategies Presentation
Webinar Mean Reversion Strategies PresentationWebinar Mean Reversion Strategies Presentation
Webinar Mean Reversion Strategies Presentation
 
AMA Session On Algorithmic Trading Presentation
AMA Session On Algorithmic Trading PresentationAMA Session On Algorithmic Trading Presentation
AMA Session On Algorithmic Trading Presentation
 
Classification of quantitative trading strategies webinar ppt
Classification of quantitative trading strategies webinar pptClassification of quantitative trading strategies webinar ppt
Classification of quantitative trading strategies webinar ppt
 

Recently uploaded

Instant Issue Debit Cards
Instant Issue Debit CardsInstant Issue Debit Cards
Instant Issue Debit Cards
egoetzinger
 
Eco-Innovations and Firm Heterogeneity. Evidence from Italian Family and Nonf...
Eco-Innovations and Firm Heterogeneity.Evidence from Italian Family and Nonf...Eco-Innovations and Firm Heterogeneity.Evidence from Italian Family and Nonf...
Eco-Innovations and Firm Heterogeneity. Evidence from Italian Family and Nonf...
University of Calabria
 
Donald Trump Presentation and his life.pptx
Donald Trump Presentation and his life.pptxDonald Trump Presentation and his life.pptx
Donald Trump Presentation and his life.pptx
SerdarHudaykuliyew
 
Scope Of Macroeconomics introduction and basic theories
Scope Of Macroeconomics introduction and basic theoriesScope Of Macroeconomics introduction and basic theories
Scope Of Macroeconomics introduction and basic theories
nomankalyar153
 
Patronage and Good Governance 5.pptx pptc
Patronage and Good Governance 5.pptx pptcPatronage and Good Governance 5.pptx pptc
Patronage and Good Governance 5.pptx pptc
AbdulNasirNichari
 
一比一原版(UoB毕业证)伯明翰大学毕业证如何办理
一比一原版(UoB毕业证)伯明翰大学毕业证如何办理一比一原版(UoB毕业证)伯明翰大学毕业证如何办理
一比一原版(UoB毕业证)伯明翰大学毕业证如何办理
nexop1
 
Intro_Economics_ GPresentation Week 4.pptx
Intro_Economics_ GPresentation Week 4.pptxIntro_Economics_ GPresentation Week 4.pptx
Intro_Economics_ GPresentation Week 4.pptx
shetivia
 
Turin Startup Ecosystem 2024 - Ricerca sulle Startup e il Sistema dell'Innov...
Turin Startup Ecosystem 2024  - Ricerca sulle Startup e il Sistema dell'Innov...Turin Startup Ecosystem 2024  - Ricerca sulle Startup e il Sistema dell'Innov...
Turin Startup Ecosystem 2024 - Ricerca sulle Startup e il Sistema dell'Innov...
Quotidiano Piemontese
 
The European Unemployment Puzzle: implications from population aging
The European Unemployment Puzzle: implications from population agingThe European Unemployment Puzzle: implications from population aging
The European Unemployment Puzzle: implications from population aging
GRAPE
 
一比一原版(UCSB毕业证)圣芭芭拉分校毕业证如何办理
一比一原版(UCSB毕业证)圣芭芭拉分校毕业证如何办理一比一原版(UCSB毕业证)圣芭芭拉分校毕业证如何办理
一比一原版(UCSB毕业证)圣芭芭拉分校毕业证如何办理
bbeucd
 
when will pi network coin be available on crypto exchange.
when will pi network coin be available on crypto exchange.when will pi network coin be available on crypto exchange.
when will pi network coin be available on crypto exchange.
DOT TECH
 
How to get verified on Coinbase Account?_.docx
How to get verified on Coinbase Account?_.docxHow to get verified on Coinbase Account?_.docx
How to get verified on Coinbase Account?_.docx
Buy bitget
 
An Overview of the Prosocial dHEDGE Vault works
An Overview of the Prosocial dHEDGE Vault worksAn Overview of the Prosocial dHEDGE Vault works
An Overview of the Prosocial dHEDGE Vault works
Colin R. Turner
 
where can I find a legit pi merchant online
where can I find a legit pi merchant onlinewhere can I find a legit pi merchant online
where can I find a legit pi merchant online
DOT TECH
 
Managing marketing information to gain customer insights
Managing marketing information to gain customer insightsManaging marketing information to gain customer insights
Managing marketing information to gain customer insights
sanamalam3
 
Tdasx: Unveiling the Trillion-Dollar Potential of Bitcoin DeFi
Tdasx: Unveiling the Trillion-Dollar Potential of Bitcoin DeFiTdasx: Unveiling the Trillion-Dollar Potential of Bitcoin DeFi
Tdasx: Unveiling the Trillion-Dollar Potential of Bitcoin DeFi
nimaruinazawa258
 
Instant Issue Debit Cards - School Designs
Instant Issue Debit Cards - School DesignsInstant Issue Debit Cards - School Designs
Instant Issue Debit Cards - School Designs
egoetzinger
 
2. Elemental Economics - Mineral demand.pdf
2. Elemental Economics - Mineral demand.pdf2. Elemental Economics - Mineral demand.pdf
2. Elemental Economics - Mineral demand.pdf
Neal Brewster
 
1. Elemental Economics - Introduction to mining.pdf
1. Elemental Economics - Introduction to mining.pdf1. Elemental Economics - Introduction to mining.pdf
1. Elemental Economics - Introduction to mining.pdf
Neal Brewster
 
Financial Assets: Debit vs Equity Securities.pptx
Financial Assets: Debit vs Equity Securities.pptxFinancial Assets: Debit vs Equity Securities.pptx
Financial Assets: Debit vs Equity Securities.pptx
Writo-Finance
 

Recently uploaded (20)

Instant Issue Debit Cards
Instant Issue Debit CardsInstant Issue Debit Cards
Instant Issue Debit Cards
 
Eco-Innovations and Firm Heterogeneity. Evidence from Italian Family and Nonf...
Eco-Innovations and Firm Heterogeneity.Evidence from Italian Family and Nonf...Eco-Innovations and Firm Heterogeneity.Evidence from Italian Family and Nonf...
Eco-Innovations and Firm Heterogeneity. Evidence from Italian Family and Nonf...
 
Donald Trump Presentation and his life.pptx
Donald Trump Presentation and his life.pptxDonald Trump Presentation and his life.pptx
Donald Trump Presentation and his life.pptx
 
Scope Of Macroeconomics introduction and basic theories
Scope Of Macroeconomics introduction and basic theoriesScope Of Macroeconomics introduction and basic theories
Scope Of Macroeconomics introduction and basic theories
 
Patronage and Good Governance 5.pptx pptc
Patronage and Good Governance 5.pptx pptcPatronage and Good Governance 5.pptx pptc
Patronage and Good Governance 5.pptx pptc
 
一比一原版(UoB毕业证)伯明翰大学毕业证如何办理
一比一原版(UoB毕业证)伯明翰大学毕业证如何办理一比一原版(UoB毕业证)伯明翰大学毕业证如何办理
一比一原版(UoB毕业证)伯明翰大学毕业证如何办理
 
Intro_Economics_ GPresentation Week 4.pptx
Intro_Economics_ GPresentation Week 4.pptxIntro_Economics_ GPresentation Week 4.pptx
Intro_Economics_ GPresentation Week 4.pptx
 
Turin Startup Ecosystem 2024 - Ricerca sulle Startup e il Sistema dell'Innov...
Turin Startup Ecosystem 2024  - Ricerca sulle Startup e il Sistema dell'Innov...Turin Startup Ecosystem 2024  - Ricerca sulle Startup e il Sistema dell'Innov...
Turin Startup Ecosystem 2024 - Ricerca sulle Startup e il Sistema dell'Innov...
 
The European Unemployment Puzzle: implications from population aging
The European Unemployment Puzzle: implications from population agingThe European Unemployment Puzzle: implications from population aging
The European Unemployment Puzzle: implications from population aging
 
一比一原版(UCSB毕业证)圣芭芭拉分校毕业证如何办理
一比一原版(UCSB毕业证)圣芭芭拉分校毕业证如何办理一比一原版(UCSB毕业证)圣芭芭拉分校毕业证如何办理
一比一原版(UCSB毕业证)圣芭芭拉分校毕业证如何办理
 
when will pi network coin be available on crypto exchange.
when will pi network coin be available on crypto exchange.when will pi network coin be available on crypto exchange.
when will pi network coin be available on crypto exchange.
 
How to get verified on Coinbase Account?_.docx
How to get verified on Coinbase Account?_.docxHow to get verified on Coinbase Account?_.docx
How to get verified on Coinbase Account?_.docx
 
An Overview of the Prosocial dHEDGE Vault works
An Overview of the Prosocial dHEDGE Vault worksAn Overview of the Prosocial dHEDGE Vault works
An Overview of the Prosocial dHEDGE Vault works
 
where can I find a legit pi merchant online
where can I find a legit pi merchant onlinewhere can I find a legit pi merchant online
where can I find a legit pi merchant online
 
Managing marketing information to gain customer insights
Managing marketing information to gain customer insightsManaging marketing information to gain customer insights
Managing marketing information to gain customer insights
 
Tdasx: Unveiling the Trillion-Dollar Potential of Bitcoin DeFi
Tdasx: Unveiling the Trillion-Dollar Potential of Bitcoin DeFiTdasx: Unveiling the Trillion-Dollar Potential of Bitcoin DeFi
Tdasx: Unveiling the Trillion-Dollar Potential of Bitcoin DeFi
 
Instant Issue Debit Cards - School Designs
Instant Issue Debit Cards - School DesignsInstant Issue Debit Cards - School Designs
Instant Issue Debit Cards - School Designs
 
2. Elemental Economics - Mineral demand.pdf
2. Elemental Economics - Mineral demand.pdf2. Elemental Economics - Mineral demand.pdf
2. Elemental Economics - Mineral demand.pdf
 
1. Elemental Economics - Introduction to mining.pdf
1. Elemental Economics - Introduction to mining.pdf1. Elemental Economics - Introduction to mining.pdf
1. Elemental Economics - Introduction to mining.pdf
 
Financial Assets: Debit vs Equity Securities.pptx
Financial Assets: Debit vs Equity Securities.pptxFinancial Assets: Debit vs Equity Securities.pptx
Financial Assets: Debit vs Equity Securities.pptx
 

Get Started With Algorithmic Trading: From Python Installation to Backtesting Your First Strategy | COMPLETE PRESENTATION

  • 1. Get started with algorithmic trading From Python installation to backtesting your first strategy Vivek Krishnamoorthy 26th August 2021
  • 2. All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. All investments and trading in the stock market involve risk. Any decisions to place trades in the financial markets, including trading in stock or options or other financial instruments is a personal decision that should only be made after thorough research, including a personal risk and financial assessment and the engagement of professional assistance to the extent you believe necessary. The trading strategies or related information mentioned in this presentation is for informational purposes only. 2 DISCLAIMER
  • 3. All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. ● About us ● About the speaker ● Objectives ● Installing Python ● The key libraries that we use ● Trying stuff with market data (the Pythonic way!) ● Steps to building a quant trading strategy ● And what data do we use there? ● Backtest a sample trading strategy (on our workstation) ● How about a trading strategy on Blueshift (a cloud-based research and trading platform)? ● Is that all it takes? (Hint: No) ● The fine print: What I haven’t touched upon ● Conclusion 3 Today’s agenda Note: The blue parts covered on the slide deck The orange parts via a Jupyter Notebook The green parts on the Blueshift platform
  • 4. All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. About us 4
  • 5. All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. Vivek Krishnamoorthy ● Head – Research & Content, QuantInsti ● Over 15 years of experience in industry and academia in leading institutions across India, Singapore and Canada ● Co-author of ■ “Python basics: With illustrations from the financial markets” (2019) ■ “A rough-and-ready guide to algorithmic trading” (2020) ● Bachelors’ in electronics & telecom engineering from VESIT (Mumbai University), and an MBA from NTU Singapore. 5 About the speaker
  • 6. All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. Objectives
  • 7. All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. ● To give you a whistle-stop tour of the most popular tools used in algo trading. Specifically, we’ll touch upon ■ Python and its data science stack ■ Additional libraries used in quant finance ■ Backtesting ■ Blueshift 7 Objectives
  • 8. All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. Installing Python
  • 9. All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. ● Broadly two ways ■ Directly: So we go to python.org and download ■ Via distributions: Many choices here ● Anaconda (recommended) ● Miniconda ● PyCharm ● Active State and lots more... 9 Installing Python
  • 10. All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. ● Using the command-line interface ○ By directly typing ‘python’ or ‘ipython’ at the Anaconda prompt ● Jupyter Notebook ○ A browser based interface which allows you to interleave code, output, explanations in a single file ● JupyterLab ○ Similar to Jupyter Notebook ● Spyder IDE ○ Standard GUI similar to languages like MATLAB, R, C++, etc. 10 Accessing Python
  • 11. All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. The libraries that matter to us
  • 12. All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. Algorithmic Trading: Definition(s!) 12 Python and its constellation of frequently used libraries
  • 13. All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. Playing with market data (Pythonically!)
  • 14. All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. Steps to build a quant trading strategy
  • 15. All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. 15 Steps to build a quant trading strategy • Code the strategy/rules using a suitable programming language like Python • In case you don’t program, there are tools and functionalities integrated within trading platforms to help build your strategy • Process to validate your strategy by testing its performance on historical data • Gauge how it would have performed based on metrics like Dollar PnL, Percentage of profitable trades, Sharpe Ratio, etc. • Paper trade your filtered strategies on real market data (NOT in the real markets) • Can be done via paper trading using demo accounts or simulators • No actual buying or selling happens here • Let the strategy do its job in the live markets now! • Monitor performance and manage operational risks Convert the rules into code Backtest on historical data Paper trade/ Demo trade Live trading • Can be from past experience, data analysis, research or just a hunch! • Think about what, why and when to buy/sell? • Decide the Entry/Exit conditions for each trade Idea
  • 16. All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. And what data do we use?
  • 17. All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. 17 Types of data Market data • Price • Volume • Open Interest, etc. Technical indicators • Moving Averages • RSI • Bollinger Bands, etc. Fundamental info. • Company specific • Macro - GDP, inflation etc. Alternative data • News • Twitter sentiments • Satellite image data, etc.
  • 18. All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. Backtesting a sample trading strategy (on our workstations)
  • 19. All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. Taking a spin on Blueshift (a cloud- based research and trading platform)
  • 20. All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. Is that all it takes? (Hint: No)
  • 21. All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. 21 Quant finance: An interdisciplinary field
  • 22. All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. The fine print: What I haven’t touched upon
  • 23. All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. ● The backtests we ran on our workstation as well as on Blueshift are only the starting point ● We arrived at the strategies arbitrarily. In reality, it takes effort to find durable and consistently profitable strategies ● Can we rely on the results of the backtests we just ran? Definitely not. There were many simplifying assumptions made like buying and selling at open or close. This is realistically not possible due to slippage. ● We also have to consider transaction costs, taxes, brokerage. ● The key is create a portfolio of trading strategies which should together (hopefully!) give us reliable returns. 23 The fine print
  • 24. All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. Concluding words
  • 25. All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. 25 Concluding words ● Unlike the perception, algo trading does not have to be complicated! ● Some of the most successful strategies have very simple ideas like averages and standard deviations behind them. ● Make realistic plans i.e. automating your workflow part-by-part. For ex. the # of assets you scan can be automated (while trading can still be manual) ● There are no shortcuts ● It’s not a sprint, it’s a marathon
  • 26. All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. 26 Quantra: Interactive Courses QuantInsti Blogs Books by QuantInsti Blueshift: Research & Trading Platform Continue the learning
  • 27. All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. Q and A 27
  • 28. All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. Complete Webinar Recording 28
  • 29. All rights reserved. © QuantInsti Quantitative Learning Pvt. Ltd. Not to be distributed without written permission from QuantInsti. Thank you for your time and attention. :) 29