Simple Simulators with pandas and Generator Coroutines
summary
Builds a backtester that actually runs in Python using plain pandas Series inputs/outputs and generator coroutines to model strategy and simulator loops. Implements an opaque market environment that prices and executes trades, tolerates arbitrary multi‑index “foreign data,” and avoids repeated concat by using list-of-series chunking. Claims moderate performance: typical five‑year low‑frequency backtests finish under a minute, and a prototype handles ~1M trades against ~100M pricing rows in ~2–3s.
AI-written summary · about
chapters (14)
- 0:00Simple simulators intro
- 1:11Financial simulation with pandas
- 5:41Pandas Series for data
- 18:46Critique of price-volume modeling
- 21:10Trading environment class design
- 28:14Executing trades with pandas
- 35:42Portfolio construction
- 41:24Extending pandas with accessors
- 47:01Growing pandas structures
- 59:44Simulations with coroutines
- 1:07:29Coroutine modality issues
- 1:11:46Simulator loop implementation
- 1:19:52Performance and API design
- 1:21:15Conclusion
related talks
51mClosing Keynote
29mI wish I learnt that earlier!
43mWhy do I need to know Python- I'm a pandas user
24mPython, Pandas and other animals to survive in the data jungle
01h 29mStandardised Coroutine Concurrency in Python 3
31mPython Doesn’t Have to Be Slow: Speeding Up a Large-Scale Optimization Algorithm
30mPython for developing an automated trading platform
38mAlgorithmic Trading with Zipline
