ALGO TRADING
WITH
MACHINE LEARNING
9th April,2018
GUIDED BY :- SUBMITTED BY:-
Asst. prof-NAMITA BAJPAI DEB PRAKASH GANGULY-1401227154
CONTENTS
 INTRODUCTION
 OBJECTIVE
 SOFTWARE REQUIRED
 ARCHITECTURE
 STRATEGIES
 ALGORITHM
 MACHINE LEARNING
 LIMITATIONS
 CONCLUSION
 FUTURE ENHANCMENT
 REFERENCES
INTRODUCTION
 It is the process of using set of rules or any mathematical
model to generate profits at a high speed frequency that
is quite impossible for a human trader.
 It is simply a way to minimise the cost, market impact &
risk in execution of an order. It is widely used by
investment banks & hedge funds.
OBJECTIVE
 To maximize the profit with minimum capital amount.
 To predict stock prices through price momentum, using
machine learning (AI).
 Trades will be instantaneous, to avoid significant price
changes, reduced transaction cost brokerage charges.
 Reduced possibility of mistakes by human trader, based on
psychological facts.
SOFTWARE REQUIRED
 Automated trading can be done by using c, c++, java
script, ipython etc. out of which we are using interactive
python(ipython) in jupyter notebook.
 As a quant trader Python algorithmic trading it helps to
build execution mechanisms.
 Python can be used to develop some great trading
platform, where as using c & c++ is quite time consuming.
 pandas, NumPy, PyAlgo trade, MatPlotLib, Tensorflow and
Keras required for machine learning and data reading.
ARCHITECTURE
 The entire automated trading system can be broken down
into 3 parts :-
[1] The exchange(s) the external world
[2] The server
• Market data receiver
• Store market data
• Store order generated by the user
CONTINUNED
[3] 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.
TRADITIONAL ARCHITECTURE
{DIAGRAM}
NEW ARCHITECTURE
 The previous architecture could not scale up to the needs
& demands of Automated trading with Direct market
access (DMA).
 The latency between the origin of the event to the order
generation went beyond the dimension of human control.
 Order management also needs to be more robust &
capable of handling many more orders per second.
CONTINUNED
 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 by a separate risk
management system (RMS) within the order manager(OM),
just before releasing an order.
NEW ARCHITECTURE
{DIAGRAM}
Application programming interface
(API)
 An API, is a set of subroutine definitions, protocols, and
tools for building application software.
 Execute orders in real time, manage user portfolio,
stream live market data (using Websocket).
 Upstox Python library provides an easy to use wrapper
over the HTTPs APIs.
 Websocket connections are handled automatically with
the library.
CANDLESTICKS
STRATEGIES
1. Open = low (5min)
• Close – open > high – open ‫﮳‬↑50%
2. Open – low <= 0.10 >=open - low
• Close – open > high - open ‫﮳‬↑50%
CASE:1
CASE:2
VOLUME
PROPOSED ALGORITHM
 Step 1:- Start
 Step 2:-Import packages
 Step 3:-Request for API
 Step 4:-Retrieve access token
 Step 5:-Request trade segment in NSE or BSE
 Step 6:-Request for history data for a particular script
from NSE
PROPOSED ALGORITHM
 Step 7:-Slicing CSV
 Step 8:-Converting CSV to dataframe
 Step 9:-Fetching 5 min data OHLC
 Step 10:-Storing values when open = low
 Step 11:-Storing close value, volumes and case format.
 Step 12:-Repeat from step 9 to step 11
 Step 13:- Storing step 11 to X and corresponding high to Y
PROPOSED ALGORITHM
 Step 13:-Train model through features from X.
 Step 14:- Labels from Y to find hypothesis.
 Step 15:-K fold cross validation 20% from training set
 Step 16:-Storing Y^ value from program
 Step 17:-Buy CMP when signal generated
 Step 18:-Set target as Y^
 Step 19:-Set S.L below X
LIMITATIONS
 Algorithmic trading is not 100% accurate, we just predict
future stock prices basis upon past stock behaviour.
 Algorithmic trading is not universal, one algorithmic
strategy can not be put in every situation.
 Investor has to be updated with the news or the individual
script.
 Due to Algo trading , the market goes volatility.
CONCLUSION
Trading is extremely difficult for both full time & especially
part time traders. The best mode to gain profit is finding
your own trading strategies. Once you got, its your goals
and objectives.
No trading strategies last forever, and we constantly keep
reinventing our own strategies.
FUTURE ENHANCEMENT
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.
REFERENCES
 Pratik Singh(Director of TradeAcademy)
 Data Science Central(for big data practitoners) through LinkedIn.
 Fundamental of dataframe by Yves Hilpisch,2016, p.137(python for finance)
 API connection website:https://github.com/upstox/upstox-python
{THANK YOU}
SUBMITTED BY:-
DEB PRAKASH GANGULY
PRATIK MOHANTY
SIMRAN MOHANTY

Algo trading with machine learning ppt

  • 1.
    ALGO TRADING WITH MACHINE LEARNING 9thApril,2018 GUIDED BY :- SUBMITTED BY:- Asst. prof-NAMITA BAJPAI DEB PRAKASH GANGULY-1401227154
  • 2.
    CONTENTS  INTRODUCTION  OBJECTIVE SOFTWARE REQUIRED  ARCHITECTURE  STRATEGIES  ALGORITHM  MACHINE LEARNING  LIMITATIONS  CONCLUSION  FUTURE ENHANCMENT  REFERENCES
  • 3.
    INTRODUCTION  It isthe process of using set of rules or any mathematical model to generate profits at a high speed frequency that is quite impossible for a human trader.  It is simply a way to minimise the cost, market impact & risk in execution of an order. It is widely used by investment banks & hedge funds.
  • 4.
    OBJECTIVE  To maximizethe profit with minimum capital amount.  To predict stock prices through price momentum, using machine learning (AI).  Trades will be instantaneous, to avoid significant price changes, reduced transaction cost brokerage charges.  Reduced possibility of mistakes by human trader, based on psychological facts.
  • 5.
    SOFTWARE REQUIRED  Automatedtrading can be done by using c, c++, java script, ipython etc. out of which we are using interactive python(ipython) in jupyter notebook.  As a quant trader Python algorithmic trading it helps to build execution mechanisms.  Python can be used to develop some great trading platform, where as using c & c++ is quite time consuming.  pandas, NumPy, PyAlgo trade, MatPlotLib, Tensorflow and Keras required for machine learning and data reading.
  • 6.
    ARCHITECTURE  The entireautomated trading system can be broken down into 3 parts :- [1] The exchange(s) the external world [2] The server • Market data receiver • Store market data • Store order generated by the user
  • 7.
    CONTINUNED [3] Application • Takeinputs 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.
  • 8.
  • 9.
    NEW ARCHITECTURE  Theprevious architecture could not scale up to the needs & demands of Automated trading with Direct market access (DMA).  The latency between the origin of the event to the order generation went beyond the dimension of human control.  Order management also needs to be more robust & capable of handling many more orders per second.
  • 10.
    CONTINUNED  The infrastructurelevel 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 by a separate risk management system (RMS) within the order manager(OM), just before releasing an order.
  • 11.
  • 12.
    Application programming interface (API) An API, is a set of subroutine definitions, protocols, and tools for building application software.  Execute orders in real time, manage user portfolio, stream live market data (using Websocket).  Upstox Python library provides an easy to use wrapper over the HTTPs APIs.  Websocket connections are handled automatically with the library.
  • 13.
  • 14.
    STRATEGIES 1. Open =low (5min) • Close – open > high – open ‫﮳‬↑50% 2. Open – low <= 0.10 >=open - low • Close – open > high - open ‫﮳‬↑50%
  • 15.
  • 16.
  • 17.
  • 18.
    PROPOSED ALGORITHM  Step1:- Start  Step 2:-Import packages  Step 3:-Request for API  Step 4:-Retrieve access token  Step 5:-Request trade segment in NSE or BSE  Step 6:-Request for history data for a particular script from NSE
  • 19.
    PROPOSED ALGORITHM  Step7:-Slicing CSV  Step 8:-Converting CSV to dataframe  Step 9:-Fetching 5 min data OHLC  Step 10:-Storing values when open = low  Step 11:-Storing close value, volumes and case format.  Step 12:-Repeat from step 9 to step 11  Step 13:- Storing step 11 to X and corresponding high to Y
  • 20.
    PROPOSED ALGORITHM  Step13:-Train model through features from X.  Step 14:- Labels from Y to find hypothesis.  Step 15:-K fold cross validation 20% from training set  Step 16:-Storing Y^ value from program  Step 17:-Buy CMP when signal generated  Step 18:-Set target as Y^  Step 19:-Set S.L below X
  • 21.
    LIMITATIONS  Algorithmic tradingis not 100% accurate, we just predict future stock prices basis upon past stock behaviour.  Algorithmic trading is not universal, one algorithmic strategy can not be put in every situation.  Investor has to be updated with the news or the individual script.  Due to Algo trading , the market goes volatility.
  • 22.
    CONCLUSION Trading is extremelydifficult for both full time & especially part time traders. The best mode to gain profit is finding your own trading strategies. Once you got, its your goals and objectives. No trading strategies last forever, and we constantly keep reinventing our own strategies.
  • 23.
    FUTURE ENHANCEMENT Future EnhancementIn 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.
  • 24.
    REFERENCES  Pratik Singh(Directorof TradeAcademy)  Data Science Central(for big data practitoners) through LinkedIn.  Fundamental of dataframe by Yves Hilpisch,2016, p.137(python for finance)  API connection website:https://github.com/upstox/upstox-python
  • 25.
    {THANK YOU} SUBMITTED BY:- DEBPRAKASH GANGULY PRATIK MOHANTY SIMRAN MOHANTY