SlideShare a Scribd company logo
7
Most read
17
Most read
19
Most read
ALGORITHMIC TRADING
Minor Project
Deb Prakash Ganguly 1401227154
Guided by (ASST PROF.NAMITA BAJPAI)
27,NOVEMBER,2017
C.V RAMAN COLLEGE OF ENGINEERING
.
Algo Trading Short Title 1/23
CONTENTS
• INTRODUCTION
• OBJECTIVE
• SOFTWARE REQUIRED
• ARCHITECTURE
• STRATEGIES
• ALGORITHIM
• OUTPUT GRAPH
• LIMITATIONS
• CONCLUSION
• FUTURE ENHANCEMENT
• REFERENCES
Algo Trading Short Title 2/23
INTRODUCTION
• It is the process of using set of rules or any mathematical
model to generate profits at a high speed frequency that is
impossible for a human trader
• It is simply a way to minimize the cost, market impact and
risk in execution of an order.It is widely used by investment
banks and hedge funds.
Algo Trading Short Title 3/23
OBJECTIVE
• To predict stock prices through lagger indicator.
• Investor will evaluate strategies from a rigorous scientific
perspective to prevent financial crises .
• It will help in portfolio management to make a prediction
individual stocks.
• Trades will be instantly, to avoid significant price changes
Reduced transaction costs or brokerage charge.
• Reduced possibility of mistakes by human traders based
on psychological factors.
Algo Trading Short Title 4/23
SOFTWARE REQUIRED
• Automated trading can be done by c, c++, java script,
ipython, etc.out of which we are using interactive
python(Ipython)
• Most of the quant traders prefer Python algorithmic trading
as it helps them build their own execution mechanisms .
• Python can be used to develop some great treading
platform where using c or c++ is a time consuming job .
• It has packages like Pandas, NumPy, PyAlgoTrade,
MatPlotLib which support google finance, csv files.Are free
of cost.
Algo Trading Short Title 5/23
Interactive python
IPython provides a rich architecture for interactive computing
with:
• A powerful interactive shell.
• A kernel for Jupyter.
• Flexible, amendable interpreters to load into your own
projects.
Algo Trading Short Title 6/23
ARCHITECTURE
• The entire automated trading system can now be broken
down into 3 parts :
• The exchange(s) the external world
• The server
• Market Data receiver
• Store market data
• Store orders generated by the user
• Application
• Take inputs from the user including the trading decisions
• Interface for viewing the information including the data and
orders
• An order manager sending orders to the exchange
Algo Trading Short Title 7/23
Traditional Architecture
Algo Trading Short Title 8/23
NEW ARCHITECTURE
• The traditional architecture could not scale up to the needs
and demands of Automated trading with Direct market
access (DMA).
• The latency between origin of the event to the order
generation went beyond the dimension of human control .
• Order management also needs to be more robust and
capable of handling many more orders per second.
Algo Trading Short Title 9/23
• The infrastructure level of this module is superior
compared to traditional system . Hence the engine which
runs the logic of decision making,is known as the Complex
Event Processing engine, or CEP .
• The risk checks are performed now by a separate Risk
Management System (RMS) within the Order Manager
(OM), just before releasing an order.
Algo Trading Short Title 10/23
Algo Trading Short Title 11/23
• The new architecture was capable of scaling to many
strategies per server, the need to connect to multiple
destinations from a single server emerged.
• The order manager hosted several adapters to send orders
to multiple destinations and receive data from multiple
exchanges.
• To avoid this hassle of adapter addition, standard protocols
have been designed. The most prominent among them is
the FIX (Financial Information Exchange) .
Algo Trading Short Title 12/23
Automated trading Strategies
As per the new architecture is capable of scaling too many
strategies out of which we apply 2 of them .
• Simple Moving Average (SMA)
• The simple moving average is the simplest type of moving
average.
• It is arguably the most popular technical analysis tool used
by traders.
• A simple (or arithmetic) moving average is an arithmetic
moving average calculated by adding the elements in a time
series and dividing this total by the number of time periods.
• [SMA = (Sum of data points in the moving average
period)/(Total number of periods)]
Algo Trading Short Title 13/23
• Exponential Moving Average (EMA or EWMA)
• The simple moving averages are sometimes too simple and
do not work well when there are spikes in the price of the
security. Exponential moving averages give more weight to
the most recent periods. This makes them more reliable
than the SMA and a better representation of the recent
performance of the security.
• alpha = 0.1 to 0.3 [ EMA = (Closing price minus EMA of
previous day/bar) x alpha) + EMA of previous day/bar
Rewritten as: EMA = (Closing price) x alpha + (EMA of
previous day/bar) x (1 minus multiplier)
Algo Trading Short Title 14/23
Algorithm
• Step 1:- Start
• Step 2:- Import packages
• Step 3:-Request for API
• Step 4:-Retrive access token
• Step 5:-Request trade segment in NSE or BSE
• Step 6:-Request for history data for a particular script from
NSE
Algo Trading Short Title 15/23
Algorithm
• Step 7:- Slicing dataframe.
• Step 8:- converting dataframe to csv file.
• Step 9:- calculation SMA[ n/n].
• Step 10:- calculation
EMA[(alpha*prev.close)+(1-alpha*prev.ema)
where alpha=( 2/1-n).
• Step 11:- Cal. EMA for 5,8 and 13 days.
• Step 12:- Convert all csv data to dataframe.
Algo Trading Short Title 16/23
Algorithm
• Step 13:- Plotting graph through dataframe.
• Step 14:- By using euclidean formula, distance between
two lines[dist((x, y), (a, b)) = (x − a)2 + (y − b)2]
• Step 15:- Cal.risk line= [dist((x, y), (a, b)) - [dist((x1, y1),
(a1, b1))
• Step 16:- If risk line == 0, check if (x,y) >(x1,y1) generate
’BUY’ signal else ’SELL’.
Algo Trading Short Title 17/23
Output Graph
Algo Trading Short Title 18/23
Analysis
Algo Trading Short Title 19/23
Limitations
• Algorithmic trading is not 100 percent accurate.We just
predict future stock price basis upon past stock behaviour.
• Algorithmic trading is not universal. one algorithm cannot
be applied to every situation.
• Investor has to check daily news or updates of individual
script.
• Due to this market goes to more volatility.
Algo Trading Short Title 20/23
Conclusion
Trading is extremely difficult for both full time and especially part
time traders.The best road to gain profit is finding your own
trading strategies.Once you got it, is your goals and
objectives.No,trading strategies lasts forever and i find myself
constantly reinventing my strategy.I learned all of these
lessons,and many more from trade academy during my
internship.
Algo Trading Short Title 21/23
Future Enhancement
In year of 2008 SEBI started allowing DMA.In the US and other
developed markets HFT estimated 70 percentage of equity
market share.In India is around 12 percentage. As technology
is growing,financial technology is growing up same space.
In recent years,the number of machine learning packages has
increased in finance trading. some established funds like
Medallion,Citadel,JPmorgan using artificial intelligence, and
there performance is in peak level.
Upcoming years algo trading with AI power will have a huge
impact in Indian market.
Algo Trading Short Title 22/23
References
• Fundamental of dataframe by Yves Hilpisch,2016, p.137
• API connection
website:https://github.com/upstox/upstox-python
• Algo Trading architecture
https://www.quantinsti.com/blog/trading-systems-
architecture
Algo Trading Short Title 23/23

More Related Content

PPTX
Algorithmic trading
PPTX
Algorithmic Trading
PPTX
The Impact of Algorithmic Trading
PPTX
Algorithmic Trading: an Overview
PPTX
Algorithmic Trading
PPTX
Algo trading
PPTX
Algo Trading
PPTX
Classification of quantitative trading strategies webinar ppt
Algorithmic trading
Algorithmic Trading
The Impact of Algorithmic Trading
Algorithmic Trading: an Overview
Algorithmic Trading
Algo trading
Algo Trading
Classification of quantitative trading strategies webinar ppt

What's hot (20)

PPTX
Algorithmic Trading
PPT
Algorithmic Trading-An Introduction
PPTX
Algo trading with machine learning ppt
PPTX
Order book dynamics in high frequency trading
PPTX
Automated Selection and Robustness for Systematic Trading Strategies by Dr. T...
PDF
Secrets Of Successful Traders
PDF
Beware of Low Frequency Data by Ernie Chan, Managing Member, QTS Capital Mana...
PDF
"A Framework-Based Approach to Building Quantitative Trading Systems" by Dr. ...
PPTX
Yield Curve Trading Strategies
PDF
Market Timing, Big Data, and Machine Learning by Xiao Qiao at QuantCon 2016
PDF
Intro to Quant Trading Strategies (Lecture 1 of 10)
ODP
Core Master Trading Strategies
PDF
How To Swing Trade Stocks For Consistent Profits
PPTX
DIY Quant Strategies on Quantopian
PPTX
Algorithmic & quantitative trading webinar
PDF
"Build Effective Risk Management on Top of Your Trading Strategy" by Danielle...
PPTX
Forex trading psychology
DOCX
High frequency trading
PPTX
"How to Run a Quantitative Trading Business in China with Python" by Xiaoyou ...
PPTX
SUPPORT AND RESISTANCE INDICATOR
Algorithmic Trading
Algorithmic Trading-An Introduction
Algo trading with machine learning ppt
Order book dynamics in high frequency trading
Automated Selection and Robustness for Systematic Trading Strategies by Dr. T...
Secrets Of Successful Traders
Beware of Low Frequency Data by Ernie Chan, Managing Member, QTS Capital Mana...
"A Framework-Based Approach to Building Quantitative Trading Systems" by Dr. ...
Yield Curve Trading Strategies
Market Timing, Big Data, and Machine Learning by Xiao Qiao at QuantCon 2016
Intro to Quant Trading Strategies (Lecture 1 of 10)
Core Master Trading Strategies
How To Swing Trade Stocks For Consistent Profits
DIY Quant Strategies on Quantopian
Algorithmic & quantitative trading webinar
"Build Effective Risk Management on Top of Your Trading Strategy" by Danielle...
Forex trading psychology
High frequency trading
"How to Run a Quantitative Trading Business in China with Python" by Xiaoyou ...
SUPPORT AND RESISTANCE INDICATOR
Ad

Similar to Algo trading(Minor Project) strategy EMA with Ipython (20)

PDF
Algo Trading – Best Algorithmic Trading Examples.pdf
PPTX
Presentation (2).pptx
PPTX
Algorithmic trading
PDF
Algorithmic and high-frequency_trading 2011
PDF
Quant congressusa2011algotradinglast
PDF
Careers in Algorithmic Trading
PPTX
Trading Analytics
PDF
computational finance and algorithmic trading
PDF
Building A Trading Desk On Analytics
PDF
Stock prediction and algorithmic trading
PPT
Introduction to Technical Analysis
PDF
max dama on automated trading
PPTX
GDSC x Fintech Algorithmic Investing event
DOCX
Manish final report
PDF
Algorithmic Trading Essentials Python Integration For The Modern Trader Publi...
PDF
algo_Blank
PPTX
Automated Trading
PPTX
Quantinsti’s webinar on algorithmic trading
PPTX
ALGO trading and strategy details provided
PPTX
Traders Cockpit Product Details
Algo Trading – Best Algorithmic Trading Examples.pdf
Presentation (2).pptx
Algorithmic trading
Algorithmic and high-frequency_trading 2011
Quant congressusa2011algotradinglast
Careers in Algorithmic Trading
Trading Analytics
computational finance and algorithmic trading
Building A Trading Desk On Analytics
Stock prediction and algorithmic trading
Introduction to Technical Analysis
max dama on automated trading
GDSC x Fintech Algorithmic Investing event
Manish final report
Algorithmic Trading Essentials Python Integration For The Modern Trader Publi...
algo_Blank
Automated Trading
Quantinsti’s webinar on algorithmic trading
ALGO trading and strategy details provided
Traders Cockpit Product Details
Ad

Recently uploaded (20)

PDF
Predicting Customer Bankruptcy Using Machine Learning Algorithm research pape...
PDF
Topic Globalisation and Lifelines of National Economy.pdf
PPTX
Globalization-of-Religion. Contemporary World
PDF
Lecture1.pdf buss1040 uses economics introduction
PDF
how_to_earn_50k_monthly_investment_guide.pdf
PDF
ECONOMICS AND ENTREPRENEURS LESSONSS AND
PDF
Dialnet-DynamicHedgingOfPricesOfNaturalGasInMexico-8788871.pdf
PDF
Dr Tran Quoc Bao the first Vietnamese speaker at GITEX DigiHealth Conference ...
PDF
Why Ignoring Passive Income for Retirees Could Cost You Big.pdf
PPTX
Basic Concepts of Economics.pvhjkl;vbjkl;ptx
PPTX
Session 14-16. Capital Structure Theories.pptx
PDF
Bladex Earnings Call Presentation 2Q2025
PDF
Q2 2025 :Lundin Gold Conference Call Presentation_Final.pdf
PPTX
The discussion on the Economic in transportation .pptx
PPTX
Who’s winning the race to be the world’s first trillionaire.pptx
PPTX
Antihypertensive_Drugs_Presentation_Poonam_Painkra.pptx
PDF
Corporate Finance Fundamentals - Course Presentation.pdf
PDF
ABriefOverviewComparisonUCP600_ISP8_URDG_758.pdf
PPTX
Session 3. Time Value of Money.pptx_finance
PPTX
Introduction to Managemeng Chapter 1..pptx
Predicting Customer Bankruptcy Using Machine Learning Algorithm research pape...
Topic Globalisation and Lifelines of National Economy.pdf
Globalization-of-Religion. Contemporary World
Lecture1.pdf buss1040 uses economics introduction
how_to_earn_50k_monthly_investment_guide.pdf
ECONOMICS AND ENTREPRENEURS LESSONSS AND
Dialnet-DynamicHedgingOfPricesOfNaturalGasInMexico-8788871.pdf
Dr Tran Quoc Bao the first Vietnamese speaker at GITEX DigiHealth Conference ...
Why Ignoring Passive Income for Retirees Could Cost You Big.pdf
Basic Concepts of Economics.pvhjkl;vbjkl;ptx
Session 14-16. Capital Structure Theories.pptx
Bladex Earnings Call Presentation 2Q2025
Q2 2025 :Lundin Gold Conference Call Presentation_Final.pdf
The discussion on the Economic in transportation .pptx
Who’s winning the race to be the world’s first trillionaire.pptx
Antihypertensive_Drugs_Presentation_Poonam_Painkra.pptx
Corporate Finance Fundamentals - Course Presentation.pdf
ABriefOverviewComparisonUCP600_ISP8_URDG_758.pdf
Session 3. Time Value of Money.pptx_finance
Introduction to Managemeng Chapter 1..pptx

Algo trading(Minor Project) strategy EMA with Ipython

  • 1. ALGORITHMIC TRADING Minor Project Deb Prakash Ganguly 1401227154 Guided by (ASST PROF.NAMITA BAJPAI) 27,NOVEMBER,2017 C.V RAMAN COLLEGE OF ENGINEERING . Algo Trading Short Title 1/23
  • 2. CONTENTS • INTRODUCTION • OBJECTIVE • SOFTWARE REQUIRED • ARCHITECTURE • STRATEGIES • ALGORITHIM • OUTPUT GRAPH • LIMITATIONS • CONCLUSION • FUTURE ENHANCEMENT • REFERENCES Algo Trading Short Title 2/23
  • 3. INTRODUCTION • It is the process of using set of rules or any mathematical model to generate profits at a high speed frequency that is impossible for a human trader • It is simply a way to minimize the cost, market impact and risk in execution of an order.It is widely used by investment banks and hedge funds. Algo Trading Short Title 3/23
  • 4. OBJECTIVE • To predict stock prices through lagger indicator. • Investor will evaluate strategies from a rigorous scientific perspective to prevent financial crises . • It will help in portfolio management to make a prediction individual stocks. • Trades will be instantly, to avoid significant price changes Reduced transaction costs or brokerage charge. • Reduced possibility of mistakes by human traders based on psychological factors. Algo Trading Short Title 4/23
  • 5. SOFTWARE REQUIRED • Automated trading can be done by c, c++, java script, ipython, etc.out of which we are using interactive python(Ipython) • Most of the quant traders prefer Python algorithmic trading as it helps them build their own execution mechanisms . • Python can be used to develop some great treading platform where using c or c++ is a time consuming job . • It has packages like Pandas, NumPy, PyAlgoTrade, MatPlotLib which support google finance, csv files.Are free of cost. Algo Trading Short Title 5/23
  • 6. Interactive python IPython provides a rich architecture for interactive computing with: • A powerful interactive shell. • A kernel for Jupyter. • Flexible, amendable interpreters to load into your own projects. Algo Trading Short Title 6/23
  • 7. ARCHITECTURE • The entire automated trading system can now be broken down into 3 parts : • The exchange(s) the external world • The server • Market Data receiver • Store market data • Store orders generated by the user • Application • Take inputs from the user including the trading decisions • Interface for viewing the information including the data and orders • An order manager sending orders to the exchange Algo Trading Short Title 7/23
  • 9. NEW ARCHITECTURE • The traditional architecture could not scale up to the needs and demands of Automated trading with Direct market access (DMA). • The latency between origin of the event to the order generation went beyond the dimension of human control . • Order management also needs to be more robust and capable of handling many more orders per second. Algo Trading Short Title 9/23
  • 10. • The infrastructure level of this module is superior compared to traditional system . Hence the engine which runs the logic of decision making,is known as the Complex Event Processing engine, or CEP . • The risk checks are performed now by a separate Risk Management System (RMS) within the Order Manager (OM), just before releasing an order. Algo Trading Short Title 10/23
  • 11. Algo Trading Short Title 11/23
  • 12. • The new architecture was capable of scaling to many strategies per server, the need to connect to multiple destinations from a single server emerged. • The order manager hosted several adapters to send orders to multiple destinations and receive data from multiple exchanges. • To avoid this hassle of adapter addition, standard protocols have been designed. The most prominent among them is the FIX (Financial Information Exchange) . Algo Trading Short Title 12/23
  • 13. Automated trading Strategies As per the new architecture is capable of scaling too many strategies out of which we apply 2 of them . • Simple Moving Average (SMA) • The simple moving average is the simplest type of moving average. • It is arguably the most popular technical analysis tool used by traders. • A simple (or arithmetic) moving average is an arithmetic moving average calculated by adding the elements in a time series and dividing this total by the number of time periods. • [SMA = (Sum of data points in the moving average period)/(Total number of periods)] Algo Trading Short Title 13/23
  • 14. • Exponential Moving Average (EMA or EWMA) • The simple moving averages are sometimes too simple and do not work well when there are spikes in the price of the security. Exponential moving averages give more weight to the most recent periods. This makes them more reliable than the SMA and a better representation of the recent performance of the security. • alpha = 0.1 to 0.3 [ EMA = (Closing price minus EMA of previous day/bar) x alpha) + EMA of previous day/bar Rewritten as: EMA = (Closing price) x alpha + (EMA of previous day/bar) x (1 minus multiplier) Algo Trading Short Title 14/23
  • 15. Algorithm • Step 1:- Start • Step 2:- Import packages • Step 3:-Request for API • Step 4:-Retrive access token • Step 5:-Request trade segment in NSE or BSE • Step 6:-Request for history data for a particular script from NSE Algo Trading Short Title 15/23
  • 16. Algorithm • Step 7:- Slicing dataframe. • Step 8:- converting dataframe to csv file. • Step 9:- calculation SMA[ n/n]. • Step 10:- calculation EMA[(alpha*prev.close)+(1-alpha*prev.ema) where alpha=( 2/1-n). • Step 11:- Cal. EMA for 5,8 and 13 days. • Step 12:- Convert all csv data to dataframe. Algo Trading Short Title 16/23
  • 17. Algorithm • Step 13:- Plotting graph through dataframe. • Step 14:- By using euclidean formula, distance between two lines[dist((x, y), (a, b)) = (x − a)2 + (y − b)2] • Step 15:- Cal.risk line= [dist((x, y), (a, b)) - [dist((x1, y1), (a1, b1)) • Step 16:- If risk line == 0, check if (x,y) >(x1,y1) generate ’BUY’ signal else ’SELL’. Algo Trading Short Title 17/23
  • 18. Output Graph Algo Trading Short Title 18/23
  • 20. Limitations • Algorithmic trading is not 100 percent accurate.We just predict future stock price basis upon past stock behaviour. • Algorithmic trading is not universal. one algorithm cannot be applied to every situation. • Investor has to check daily news or updates of individual script. • Due to this market goes to more volatility. Algo Trading Short Title 20/23
  • 21. Conclusion Trading is extremely difficult for both full time and especially part time traders.The best road to gain profit is finding your own trading strategies.Once you got it, is your goals and objectives.No,trading strategies lasts forever and i find myself constantly reinventing my strategy.I learned all of these lessons,and many more from trade academy during my internship. Algo Trading Short Title 21/23
  • 22. Future Enhancement In year of 2008 SEBI started allowing DMA.In the US and other developed markets HFT estimated 70 percentage of equity market share.In India is around 12 percentage. As technology is growing,financial technology is growing up same space. In recent years,the number of machine learning packages has increased in finance trading. some established funds like Medallion,Citadel,JPmorgan using artificial intelligence, and there performance is in peak level. Upcoming years algo trading with AI power will have a huge impact in Indian market. Algo Trading Short Title 22/23
  • 23. References • Fundamental of dataframe by Yves Hilpisch,2016, p.137 • API connection website:https://github.com/upstox/upstox-python • Algo Trading architecture https://www.quantinsti.com/blog/trading-systems- architecture Algo Trading Short Title 23/23