Algorithmic Trading By: Avi Thaker.

Slides:



Advertisements
Similar presentations
FINDING TRADES IN EVERY MARKET.
Advertisements

World Federation of Exchanges | Cambridge, MA | Nov, 2009 High Frequency Trading Tools and Technologies Presented by Larry Tabb (Founder & CEO)
Market Profile ® Keys for Traders and Investors Market Profile ® is a registered trademark of the Chicago Board of Trade ® ALL RIGHTS RESERVED The.
Optimal Option Portfolio Strategies
Introduction price evolution of liquid stocks after large intraday price change Significant reversal Volatility and volume stay high NYSE-widen bid-ask.
Trading Course Table of Contents Course Book 251 Pages
Chapter 20 Hedge Funds Hedge Funds vs Mutual Funds Public info on portfolio composition Unlimited Must adhere to prospectus, limited short selling.
CHAPTER 19 INVESTMENT BANKING.
Using Options to Enhance Marketing
P.V. VISWANATH FOR A FIRST COURSE IN INVESTMENTS.
06-Liquidity Preference Theory. Expectations Theory Review Given that Expectations Theory: – Given that we want to invest for two years, we should be.
Chapter 15 International Business Finance Key sections –Factors affecting exchange rates –Nature of exchange risk and types –How control exchange risk?
Rotman Interactive Trader RIT Software for simulated trading.
FIN352 Vicentiu Covrig 1 Buying and Selling Equities (chapter 3)
Trading the volatility ETPs
Algorithmic Trading Financial Engineering Club FINANCIAL ENGINEERING CLUB.
Mr. Perminous KAHOME, University of Nairobi, Nairobi, Kenya. Dr. Elisha T.O. OPIYO, SCI, University of Nairobi, Nairobi, Kenya. Prof. William OKELLO-ODONGO,
Quantitative Trading Strategy based on Time Series Technical Analysis Group Member: Zhao Xia Jun Lorraine Wang Lu Xiao Zhang Le Yu.
Advanced Trading Course Intra-Day Chart Patterns
1 Using Correlated Stocks as a Leading Indicator: An Applied Pair Trading Strategy Don Bright & Darren Clifford
1 Foreign Exchange FOREX Instructor: Saeed Ebrahimijam Lab. Lecture 2. FINA417- Technical Analysis and Algorithmic Trading.
GLOBAL ASSET ALLOCATION AND STOCK SELECTION ASSIGNMENT # 1 SMALL CAP LONG-SHORT STRATEGY FIRST-YEAR BRAVES Daniel Grundman, Kader Hidra, Damian Olesnycky,
SMB’s Options Training Program Presents:
©R. Schwartz Equity Markets: Trading and Structure Slide 1 Topic 5.
THREE WAYS TO BUY A STOCK. THREE WAYS TO BUY A STOCK Options involve risk and are not suitable for all investors. For more information, please read the.
Spreadsheet Demonstration
CH5 Overview 1. Agenda 1.History 2.Motivation 3.Cointegration 4.Applying the model 5.A trading strategy 6.Road map for strategy design 2.
McGraw-Hill/Irwin © 2007 The McGraw-Hill Companies, Inc., All Rights Reserved. Behavioral Finance and Technical Analysis CHAPTER 19.
CHAPTER 19 Behavioral Finance and Technical Analysis.
Price patterns, charts and technical analysis: The momentum studies Aswath Damodaran.
Trading Day Prep ( ) 9:10am Pre-mkt gap scan, added any before market earnings/guidance.
Advanced Option Strategies Derivatives and Risk Management BY SUMAT SINGHAL.
ALLIANCE RESOURCE PARTNERS, L.P. Ticker: ARLP Last Price: Fair Value: $50.30 Market Cap: 1.60 B Yield: 7.3% Recommendation: BUY.
Finance 300 Financial Markets Lecture 5 Professor J. Petry, Fall, 2002©
Financial Engineering Club Fall 2015 – Info Session.
A Beginner’s Efforts Iron Condors ITM Diagonals. A Beginner’s Efforts Disclaimer! I am a beginner and only offer my current understandings. I make no.
Investment Vs Trading. Investment Basics Why People Invest in Financial Markets To achieve financial goals To increase income To gain wealth and feeling.
Chapter 16 Jones, Investments: Analysis and Management
CHAPTER EIGHTEEN Technical Analysis CHAPTER EIGHTEEN Technical Analysis Cleary / Jones Investments: Analysis and Management.
Essentials of Investments © 2001 The McGraw-Hill Companies, Inc. All rights reserved. Fourth Edition Irwin / McGraw-Hill Bodie Kane Marcus 1 Chapter 15.
Planning Trades for Entry and Exit. Options involve risk and are not suitable for all investors. For more information, please read the Characteristics.
Market Controversies u Futures markets u Speculation u Captive supplies.
Hedging and speculative strategies using index futures Finance S. Mann, Fall 2001 Short hedge: Sell Index futures - offset market losses on portfolio.
1 J. Siaw, G. Warnecke, P. Jain, C. Kenney, D. Gershman, R. Riedi, K. Ensor Dynamics of Electronic Markets Electronic Markets 7 What makes the price Identify.
Hedging and speculative strategies using index futures Short hedge: Sell Index futures - offset market losses on portfolio by generating gains on futures.
Haksun Li
©R. Schwartz, B Steil, & B. Weber June 2008 Slide 1 Bob Schwartz Zicklin School of Business Baruch College, CUNY.
Challenges for algorithmic execution Gordon Baker CARISMA conference1.
Options Trading Strategies. BullishBullish StrategiesStrategies.
Bid Price Ask Price. Market Order When you tell a broker to buy or sell at the current price You don’t specify the price The key is speed of execution.
High Frequency Trading Chapter One Supplement. What is it? HFT – Algo trading – Auto market maker – Program Trading Fast trading – How quickly By micro.
Session 5: Review of the Scientific Method and The ATS Development Process 1.
More Than Meets the Eye: A Closer Look Inside Price Bars With Jean Folger & Lee Leibfarth.
Planning Stock Trades: Entry and Exit. Options involve risk and are not suitable for all investors. For more information, please read the Characteristics.
Lesson 1 Forex Secrets Inc.. How to start with Forex Secrets Inc.  Go to and open an accounthttps://
Valuing a Company What determines a companies worth?
Intro to Trading Pt.2 Order Types & Trade Basics.
MT4 Orientation. MT4 Orientation.
Baranalyzer.com. Lee Leibfarth is a trader, author and developer for PowerZone Trading, a company that he cofounded in 2004 to provide services to active.
Trading, monitoring, balancing and performance attribution
Backtest Results Ryan Simmen March, 2017.
INVESTMENT ANALYSIS & PORTFOLIO MANAGEMENT
Behavioral Finance and Technical Analysis
CURRENCY TRADING.
Chapter 2 Mechanics of Futures Markets
Part I: System Generation in TSL
NO LOSS TRADING STRATEGY
High Frequency Trading and Mini Flash Crashes
Overview & backtesting
Introduction to algo quant, an integrated trading research tool
Presentation transcript:

Algorithmic Trading By: Avi Thaker

Table of Contents Kinds of Strategies HFT vs Non-HFT Terms Data Pandas Limit Order Book Limit Order Execution Kinds of Strategies Developing a Strategy Backtesting Execution Getting Started Appendix

HFT vs Non HFT HFT or High Frequency Trading, relies on quick algorithmic trading to capture small spreads or small alpha (less than 1 minute holds) Difficult for the retail investor to get into Extremely competitive Fastest usually takes all profits Makes up 70%+ of all trading volume Non HFT (trades of longer periods) Easier for the retail investor to get into Not as competitive Smarter people make profits

Terms Depth of Market (DOM, Limit Order Book, Level 2) Best Bid – price to instantly sell Best Ask – price to instantly buy Bid Size Ask Size Alpha

Data Data, Data, Data Daily Bars Intraday Data Successful strategies are all about data and backtesting Daily Bars Yahoo finance, Google finance Downloadable into csv format Python Pandas implementable with Yahoo Finance Intraday Data Expensive for long history Non cleaned data can be obtained from Yahoo/Google finance

Pandas Developed for data manipulation and analysis by Wes Mckinney at AQR Extremely fast because it is based in c, and is vector driven Dataframes Similar to R, but easier to use Many built in algorithmic trading analysis Slow for implementation Requires NumPy http://pandas.pydata.org/ http://pandas.pydata.org/pandas- docs/stable/tutorials.html

Limit Order Book Bid Size Ask Size Volume By Price Best Ask Best Bid http://www.trade2win.com/articles/1750-understanding-liquidity-market-pullbacks

Limit Order Execution For an order to be executed, a trade must cross below your buy, or a trade happens at your price, when you have been filled in the queue

Limit Order Execution – Place Order Bids Price Asks 100.03 2,1 100.02 3,7,8 100.01 5,2,15 100 1,2,5 1,2 99.99 2,5,8 99.98 3,8,1,5,3 99.97 2,3 99.85

Limit Order Execution – Book Movement Bids Price Asks 100.03 2,1 100.02 3,7,8 100.01 5,2,15 100 1,2,5 99.99 2,5,8 99.98 3,8,1,5,3 99.97 2,3 99.85 Fill at 99.99, this becomes removed, and position advances. A trade happens Another order is placed behind you People cancel their orders

Limit Order Execution – Order Fill Bids Price Asks 100.03 2,1 100.02 3,7,8 100.01 5,2,15 100 1,2,5 2,5 99.99 2 99.98 3,8,1,5,3 99.97 2,3 99.85 After an order is filled you move up in the queue, until you either are filled or cancel the order

Strategy: Alpha Taking http://marcoagd.usuarios.rdc.puc-rio.br/revers.html Believes the market will move in one direction Mean Reverting – price reverts back to a “average” price Trend following – price will move in one direction and not revert Stockcharts.com

Strategy: Market Making Capture the Spread Increase Liquidity On both sides of the market Risky during times of volatility Must be fast and have good queue position Bids Price Asks 100.03 2,1 100.02 3,7,8 100.01 5,2,15 100 1,2,5 1,2 99.99 2,5,8 99.98 3,8,1,5,3 99.97 2,3 99.85

Strategy: Pair Trading Assumes two contracts move together Revert moves when one moves against the other Can be highly risky 2007 Crash? Spreads blow up http://www.investopedia.com/university/guide-pairs-trading/pairs-trade-example.asp

Developing A Strategy Identify a strategy Back-test the strategy Execute the strategy Manage Risk

Backtesting a Strategy/Risk Provide evidence of profitability Curve fitting/ optimization bias In-sample vs out-of-sample Forward looking bias Risk tolerance Key Statistics Average wins :: 0.637 USD Average loss :: -0.438 USD # Wins :: 214 # Losses :: 210 # Neutrals :: 3 Win Rate :: 0.501 PPC :: 0.104USD # Traded :: 427.0 Ann. Sharpe :: 2.335

Executing a Strategy Exit Long Entry Long

Getting Started Open up an account with Interactive Brokers https://www.interactivebrokers.com/ind/en/main.php Research and Develop Strategies https://www.quantopian.com/ http://www.quantstart.com/articles/Beginners-Guide-to- Quantitative-Trading Execute Strategies Either use Quantopian or develop own system through IB API Use Python, C++, Java

Appendix: Quantopian Provides an excellent community which shares trading ideas Good backtesting resource with fairly good minute bar data Direct implementation from Python to IB API Live/Paper Trading Slow execution and not good for higher frequency strategies

Appendix: Candlestick/Bar Data Open – price at start of bar High – highest price Low – lowest price Close – price at end of bar Volume – number traded during bar Can be on any timescale: seconds to daily http://www.financial-spread-betting.com/course/candle-stick-charting.html

Appendix: Sharpe Ratio 𝑆ℎ𝑎𝑟𝑝𝑒= 𝑟 𝑝 − 𝑟 𝑓 𝜎 𝑝 𝑟 𝑝 =𝑝𝑜𝑟𝑡𝑓𝑜𝑙𝑖𝑜 𝑟𝑒𝑡𝑢𝑟𝑛 𝑟 𝑓 =𝑟𝑖𝑠𝑘 𝑓𝑟𝑒𝑒 𝑟𝑎𝑡𝑒 𝜎 𝑝 =𝑠𝑡𝑎𝑛𝑑𝑎𝑟𝑑 𝑑𝑒𝑣𝑖𝑎𝑡𝑖𝑜𝑛 𝑜𝑓 𝑟𝑒𝑡𝑢𝑟𝑛 Developed by William F. Sharpe Measures risk adjusted performance Risk vs. Reward Higher is usually better Usually annualized Adjust portfolio returns to a daily basis, average the returns and multiply by 252

Appendix: Profit Per Contract (PPC) 𝑟 𝑎 𝑐∗ 𝑡 𝑠 𝑟 𝑎 =𝑎𝑣𝑒𝑟𝑎𝑔𝑒 𝑟𝑒𝑡𝑢𝑟𝑛 𝑐=𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑐𝑜𝑛𝑡𝑟𝑎𝑐𝑡𝑠 𝑡𝑟𝑎𝑑𝑒𝑑 𝑡 𝑠 =𝑡𝑖𝑐𝑘 𝑠𝑖𝑧𝑒 A measure of profitability, measured in ticks A highly liquid stock usually has a tick size of a penny If your strategy has more than 2 ticks, it is considered profitable (can escape the bid/ask bounce), if testing on bar data without limit order execution on bar closes You can submit market orders and still make money