1 / 34

Algorithmic Trading

Financial Engineering Club. Algorithmic Trading. Financial Engineering Club. Definition.

derek-finch
Télécharger la présentation

Algorithmic Trading

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Financial Engineering Club Algorithmic Trading Financial Engineering Club

  2. Definition • Algorithmic trading, also called automated trading, black-box trading, or algo-trading, is the use of electronic platforms for entering trading orders with an algorithm which executes pre-programmed trading instructions whose variables may include timing, price, or quantity of the order, or in many cases initiating the order by automated computer programs.

  3. Motivation • Algorithms can process larger amounts of data than humans. • Algorithms can make computations and decisions faster than humans. • Algorithms can execute more precisely. • A simple strategy can be automated so that people can focus their time elsewhere.

  4. Objectives • Smart Execution • Automating a Strategy

  5. Objectives • Smart Execution • Automating a Strategy • Smart Execution • Automating a Strategy • Deals with the execution of an order. • Used by large brokers, asset managers, etc. when placing orders • How can I place a large order and not get screwed? • Smart Execution • Automating a Strategy

  6. How To Not Get Screwed • When placing a large order, try to minimize your impact on the market. • Scenario: I want to buy 50,000 shares of Chipotle (CMG) for $33,204,500: • Put in order for all 50,000 at once • Break order into 500 100-share lots and post all • Break order in 500 100-share lots and post over one hour, considering how the market reacts

  7. How To Not Get Screwed • When placing a large order, try to minimize your impact on the market. • Scenario: I want to buy 50,000 shares of Chipotle (CMG) for $33,204,500: • Put in order for all 50,000 at once • Break order into 500 100-share lots and post all • Break order in 500 100-share lots and post over one hour, considering how the market reacts

  8. How To Not Get Screwed • Impact Driven Algorithms • Reduce the effect that trading has on an asset’s price • Iceberging – split larger order into many smaller ones: • TWAP – Time Weighted Average Price • VWAP – Volume Weighted Average Price • More dynamic derivations • Stops others from knowing you placed a large order and changing their positions, costing you money!

  9. Time Weighted Average Price • Attempt to match the benchmark of how an asset price changes over time. • Implementation example: • Buy 10,000 shares in 5 hours • Place order for 500 shares every 15 minutes • Improvements: • Random lot sizes and intervals • Offer more/less orders early on • Adjust size based on market price

  10. Volume Weighted Average Price • VWAP is the volume-weighted average. • Benchmark on trading price that gives large volume transactions more weight in deciding the price. • Implementation example: • Buy 10,000 shares • Place order for proportional to volume traded in a 15-minute period every 15-minutes

  11. Minimizing Impact Even More • Routing orders to dark pools • Private exchanges for trading securities • Not available to general public • No transparency • Came about to facilitate block trades when we want to minimize market impact

  12. Other Algorithms • Cost-Driven Algorithms • Minimize transaction and spread costs • Also try to “time the market” right • Opportunistic Algorithms • Take advantage of favorable market conditions • Liquidity driven • Pair driven • More on this later…

  13. It’s a Business • Firms like KCG (formerly GETCO) and Citadel offer execution services • Deliver “price improvement” and “execution speed”

  14. Understanding Execution Can Help Your Algorithm • Understanding Execution Can Help Your Algorithm • Improve your fill price • Find others trying to “iceberg” and capitalize on this

  15. Finding Hidden Liquidity • Liquidity can be hidden in dark pools or in icebergs. • Guerrilla algorithms try to find icebergsusing probabilistic models • Compare size and price of trades vs. order book quotes • Identify patterns in order placement to identify a “source”

  16. Readings • Barry Johnson – Algorithmic Trading & DMA

  17. Objectives • Smart Execution • Automating a Strategy

  18. Objectives • Smart Execution • Automating a Strategy • Smart Execution • Automating a Strategy Designing, implementing, testing, and running an automated trading strategy. • Smart Execution • Automating a Strategy

  19. In the Industry

  20. Front Running • Using small lots to find large, possibly iceberged orders. • Send “ping” orders on one exchange to detect a hidden order and front run by changing your order on other exchanges. • Latency is important

  21. Automated Market Making • Place a buy limit order and a sell limit order above and below the spread • Capitalize on the spread • When automated, a few pennies of profit per transaction can reach billions. • Some exchanges offer rebates for market makers • Fractions of a penny • Improves market liquidity and narrows bid-ask spreads

  22. Statistical Arbitrage • Statistical Arbitrage capitalizes on opportunities that are not arbitrage in the literal sense, but over a long period of time they will statistically be near-riskless profit. • Example – Index Arbitrage: • Compare the price of an ETF to the weighted sum of its components • Capitalize on price discrepancies, can predict the movement of the ETF if there is a price mismatch • Latency sensitive!

  23. You can design, test, and run an automated strategy!

  24. Finding A Strategy • The general ideas are simple and public • The inner-workings, the securities to pick, the parameters, and the technology are not • Strategies can be found in academic papers, online forums, and blogs

  25. Popular Brokers for Automated Trading • Interactive Brokers • TradeStation • NinjaTrader

  26. Free Trading Platforms • NinjaTrader • TradeStation (requires brokerage account) • Quantopian • Build Your Own!

  27. Getting Market Data • Free Minute Level Data • Yahoo Finance • Google Finance • Free BATS Tick and Quote Data • Netfonds – last 20 days on US Equities • https://github.com/FEC-UIUC/Netfonds-Tick-Capture • FEC – Captured last 3 months and counting • Want free data? This link could be helpful. • Low-cost Live and Historical Data Feeds • Kinetick • TickData • More….

  28. Testing A Strategy • Back Testing – testing a strategy on historical market data • Many trading platforms have built in backtesters • NinjaTrader has a good one • Quantopian has a good backtester for beginners

  29. Testing A Strategy • Performance Indicators • Sharpe Ratio – measures strategy performance adjusted for risk • The average rate of return versus a benchmark divided by the standard deviation of returns. • Why? Risk minimization is important too! • A strategy that goes all in on 1:1 odds and happens to win is not a good strategy. • Max Drawdown – The maximum peak to trough distance on your P&L • Given as a percentage • Used to measure the risk in worst case • Others: Alpha, Beta, Sortino Ratio, etc.

  30. Testing A Strategy • Pitfalls: • Overfitting – Performs well on a specific timeframe or security, but bad on the general case. • Strategies can also fail to account for how they will impact the market • Markets change. Strategy may have worked 4 years ago, but not now • Solutions: • Forward Testing – testing a strategy on live market data • Incorporate slippage – let some orders be filled at an unfavorable price • Having a large and recent data set • Train your parameters on a partition of your test data, verify accuracy on the remaining portion

  31. Momentum Following • Idea: A security on an uptrend/downtrend will continue on an uptrend/downtrend. • Simple implementation: • Take the derivative and second derivative of a moving average. • When a threshold first/second derivative is crossed: • Buy/sell security in an amount proportional to these two parameters.

  32. Mean Reversion • Idea: Two or more securities that are co-integrated will revert to their mean ratio when a divergence occurs. • Simple implementation: • Identify two co-integrated securities (i.e XLE and PFE) • Run a linear regression on XLE vs PFE on the last X days • If current spread is 2 standard deviations above the regression: • Buy XLE, sell PFE • If current spread is 2 standard deviations below regression: • Sell XLE, Buy PFE • If current spread is within 0.5 standard deviations of the regression: • Liquidate your position

  33. Readings • Quantitative Trading: How to Build Your Own Algorithmic Trading Business – Ernie Chan • Algorithmic Trading & DMA – Barry Johnson • Inside the Black Box – Rishi Narang • Pairs Trading: Quantitative Methods and Analysis – GanapathyVidyamurthy

  34. Quantopian • https://www.quantopian.com/posts/mean-reversion-algorithm-for-club-use • A mean reversion strategy between XLE and PFE: • Regresses the last X days, computes current spread’s Z-Score, and compares the Z-Score to a threshold to make trading decision. • TODO – For the next 15 minutes, improve the sharpe ratio, max drawdown, and/or percent returns by tweaking the parameters at the top or manipulating the trading logic!

More Related