Upgrade to Pro — share decks privately, control downloads, hide ads and more …

NYC Python Meetup Algorithmic Trading talk (extended slides)

Thomas Wiecki
January 17, 2014
160

NYC Python Meetup Algorithmic Trading talk (extended slides)

Thomas Wiecki

January 17, 2014
Tweet

Transcript

  1. Rise of the machines 84% of all stock trades are

    done by computers vs Rationality Speed Capacity Intuition Understanding - Cognitively biased / emotional - Human - Limited + 50 years of experience + Knows how the market works + Purely analytical + 1 TFLOP + Big Data - None - Depends on programming
  2. Rise of the machines 84% of all stock trades are

    done by computers vs Rationality Speed Capacity Intuition Understanding Speech - Cognitively biased / emotional - Human - Limited + 50 years of experience + Knows how the market works + Native speaker + Purely analytical + 1 TFLOP + Big Data - None - Depends on programming - “I'll be back”
  3. Pythonic Algorithmic Trading Pipeline Data Analysis Generate ideas Tools: •

    Pandas • Matplotlib • (Seaborn) • IPython Backtesting Test on historical data whether idea can be exploited. Tools: • Zipline • Quantopian • PyAlgoTrader Forward testing Paper-trade on real-time market data. Tools: • Quantopian Live trading Trade with real money. Tools: • Quantopian (soon) optimize
  4. Pythonic Algorithmic Trading Pipeline Data Analysis Generate ideas Tools: •

    Pandas • Matplotlib • (Seaborn) • IPython Backtesting Test on historical data whether idea can be exploited. Tools: • Zipline • Quantopian • PyAlgoTrader optimize
  5. Pythonic Algorithmic Trading Pipeline Data Analysis Generate ideas Tools: •

    Pandas • Matplotlib • (Seaborn) • IPython Backtesting Test on historical data whether idea can be exploited. Tools: • Zipline • Quantopian • PyAlgoTrader Forward testing Paper-trade on real-time market data. Tools: • Quantopian optimize
  6. Pythonic Algorithmic Trading Pipeline Data Analysis Generate ideas Tools: •

    Pandas • Matplotlib • (Seaborn) • IPython Backtesting Test on historical data whether idea can be exploited. Tools: • Zipline • Quantopian • PyAlgoTrader Forward testing Paper-trade on real-time market data. Tools: • Quantopian Live trading Trade with real money. Tools: • Quantopian (soon) optimize
  7. Algorithmic Trading: Backtesting Historical stock data • datetime • Price

    • Volume Trading Algorithm • Applies transforms (e.g. mavg) • Makes trading decision • Places orders • Transaction costs • Slippage • Order delay Performance and Risk analysis
  8. Zipline • Trading simulator/backtester written in Python • Open-Source (Apache

    2.0) • Stream-based (prevents look-ahead bias) • Batteries included – Moving average, Sharpe, alpha, beta... • Used in production on Quantopian.com – Contribute back to community – Linus' law: "given enough eyeballs, all bugs are shallow" • http://zipline.io
  9. Architecture Source Moving Average VWAP Regression User Algorithm Transaction Simulator

    Transform layer places orders executes orders Emits price and volume info
  10. Conclusions • Zipline gives you full control over you backtest.

    • Copy & paste your Zipline algorithm to Quantopian: – Share it, get feedback. – Test it on minute data. – Forward test it. – Go live (soon!)