SlideShare a Scribd company logo
CONFIDENTIAL
How to run a quantitative trading
business in China using Python
QuantCon Singapore
2017-09-29
CONFIDENTIALCONFIDENTIAL
 Overview of Chinese Market
 Data Management - TuShare
 Strategy Development
 Automated Trading - vn.py
 Summary and QA
www.junzhiam.com 3
CONFIDENTIALCONFIDENTIAL
About Me
 My name is Xiaoyou Chen.
 Head of Option Trading at Junzhi Asset Management (均直
资管)
 Creator of vn.py project
www.junzhiam.com 4
CONFIDENTIALCONFIDENTIAL
About Junzhi Asset Management
 Multi-strategy Quant Fund
 Equity Long-Short
 Trend Following
 Statistical Arbitrage
 Volatility Trading
 Fixed Income Arbitrage
 Several billion AUM in CNY
 In-house Developed Trading Software
www.junzhiam.com 5
CONFIDENTIALCONFIDENTIAL
Chinese Financial Market Overview
Market Overview
Stock
• Over 3300 stocks and 160 ETFs
• World No.2 by Market Cap
• World No.2 by Turnover
Futures
• 43 commodity, 3 equity index and 2 bond futures
• World No. 2 by Turnover
Options
• 1 ETF option: SZ50 ETF
• 2 commodity options: soybean meal, sugar
www.junzhiam.com 6
Data from www.world-exchanges.org (August 2017):
• Stock Market Cap: China $6.6 trillion vs US $29.7 trillion
• Stock Monthly Turnover: China $1.78 trillion vs US $2.28 trillion
• Commodity Monthly Turnover: China $1.23 trillion vs US $4.98 trillion
CONFIDENTIALCONFIDENTIAL
Market Features
www.junzhiam.com 7
 Exchange markets instead of dealer markets
 Stocks only trading on one exchange, no ECN or dark pools
 API available, with restrictions on stocks trading
 Margin trading with leverage ratio < 2
 Short selling available but difficult to find shares
CONFIDENTIALCONFIDENTIAL
Traditional vs New Methods for Quant Trading
Automated Trading
C++ Python
Strategy Development
Matlab/R Python
Data Management
SQL Python
www.junzhiam.com 8
CONFIDENTIALCONFIDENTIAL
Python Advantages
Easy to Learn
Fast to Write
Batteries Included
Open-source
www.junzhiam.com 9
CONFIDENTIALCONFIDENTIAL
Open-source Quantitative Trading
www.junzhiam.com 10
Name Github Star Language Type
Zipline 5532 Python Backtesting
TuShare 3905 Python Data
vn.py 3884 Python Trading
RQAlpha 1637 Python Backtesting
finmarketpy 1602 Python Backtesting
pyalgotrade 1488 Python Backtesting
High-Frequency-Trading-Model-with-IB 1192 Python Strategy
Lean 1053 C# Trading
StockSharp 1051 C# Trading
backtrader 826 Python Backtesting
Date:2017-09-22
CONFIDENTIALCONFIDENTIAL
 Overview of Chinese Market
 Data Management - TuShare
 Strategy Development
 Automated Trading - vn.py
 Summary and QA
www.junzhiam.com 11
CONFIDENTIALCONFIDENTIAL
Data Collection
Market
Data
Daily Bar
(OHLC)
Intraday Bar
(OHLC)
Tick (Bid/Ask)
Reference
Data
Fundamental
Data
(PE/Growth)
Economic
Data
(GDP/CPI)
Alternative
Data
www.junzhiam.com 12
CONFIDENTIALCONFIDENTIAL
Choice of Database
Database Features Suitable For
HDF5
• Fast reading performance
• Hierachical structure
• Data compression
High Frequency Market Data
(Tick, Minute Bar)
MongoDB
• Document-based data
model, similar to Python
dictionaries
• Deep query-ability
• Horizontal scalability
Low Frequency Market Data
(Daily Bar)
MySQL
• Relationship database
• ACID compliance
Reference Data
www.junzhiam.com 13
CONFIDENTIALCONFIDENTIAL
TuShare Overview
www.junzhiam.com 14
 Open-source financial data tool for Python created by Jimmy
Liu (my colleague)
 100k+ community users, including over 500 financial
institutions (August 2017)
 Free data feeds including: Sina Finance, Tenccent Finance,
Shanghai Stock Exchange, etc.
 Commercial data feeds including: Datayes, JZData, etc.
CONFIDENTIALCONFIDENTIAL
TuShare Features
www.junzhiam.com 15
• Market Data/Fundamental Data/Economic
DataData Available
• Pandas DataFrame/SeriesData Structure
• MySQL/MongoDB/HDF5/CSV
Database
Supported
• Well documented/easy to find support.
Active
Community
CONFIDENTIALCONFIDENTIAL
TuShare Data
Data Type Data Example
Market Data
• Equity Tick
• Equity Original/Forward Adjusted Daily Bar
• Equity Intraday Bar
• Index Snapshot
Fundamental Data
• Equity Industry/Concept/Area
• PE/PB Ratio
• Total/Liquid Assets
• Growth Rate
Economic Data
• GDP/CPI
• Depsit Reserve Ratio
• Shibor Rate
• Margin Trading Statistics
www.junzhiam.com 16
CONFIDENTIALCONFIDENTIAL
TuShare Example
www.junzhiam.com 17
CONFIDENTIALCONFIDENTIAL
 Overview of Chinese Market
 Data Management - TuShare
 Strategy Development
 Automated Trading - vn.py
 Summary and QA
www.junzhiam.com 18
CONFIDENTIALCONFIDENTIAL
Jupyter Notebook
 Powerful IPython shell, perfect tool for strategy development
 Rapid prototyping and easy managing data-related projects
 Can be used as front-end for automated trading system
www.junzhiam.com 19
CONFIDENTIALCONFIDENTIAL
Strategy Development
www.junzhiam.com 20
Data Analysis
• Test for
auto-
correlation
• Test for
Stationary
Time Series
• Plot return
distribution
Strategy
Backtesting
• Array-based
backtesting
• Event-driven
backtesting
• Result
anlyisis
Parameter
Optimization
• Exhaustive
optimization
• Genetic
optimization
• Walk-
Forward
Testing
Various backtesting tools similar in concept to Zipline
CONFIDENTIALCONFIDENTIAL
 Overview of Chinese Market
 Data Management - TuShare
 Strategy Development
 Automated Trading - vn.py
 Summary and QA
www.junzhiam.com 21
CONFIDENTIALCONFIDENTIAL
Automated Trading
www.junzhiam.com 22
• For receiving latest market price
update
Realtime Data
Feed
• For sending orders and receiving
execution information
Broker
Connection
• For monitoring order status and
position pnl
Order and
Position Tracking
• For managing strategy life cycle:
initialization, start, stop, etc.Strategy Engine
CONFIDENTIALCONFIDENTIAL
vn.py Project
 Open-source quantitative trading framework created by
Xiaoyou Chen (me)
 Developed by traders, for traders.
 Targeting the problem that most vendors and brokers have no
Python support for automated trading
 Python and uses C++ for low-layer and performance sensitive
infrastructure.
www.junzhiam.com 23
CONFIDENTIALCONFIDENTIAL
Architecture of VnTrader
www.junzhiam.com 24
Main Engine
Event Engine
Order Router
Risk Manager
Data Engine
MongoDB
Database
Data Feeds
• CTP
• FEMAS
• XTP
• SGIT
• IB
• OANDA
• WIND
Broker
Connection
• Equity
• Futures
• Options
• Precious Metal
• Forex
• Cryptocurrency
Management Apps
• GUI Client
• Web Client
• RPC Service
Strategy Apps
• CTA Strategy
• Spread Trading
• Volatility Trading
• Electronic Eye
• Algo Execution
CONFIDENTIALCONFIDENTIAL
Screenshot
www.junzhiam.com 25
CONFIDENTIALCONFIDENTIAL
Event-Driven Backtesting and Trading
 Event-driven
backtesting helps to
avoid lookahead bias
 Same strategy code
for backtesting and live
trading.
www.junzhiam.com 26
CONFIDENTIALCONFIDENTIAL
EventEngine and Complex Trading Strategy
 Institutional investors and professional traders can easily
develop complex trading strategies with the Event Engine(EE),
and automatically route their orders to the most desired
destinations:
1. A strategy register event handlers with EE
2. EE receives event update from data feed, broker connection or other
strategies.
3. EE notifies the strategy about new events through handler
4. After doing some trading logic calculations with new data, the
strategy place or cancel orders
5. Strategy can be an algo instance, a GUI front-end or any other
modules
www.junzhiam.com 27
CONFIDENTIALCONFIDENTIAL
Complex Strategy Demo – Electronic Eye
www.junzhiam.com 28
CONFIDENTIALCONFIDENTIAL
 Overview of Chinese Market
 Data Management - TuShare
 Strategy Development
 Automated Trading - vn.py
 Summary and QA
www.junzhiam.com 29
CONFIDENTIALCONFIDENTIAL
Summary
 Chinese market is becoming increasingly attractive for quant
trading.
 Global quant hedge funds obtain fund management license in
China (Bridgewater and Man Group).
 With open-source tools in Python, running a quant trading
business in China is getting much easier now.
www.junzhiam.com 30
CONFIDENTIALCONFIDENTIAL
Q & A
www.junzhiam.com 31
WeChat:
Email: xchen@junzhiam.com

More Related Content

PPTX
"From Alpha Discovery to Portfolio Construction: Pitfalls and Solutions" by D...
PPTX
"Quant Trading for a Living – Lessons from a Life in the Trenches" by Andreas...
PDF
"A Framework-Based Approach to Building Quantitative Trading Systems" by Dr. ...
PDF
"Quantitative Trading as a Mathematical Science" by Dr. Haksun Li, Founder an...
PDF
Intro to Quant Trading Strategies (Lecture 1 of 10)
PDF
Statistics - The Missing Link Between Technical Analysis and Algorithmic Trad...
PPTX
"From Trading Strategy to Becoming an Industry Professional – How to Break in...
PDF
"Don't Lose Your Shirt Trading Mean-Reversion" by Edith Mandel, Principal at ...
"From Alpha Discovery to Portfolio Construction: Pitfalls and Solutions" by D...
"Quant Trading for a Living – Lessons from a Life in the Trenches" by Andreas...
"A Framework-Based Approach to Building Quantitative Trading Systems" by Dr. ...
"Quantitative Trading as a Mathematical Science" by Dr. Haksun Li, Founder an...
Intro to Quant Trading Strategies (Lecture 1 of 10)
Statistics - The Missing Link Between Technical Analysis and Algorithmic Trad...
"From Trading Strategy to Becoming an Industry Professional – How to Break in...
"Don't Lose Your Shirt Trading Mean-Reversion" by Edith Mandel, Principal at ...

What's hot (20)

PDF
Combining the Best Stock Selection Factors by Patrick O'Shaughnessy at QuantC...
PPTX
DIY Quant Strategies on Quantopian
PDF
MLX 2018 - Marcos López de Prado, Lawrence Berkeley National Laboratory Comp...
PDF
Market Timing, Big Data, and Machine Learning by Xiao Qiao at QuantCon 2016
PDF
Intra-Day De Mark Plus Order Flow Indicator by Dr. Christopher Ting, SMU
PPTX
"Enhancing Statistical Significance of Backtests" by Dr. Ernest Chan, Managin...
PDF
"Fundamental Forecasts: Methods and Timing" by Vinesh Jha, CEO of ExtractAlpha
PPTX
Volatility Trading - Hedge Fund Strategies
PPTX
The QuantCon Keynote: "Counter Trend Trading – Threat or Complement to Trend ...
PPTX
Classification of quantitative trading strategies webinar ppt
PDF
Quantitative Trading in Eurodollar Futures Market by Edith Mandel at QuantCon...
PDF
Simulating HFT for Low-Latency Investors - The Investor’s View (Robert Almgren)
PPTX
Automated Selection and Robustness for Systematic Trading Strategies by Dr. T...
PDF
"Maximize Alpha with Systematic Factor Testing" by Cheng Peng, Software Engin...
PDF
"Trading Strategies That Are Designed Not Fitted" by Robert Carver, Independe...
PPTX
Algorithmic trading
PDF
Quantitive Approaches and venues for Energy Trading & Risk Management
PPTX
Algorithmic Trading
PDF
"Build Effective Risk Management on Top of Your Trading Strategy" by Danielle...
PDF
Quant trading with artificial intelligence
Combining the Best Stock Selection Factors by Patrick O'Shaughnessy at QuantC...
DIY Quant Strategies on Quantopian
MLX 2018 - Marcos López de Prado, Lawrence Berkeley National Laboratory Comp...
Market Timing, Big Data, and Machine Learning by Xiao Qiao at QuantCon 2016
Intra-Day De Mark Plus Order Flow Indicator by Dr. Christopher Ting, SMU
"Enhancing Statistical Significance of Backtests" by Dr. Ernest Chan, Managin...
"Fundamental Forecasts: Methods and Timing" by Vinesh Jha, CEO of ExtractAlpha
Volatility Trading - Hedge Fund Strategies
The QuantCon Keynote: "Counter Trend Trading – Threat or Complement to Trend ...
Classification of quantitative trading strategies webinar ppt
Quantitative Trading in Eurodollar Futures Market by Edith Mandel at QuantCon...
Simulating HFT for Low-Latency Investors - The Investor’s View (Robert Almgren)
Automated Selection and Robustness for Systematic Trading Strategies by Dr. T...
"Maximize Alpha with Systematic Factor Testing" by Cheng Peng, Software Engin...
"Trading Strategies That Are Designed Not Fitted" by Robert Carver, Independe...
Algorithmic trading
Quantitive Approaches and venues for Energy Trading & Risk Management
Algorithmic Trading
"Build Effective Risk Management on Top of Your Trading Strategy" by Danielle...
Quant trading with artificial intelligence
Ad

Similar to "How to Run a Quantitative Trading Business in China with Python" by Xiaoyou Chen, Head of Option Trading at Shanghai Junzhi Asset Management Ltd. (20)

PDF
Python in the Financial Industry The universal tool for end-to-end developme...
PPTX
Sample - EFutures-financial-solutions
PPTX
Flink Forward Berlin 2017 Keynote: Ferd Scheepers - Taking away customer fric...
PPT
EXTENT-2015: LSEG Technology Overview
PPTX
Redefining Perspectives - June 2015
PPTX
Introduction to Blockchain and BitCoin New Business Opportunties
PDF
Binance Clone Script - A Comprehensive Guide For Business seekers.pdf
PPTX
EXTENT-2017: MiFID II and Impacts on Trading Workflow
PPTX
WSO2- OSC Korea - Accelerating Digital Businesses with APIs
PPTX
Fintech workshop Part I - Law Society of Hong Kong - Xccelerate
PPTX
EXTENT-2015: Prognoz Market Surveillance
PPT
Business Intelligence for Logistics and Freight Forwarders
PPTX
In-Memory Computing Webcast. Market Predictions 2017
PDF
TradeTech Architecture 2010
PDF
From Idea to Launch_ The Complete Guide to Centralized Exchange Development.pdf
PPT
Real-time Streaming Analytics: Business Value, Use Cases and Architectural Co...
PDF
cybersecurity regulation for thai capital market ดร.กำพล ศรธนะรัตน์ ผู้อำนวย...
PDF
Introduction to Quantitative Trading - Investment Management Club of Yale Uni...
PDF
A Deep Guide To Crypto Exchange Development
PDF
Building a Crypto Exchange from Scratch_ A Beginners Guide.pdf
Python in the Financial Industry The universal tool for end-to-end developme...
Sample - EFutures-financial-solutions
Flink Forward Berlin 2017 Keynote: Ferd Scheepers - Taking away customer fric...
EXTENT-2015: LSEG Technology Overview
Redefining Perspectives - June 2015
Introduction to Blockchain and BitCoin New Business Opportunties
Binance Clone Script - A Comprehensive Guide For Business seekers.pdf
EXTENT-2017: MiFID II and Impacts on Trading Workflow
WSO2- OSC Korea - Accelerating Digital Businesses with APIs
Fintech workshop Part I - Law Society of Hong Kong - Xccelerate
EXTENT-2015: Prognoz Market Surveillance
Business Intelligence for Logistics and Freight Forwarders
In-Memory Computing Webcast. Market Predictions 2017
TradeTech Architecture 2010
From Idea to Launch_ The Complete Guide to Centralized Exchange Development.pdf
Real-time Streaming Analytics: Business Value, Use Cases and Architectural Co...
cybersecurity regulation for thai capital market ดร.กำพล ศรธนะรัตน์ ผู้อำนวย...
Introduction to Quantitative Trading - Investment Management Club of Yale Uni...
A Deep Guide To Crypto Exchange Development
Building a Crypto Exchange from Scratch_ A Beginners Guide.pdf
Ad

More from Quantopian (20)

PPTX
Being open (source) in the traditionally secretive field of quant finance.
PPTX
Stauth common pitfalls_stock_market_modeling_pqtc_fall2018
PPTX
Tearsheet feedback webinar 10.10.18
PDF
"Three Dimensional Time: Working with Alternative Data" by Kathryn Glowinski,...
PPTX
"Alpha from Alternative Data" by Emmett Kilduff, Founder and CEO of Eagle Alpha
PPTX
"Supply Chain Earnings Diffusion" by Josh Holcroft, Head of Quantitative Rese...
PDF
"Portfolio Optimisation When You Don’t Know the Future (or the Past)" by Rob...
PDF
“Real Time Machine Learning Architecture and Sentiment Analysis Applied to Fi...
PDF
“Market Insights Through the Lens of a Risk Model” by Olivier d'Assier, Head ...
PDF
"Deep Reinforcement Learning for Optimal Order Placement in a Limit Order Boo...
PPTX
"Making the Grade: A Look Inside the Algorithm Evaluation Process" by Dr. Jes...
PDF
"Building Diversified Portfolios that Outperform Out-of-Sample" by Dr. Marcos...
PPTX
"From Insufficient Economic data to Economic Big Data – How Trade Data is red...
PDF
"Machine Learning Approaches to Regime-aware Portfolio Management" by Michael...
PDF
"Deep Q-Learning for Trading" by Dr. Tucker Balch, Professor of Interactive C...
PDF
"Quantum Hierarchical Risk Parity - A Quantum-Inspired Approach to Portfolio ...
PDF
"Snake Oil, Swamp Land, and Factor-Based Investing" by Gary Antonacci, author...
PPTX
"Bayesian Deep Learning: Dealing with Uncertainty and Non-Stationarity" by Dr...
PDF
"On the Bayesian Interpretation of Black–Litterman" by Dr. Gordon Ritter, Sen...
PDF
"Correlated Volatility Shocks" by Dr. Xiao Qiao, Researcher at SummerHaven In...
Being open (source) in the traditionally secretive field of quant finance.
Stauth common pitfalls_stock_market_modeling_pqtc_fall2018
Tearsheet feedback webinar 10.10.18
"Three Dimensional Time: Working with Alternative Data" by Kathryn Glowinski,...
"Alpha from Alternative Data" by Emmett Kilduff, Founder and CEO of Eagle Alpha
"Supply Chain Earnings Diffusion" by Josh Holcroft, Head of Quantitative Rese...
"Portfolio Optimisation When You Don’t Know the Future (or the Past)" by Rob...
“Real Time Machine Learning Architecture and Sentiment Analysis Applied to Fi...
“Market Insights Through the Lens of a Risk Model” by Olivier d'Assier, Head ...
"Deep Reinforcement Learning for Optimal Order Placement in a Limit Order Boo...
"Making the Grade: A Look Inside the Algorithm Evaluation Process" by Dr. Jes...
"Building Diversified Portfolios that Outperform Out-of-Sample" by Dr. Marcos...
"From Insufficient Economic data to Economic Big Data – How Trade Data is red...
"Machine Learning Approaches to Regime-aware Portfolio Management" by Michael...
"Deep Q-Learning for Trading" by Dr. Tucker Balch, Professor of Interactive C...
"Quantum Hierarchical Risk Parity - A Quantum-Inspired Approach to Portfolio ...
"Snake Oil, Swamp Land, and Factor-Based Investing" by Gary Antonacci, author...
"Bayesian Deep Learning: Dealing with Uncertainty and Non-Stationarity" by Dr...
"On the Bayesian Interpretation of Black–Litterman" by Dr. Gordon Ritter, Sen...
"Correlated Volatility Shocks" by Dr. Xiao Qiao, Researcher at SummerHaven In...

Recently uploaded (20)

PPTX
Unilever_Financial_Analysis_Presentation.pptx
PDF
5a An Age-Based, Three-Dimensional Distribution Model Incorporating Sequence ...
PPTX
Session 11-13. Working Capital Management and Cash Budget.pptx
PDF
how_to_earn_50k_monthly_investment_guide.pdf
PDF
Unkipdf.pdf of work in the economy we are
PDF
Bitcoin Layer August 2025: Power Laws of Bitcoin: The Core and Bubbles
PDF
Mathematical Economics 23lec03slides.pdf
PPTX
Session 14-16. Capital Structure Theories.pptx
PDF
Dr Tran Quoc Bao the first Vietnamese speaker at GITEX DigiHealth Conference ...
PDF
Chapter 9 IFRS Ed-Ed4_2020 Intermediate Accounting
PDF
Why Ignoring Passive Income for Retirees Could Cost You Big.pdf
PDF
Corporate Finance Fundamentals - Course Presentation.pdf
PPT
KPMG FA Benefits Report_FINAL_Jan 27_2010.ppt
PDF
financing insitute rbi nabard adb imf world bank insurance and credit gurantee
PPT
E commerce busin and some important issues
PDF
Lecture1.pdf buss1040 uses economics introduction
PPTX
kyc aml guideline a detailed pt onthat.pptx
PPTX
How best to drive Metrics, Ratios, and Key Performance Indicators
PPTX
OAT_ORI_Fed Independence_August 2025.pptx
PDF
1a In Search of the Numbers ssrn 1488130 Oct 2009.pdf
Unilever_Financial_Analysis_Presentation.pptx
5a An Age-Based, Three-Dimensional Distribution Model Incorporating Sequence ...
Session 11-13. Working Capital Management and Cash Budget.pptx
how_to_earn_50k_monthly_investment_guide.pdf
Unkipdf.pdf of work in the economy we are
Bitcoin Layer August 2025: Power Laws of Bitcoin: The Core and Bubbles
Mathematical Economics 23lec03slides.pdf
Session 14-16. Capital Structure Theories.pptx
Dr Tran Quoc Bao the first Vietnamese speaker at GITEX DigiHealth Conference ...
Chapter 9 IFRS Ed-Ed4_2020 Intermediate Accounting
Why Ignoring Passive Income for Retirees Could Cost You Big.pdf
Corporate Finance Fundamentals - Course Presentation.pdf
KPMG FA Benefits Report_FINAL_Jan 27_2010.ppt
financing insitute rbi nabard adb imf world bank insurance and credit gurantee
E commerce busin and some important issues
Lecture1.pdf buss1040 uses economics introduction
kyc aml guideline a detailed pt onthat.pptx
How best to drive Metrics, Ratios, and Key Performance Indicators
OAT_ORI_Fed Independence_August 2025.pptx
1a In Search of the Numbers ssrn 1488130 Oct 2009.pdf

"How to Run a Quantitative Trading Business in China with Python" by Xiaoyou Chen, Head of Option Trading at Shanghai Junzhi Asset Management Ltd.

  • 1. CONFIDENTIAL How to run a quantitative trading business in China using Python QuantCon Singapore 2017-09-29
  • 2. CONFIDENTIALCONFIDENTIAL  Overview of Chinese Market  Data Management - TuShare  Strategy Development  Automated Trading - vn.py  Summary and QA www.junzhiam.com 3
  • 3. CONFIDENTIALCONFIDENTIAL About Me  My name is Xiaoyou Chen.  Head of Option Trading at Junzhi Asset Management (均直 资管)  Creator of vn.py project www.junzhiam.com 4
  • 4. CONFIDENTIALCONFIDENTIAL About Junzhi Asset Management  Multi-strategy Quant Fund  Equity Long-Short  Trend Following  Statistical Arbitrage  Volatility Trading  Fixed Income Arbitrage  Several billion AUM in CNY  In-house Developed Trading Software www.junzhiam.com 5
  • 5. CONFIDENTIALCONFIDENTIAL Chinese Financial Market Overview Market Overview Stock • Over 3300 stocks and 160 ETFs • World No.2 by Market Cap • World No.2 by Turnover Futures • 43 commodity, 3 equity index and 2 bond futures • World No. 2 by Turnover Options • 1 ETF option: SZ50 ETF • 2 commodity options: soybean meal, sugar www.junzhiam.com 6 Data from www.world-exchanges.org (August 2017): • Stock Market Cap: China $6.6 trillion vs US $29.7 trillion • Stock Monthly Turnover: China $1.78 trillion vs US $2.28 trillion • Commodity Monthly Turnover: China $1.23 trillion vs US $4.98 trillion
  • 6. CONFIDENTIALCONFIDENTIAL Market Features www.junzhiam.com 7  Exchange markets instead of dealer markets  Stocks only trading on one exchange, no ECN or dark pools  API available, with restrictions on stocks trading  Margin trading with leverage ratio < 2  Short selling available but difficult to find shares
  • 7. CONFIDENTIALCONFIDENTIAL Traditional vs New Methods for Quant Trading Automated Trading C++ Python Strategy Development Matlab/R Python Data Management SQL Python www.junzhiam.com 8
  • 8. CONFIDENTIALCONFIDENTIAL Python Advantages Easy to Learn Fast to Write Batteries Included Open-source www.junzhiam.com 9
  • 9. CONFIDENTIALCONFIDENTIAL Open-source Quantitative Trading www.junzhiam.com 10 Name Github Star Language Type Zipline 5532 Python Backtesting TuShare 3905 Python Data vn.py 3884 Python Trading RQAlpha 1637 Python Backtesting finmarketpy 1602 Python Backtesting pyalgotrade 1488 Python Backtesting High-Frequency-Trading-Model-with-IB 1192 Python Strategy Lean 1053 C# Trading StockSharp 1051 C# Trading backtrader 826 Python Backtesting Date:2017-09-22
  • 10. CONFIDENTIALCONFIDENTIAL  Overview of Chinese Market  Data Management - TuShare  Strategy Development  Automated Trading - vn.py  Summary and QA www.junzhiam.com 11
  • 11. CONFIDENTIALCONFIDENTIAL Data Collection Market Data Daily Bar (OHLC) Intraday Bar (OHLC) Tick (Bid/Ask) Reference Data Fundamental Data (PE/Growth) Economic Data (GDP/CPI) Alternative Data www.junzhiam.com 12
  • 12. CONFIDENTIALCONFIDENTIAL Choice of Database Database Features Suitable For HDF5 • Fast reading performance • Hierachical structure • Data compression High Frequency Market Data (Tick, Minute Bar) MongoDB • Document-based data model, similar to Python dictionaries • Deep query-ability • Horizontal scalability Low Frequency Market Data (Daily Bar) MySQL • Relationship database • ACID compliance Reference Data www.junzhiam.com 13
  • 13. CONFIDENTIALCONFIDENTIAL TuShare Overview www.junzhiam.com 14  Open-source financial data tool for Python created by Jimmy Liu (my colleague)  100k+ community users, including over 500 financial institutions (August 2017)  Free data feeds including: Sina Finance, Tenccent Finance, Shanghai Stock Exchange, etc.  Commercial data feeds including: Datayes, JZData, etc.
  • 14. CONFIDENTIALCONFIDENTIAL TuShare Features www.junzhiam.com 15 • Market Data/Fundamental Data/Economic DataData Available • Pandas DataFrame/SeriesData Structure • MySQL/MongoDB/HDF5/CSV Database Supported • Well documented/easy to find support. Active Community
  • 15. CONFIDENTIALCONFIDENTIAL TuShare Data Data Type Data Example Market Data • Equity Tick • Equity Original/Forward Adjusted Daily Bar • Equity Intraday Bar • Index Snapshot Fundamental Data • Equity Industry/Concept/Area • PE/PB Ratio • Total/Liquid Assets • Growth Rate Economic Data • GDP/CPI • Depsit Reserve Ratio • Shibor Rate • Margin Trading Statistics www.junzhiam.com 16
  • 17. CONFIDENTIALCONFIDENTIAL  Overview of Chinese Market  Data Management - TuShare  Strategy Development  Automated Trading - vn.py  Summary and QA www.junzhiam.com 18
  • 18. CONFIDENTIALCONFIDENTIAL Jupyter Notebook  Powerful IPython shell, perfect tool for strategy development  Rapid prototyping and easy managing data-related projects  Can be used as front-end for automated trading system www.junzhiam.com 19
  • 19. CONFIDENTIALCONFIDENTIAL Strategy Development www.junzhiam.com 20 Data Analysis • Test for auto- correlation • Test for Stationary Time Series • Plot return distribution Strategy Backtesting • Array-based backtesting • Event-driven backtesting • Result anlyisis Parameter Optimization • Exhaustive optimization • Genetic optimization • Walk- Forward Testing Various backtesting tools similar in concept to Zipline
  • 20. CONFIDENTIALCONFIDENTIAL  Overview of Chinese Market  Data Management - TuShare  Strategy Development  Automated Trading - vn.py  Summary and QA www.junzhiam.com 21
  • 21. CONFIDENTIALCONFIDENTIAL Automated Trading www.junzhiam.com 22 • For receiving latest market price update Realtime Data Feed • For sending orders and receiving execution information Broker Connection • For monitoring order status and position pnl Order and Position Tracking • For managing strategy life cycle: initialization, start, stop, etc.Strategy Engine
  • 22. CONFIDENTIALCONFIDENTIAL vn.py Project  Open-source quantitative trading framework created by Xiaoyou Chen (me)  Developed by traders, for traders.  Targeting the problem that most vendors and brokers have no Python support for automated trading  Python and uses C++ for low-layer and performance sensitive infrastructure. www.junzhiam.com 23
  • 23. CONFIDENTIALCONFIDENTIAL Architecture of VnTrader www.junzhiam.com 24 Main Engine Event Engine Order Router Risk Manager Data Engine MongoDB Database Data Feeds • CTP • FEMAS • XTP • SGIT • IB • OANDA • WIND Broker Connection • Equity • Futures • Options • Precious Metal • Forex • Cryptocurrency Management Apps • GUI Client • Web Client • RPC Service Strategy Apps • CTA Strategy • Spread Trading • Volatility Trading • Electronic Eye • Algo Execution
  • 25. CONFIDENTIALCONFIDENTIAL Event-Driven Backtesting and Trading  Event-driven backtesting helps to avoid lookahead bias  Same strategy code for backtesting and live trading. www.junzhiam.com 26
  • 26. CONFIDENTIALCONFIDENTIAL EventEngine and Complex Trading Strategy  Institutional investors and professional traders can easily develop complex trading strategies with the Event Engine(EE), and automatically route their orders to the most desired destinations: 1. A strategy register event handlers with EE 2. EE receives event update from data feed, broker connection or other strategies. 3. EE notifies the strategy about new events through handler 4. After doing some trading logic calculations with new data, the strategy place or cancel orders 5. Strategy can be an algo instance, a GUI front-end or any other modules www.junzhiam.com 27
  • 27. CONFIDENTIALCONFIDENTIAL Complex Strategy Demo – Electronic Eye www.junzhiam.com 28
  • 28. CONFIDENTIALCONFIDENTIAL  Overview of Chinese Market  Data Management - TuShare  Strategy Development  Automated Trading - vn.py  Summary and QA www.junzhiam.com 29
  • 29. CONFIDENTIALCONFIDENTIAL Summary  Chinese market is becoming increasingly attractive for quant trading.  Global quant hedge funds obtain fund management license in China (Bridgewater and Man Group).  With open-source tools in Python, running a quant trading business in China is getting much easier now. www.junzhiam.com 30
  • 30. CONFIDENTIALCONFIDENTIAL Q & A www.junzhiam.com 31 WeChat: Email: xchen@junzhiam.com

Editor's Notes

  • #2: My name is Xiaoyou Chen. Today I’m going to share some experience about …
  • #3: First, let’s try to get a brief overview of Chinese financial market.
  • #4: My name is … I am the head of … Our option trading strategies include volatility trading, low-latency arbitrage, portfolio hedging, cross market arbitrage and so on. I am also the creator of the vn.py project which is an open-source quantitative trading platform and we will talk about it later.
  • #5: Then, some background about my company. Junzhi Asset Management is a leading multi-strategy quantitative trading hedge fund based in Shanghai and we focus on Chinese local markets. We have trading strategies in almost all local financial markets except forex which is restricted in China. Our trading strategies include … We have several billions asset under management in Chinese yuan at the moment. In order to manage our very big portfolio, we also developed in-house tradng software for broker connection, oms, colocated algo server and so on.
  • #6: Here is the overview of Chinese financial market. For the stock market, we have … and is … For the futures … For the options …
  • #7: In China, most financial products are traded on exchanges rather than OTC. There is no ECN or dark pools in China, every stock can only be traded on the exchange where it’s listed. Block trading is also completed on exchanges. For futures and options trading, investors are free to use API for sending orders to brokers. However, for stock trading, most brokers do not provide API connection. And those who do provide API will ask for a minimum capital, normally 10 million CNY and also a background check. Margin trading is available through a service called RongZi. The maximum leverage ratio is 2 and the financing rate is normally is over 7% annually. Short selling is also available through a service called RongQuan. However, due to the low willingness of Chinese investors to lend their stock for short selling, it’s quite difficult to find those shares which you want to short.
  • #8: So, the three main steps in Quant Trading… Traditionally, we need different programming languages for different jobs. However, each of them has its own limitation. SQL is not optimized to handle time series data. As a commercial software, Matlab is not cheap to use. Even with years of experience, writing automated trading programme in C++ is not a easy job. Besides, most traders do not want to learn 3 programming languages. Luckily, now we can use just one language for completing all jobs, that is Python.
  • #9: Created by Guido van Rossum and first released in 1991, Python is an interpreted language with a design philosophy that emphasizes code readability. Using whitespace indentation to delimit code blocks rather than curly brackets or keywords), and a syntax that allows programmers to express concepts in fewer lines of code, Python is very easy to write. Python has a large standard library , as well as huge amounts of third-party libraries, offering a wide range of functionality. Python is also an open-source software, which makes it free to use and gives full control over the programming language if users want.
  • #10: Here is a table of some popular open-source quant trading projects on Github, ranked by Github stars First column… Second… Third… Last… 5 Backtesting framework, 3 trading system, 1 data tool and 1 strategy Demo. Among the 10 projects, 8 are written in Python, 2 in C#. So maybe we can say that Python is dominating the world of open-source quant trading projects.
  • #11: After getting the overview of the market, let’s have a look at the first step of Quant Trading, which is Data Management.
  • #12: In quantitative trading, data can be seperated into 2 group: market data and reference data. Market data refers to the trading price data of financial products. The most widely used is daily bar data, which is consisted of open/high/low/close price and trading volume and maybe open interest for futures and options. Daytrading traders or strategies require intraday data such as 1-minute bar or 5-minute bar. For high frequency strategies, tick data which includes market depth information is necessary. Reference data is more about those information that comes outside trading, such as fundamental data of equities, economic data of a country and also alternative data (railway freight volume).
  • #13: The most widely used open-source database solution for quant trading in China are HDF5, MongoDB and MySQL. Here is a table for comparing there features and suitable tasks. For HDF5, For MongoDB, For MySQL,
  • #14: TuShare is an … First released in 2014, now it has a large community with more than 100,000 community users, which includes over 500 financial institutions. As a data tool, TuShare does not provide data by itself, but instead using data from differenct data feeds. As an example, users can get Daily Bar data from Sina Finance or Tencent Finance and get fundamental data of equity from Shanghai Stock Exchange. For high frequency market data or more detailed reference data, TuShare also support commercial datafeeds such as Datayes and JZData.
  • #15: Let’s have a look at TuShare features. First, data available on TuShare includes market data … We will see more detail on the next slide. TuShare uses Pandas dataframe and series for data structure, which makes it very easy to use. You don’t need to download data into a csv file and then read it into the memory. Just one line of code, you get the dataframe you need for data analysis. TuShare also provides io tools based on Pandas, which allow users to easily save data into the format they want to use. This includes MySQL/MongoDB/HDF5 and CSV. The community of TuShare project is very active. Instead of mailing list which is widely used in open-source world for discussion, TuShare uses IM groups of the Tencent QQ, in which community members can talk to each other instantly. So when you get a question, it’s always easy to find some support. The community also makes great contribution to the documentation of the project.
  • #16: This table shows some examples of the data available on TuShare.
  • #17: A short example for downloading ETF price data using Tushare and run a backtesting of double moving average strategy in about 30 lines of code. Download data Calculate moving averages Calculate pos based on ma crossing, be ware of the shift by one period here. Calculate daily trading cost and net pnl. Calculate cumulative pnl and plot the chart.
  • #19: When talking about strategy development, people have the most freedom: array based backtesting vs event based backtesting 2. Write backtesting scripts or use backtesting frameworks. Here, we won’t go into too much details, but introduce some common tools. Jupyter notbook is one of my favourite tool for conducting data analysis and strategy development. Its advantages includes:…
  • #20: Here is the basic steps of strategy development. In China, there are various backtesting tools similar to Zipline for this purpose..
  • #21: Now we have the trading signals generated from our strategy, the last step is to send our orders to the market.
  • #22: To run an automated trading system, we will need these functions. Realtime data feed: …
  • #23: Vn.py project is an … The design philosophy of vn.py is by traders, for traders. In my early career, with no professinal IT education or training, I experienced lots of difficulties when trying to build automated trading systems. C++ is too difficult to learn for me and matlab is just not suitable for writing event-driven programme. I hope that there can be a platform which is easy enough for None IT professionals to learn and ensures flexibility by allowing users to modify any lower layer functions if they want. One of the main target of vn.py is to solve the problem that… Mainly written in Python and uses C++ for low-layer and performance sensitive infrastructure.
  • #24: Vn.py project is a framework for developing automated trading programmes. VnTrader is the trading platform developed based on those functions provided in the project.
  • #26: The CTA strategy function of VnTrader provides event-driven backtesting which can … The backtesting engine and the live trading engine have the same API functions, which means that traders can use one strategy code for both backtesting and live trading. This can help to avoid extra bugs when converting the strategy from b to t.