Copyright © 2019 Piotr Wójcik All rights reserved.

Quantitative Strategies on High Frequency Data

dr Piotr Wójcik

October 2nd, 2019

Organizational matters

Course description – aim of the lecture and lab sections

  • give theoretical background for high-frequency data analysis
  • learn to prepare, test and implement quantitative trading strategies
  • get to know characteristics of high-frequency data and tools used to evaluate trading strategies
  • discuss successful strategies for different intra-day investment horizon

Course description – aim of the lecture and lab sections – cont’d

  • build and verify own trading strategies on high-frequency data
  • learn to prepare the data, aggregate it to desired frequency
  • learn to backtest the strategy and verify it from different perspectives (returns, risk, etc.)
  • topics will be illustrated with practical examples and exercises
  • R environment will be used – its previous knowledge is expected

Contents of the course – lectures plan

  1. Organizational matters, introduction to quantitative trading
  2. High-frequency data definition and characteristics
  3. High-frequency data sources
  4. Evolution of HFT
  5. Review of statistical and econometric foundations of trading strategies
  6. Mean-reverting, momentum strategies and pair trading
  7. Building an automated strategy – study of entries and exits

Contents of the course – lectures plan – cont’d

  1. Calculating position and pnl
  2. Evaluating performance of high-frequency strategies
  3. Fishing for ideas and strategy backtesting
  4. Statistical arbitrage strategies
  5. Event arbitrage strategies
  6. Portfolio construction – evaluating and reducing risk
  7. Students’ presentations

Contents of the course – lab sections plan

  1. Introduction to R Markdown
  2. Dealing with time series data
  3. Frequency conversion, data aggregation
  4. Getting free intraday data from the Internet and more advanced data visualisation
  5. Checking characteristics of intraday data
  6. Correlation, regression (rolling analyses)
  7. Cointegration, Granger causality (rolling analyses)

Contents of the course – lab sections plan – cont’d

  1. Constructing a strategy setup using different entry/exit techniques
  2. Calculating positions and gross/net pnl
  3. Evaluating performance of the strategy
  4. Applying simple strategies
  5. Applying more advanced (pair trading) strategies
  6. C++ in R – efficiency matters
  7. Students’ presentations

Literature

Course assessment – lectures

  • written, open book exam
  • covering topics discussed during the lectures and sections/labs
  • some theoretical questions but mainly practical tasks (using, not rewriting the theory)
  • 100 points to be collected

Course assessment – lab sections

  • trading strategies project prepared in groups of at most 2 students
  • building and backtesting a trading strategy for 4 (groups of) series of different frequency
  • the same data for everyone – trading competition

Course assessment – lab sections – cont’d

  • 100 points to be collected, given for:
    • presentation in class (20 pts)
    • written report in RMarkdown (40 pts)
    • obtained strategy results (40 pts) – ranking
      • max. 10 pts. per each series results
      • 10 if strategy performance in top quartile group
      • 7.5 if in the second
      • 5 if in the third
      • 2.5 if in lowest 25%

Written report assessment criteria

  • the report should be submitted as PDF/Word file together with a source R Markdown file (*.Rmd) with R code chunks that allow the teacher to fully reproduce the applied strategy and generate a submitted PDF/Word file
  • the only input loaded to *.Rmd should be data files and R packages needed for the applied strategy,
  • assessment criteria
    • interpretation of results and conclusions
    • form (language, tables, links, etc.)
    • correctness of the R codes
  • further details related to LAB PROJECT will be announced in November

Trading competitions

Rotman Trading Competition 2018

Rotman European Trading Competition 2018

RETC 2018 - THE WINNER!

Kaggle competition

www.kaggle.com/c/two-sigma-financial-news

Why use R?

  • good trader has to be a good programmer
  • open-source, free
  • good to know it, universal, including many additional packages not only for statistics, quantitative finance
  • at least 10 years ahead of commercial packages in terms of possible analytics
  • commercial statistical packages are limited in their ability to change the environment and have limited number of functions, procedures to use
  • R users can either use developed functions or create their own
  • wide R community – easy to get help online

R conferences

R conferences – R in Finance

www.rinfinance.com

R conferences – UseR!2019

http://www.user2019.fr

R conferences – UseR!2020

https://twitter.com/useR2020stl

R conferences – eRum 2020

https://erum.io

R conferences – WhyR?2019

https://whyr.pl/2019

www & email

www.wne.uw.edu.pl/pwojcik

pwojcik@wne.uw.edu.pl

Office hours: Tuesdays 15:00-16:00, room: B101

Questions?

Introduction to high-frequency trading

What is high frequency trading?

  • There doesn’t seem to be any single clear definition
  • But there are some common characteristics:
    • high turnover of capital in rapid computer-driven responses to changing market conditions
    • dependency on incredibly fast speed of execution (ultra-low latency)
    • very high throughput of trades – sending thousands of orders every second
    • low average gain per trade
    • very short time period of holding positions
    • few, if any, positions carried overnight

Only for liquid instruments

  • high-frequency trading can be applied to sufficiently liquid instruments
  • liquid assets are characterized by readily available supply and demand
  • liquid instrument is a security with enough buyers and sellers to trade at any time of the trading day
  • perfectly liquidity – if quoted bid or ask price can be achieved irrespective of the quantities traded
  • market liquidity depends on the presence of trading counterparties, as well as their willingness to trade
  • willingness to trade depends on the risk aversions and expectations of price movements

Why not hold overnight positions?

  • with 24-hour trading and current volatility in the markets overnight positions can be risky
  • if lending money, overnight positions would require to pay overnight interest rates – increase in costs

Why deal with high-frequency data?

  • majority of high-frequency managers delivered positive returns in 2008
  • 70% of low-frequency practitioners lost money (both according to New York Times)
  • the best investment manager of 2008 earned $2.5 billion alone!
  • profitability of high-frequency enterprises is corroborated by the exponential growth of the industry
  • high-frequency trading accounts for over 60% of trading volume coming through the financial exchanges

More advantages of high frequency trading

  • little or no correlation with long-term strategies – valuable diversification tools for long-term portfolios
  • require shorter evaluation periods because of their statistical properties:
    • average monthly strategy requires 6m-2y of observations to verify strategy’s credibility,
    • performance of many high-frequency strategies can be statistically ascertained within a month)

More advantages of high frequency trading – cont’d

  • from the operational perspective:
    • automation delivers savings on staff headcount and
    • lower incidence of errors due to human hesitation and emotion
  • increased market efficiency (identify and trade away temporary market inefficiencies),
  • added liquidity (increase trading volumes, lower costs)
  • innovation in computer technology

High-frequency trading firms

HF trading firms

  • HF strategies can be run from any part of the world at any time of day
  • natural affiliations and talent clusters emerge at places most conducive to specific types of financial securities
  • many HF firms are based in New York, Connecticut, London, Singapore, and Chicago

HF trading firms – cont’d

  • Chicago firms use their proximity to the CME and trade futures, options, and commodities
  • New York and Connecticut firms have preferences toward U.S. equities (NYSE)
  • European time zones give Londoners an advantage in trading currencies
  • Singapore firms tend to specialize in Asian markets

World’s largest HF trading companies

  • The largest high-frequency names worldwide include: Millennium, DE Shaw, Worldquant and Renaissance Technologies
  • Most of HF firms are hedge funds or other proprietary investment firms (investing own money – prop trading).
  • Many banks have proprietary trading desks for high-frequency assets and often are transformed into hedge fund structures once they are successful

Characteristics of successful HF trading firms

  • algorithms that use highly developed quantitative models and methodologies to determine when and where to trade
  • extremely fast computing power, often using multicore technology, to drive those models and algorithms
  • an infrastructure that allows them to send orders to the exchange and receive executions back in a few microseconds

Algorithmic trading – definition

  • Algorithmic trading is the use of computer programs to automate one or more stages of the trading process:
    • pre-trade analysis (data analysis) – analysis of properties of assets using market data or financial news
    • trading signal generation (what to trade) – identifies trading opportunities based on the pre-trade analysis
    • trade execution (when and how to trade) – executing orders for the selected asset (when and how)
  • More than 60–70% US equity trades are now done by algorithms.

Algorithmic trading

Algorithmic trading requirements

  • centralised Order Book – shared centralized order book that lists the buy and sell orders for a specific security ranked by price and order arrival time
  • markets – deployed for highly liquid markets and (typically) high-frequency trading (equities, futures, derivatives, bonds, FX)
  • advanced IT systems

Orders, stacks and matching

High-frequency trading challenges

  • large volumes of intra-day data – can be irregularly spaced, requiring new tools and methodologies,
  • precision of signals – gains may quickly turn to losses if signals are badly defined, so signal must be precise enough to trigger trades even in a fraction of a second
  • speed of execution – computer automation of order generation and execution, but human supervision still essential
  • IT – Internet viruses and other computer security challenges that could leave a system paralyzed; ongoing maintenance and upgrades of computer hardware to stay fast enough

Worth to keep in mind

  • HFT is difficult, but can generate stable profits under various market conditions
  • past performance is never a guarantee of future returns
  • strategies made public soon become obsolete; many people rush in to trade them, erasing the margin potential
  • best-performing strategies are those kept in the strictest confidence and seldom are made public
  • main purpose of this course is to illustrate how research can be applied to capture market inefficiencies and stimulate your own innovations in the development of new, profitable trading strategies

Thank you for your attention