11-01, 09:00–10:30 (America/New_York), Radio City (Room 6604)
In this tutorial, we will review some of the most parts of the Python programming language we don't use every day… but should! Using the motivating example of a portfolio construction backtester, we will build the rough outline of a library that allows users to design strategies to be automatically executed and evaluated for constructing a portfolio.
We will design this tool such that:
- it has moderate performance for low-frequency strategies (e.g., no intraday trading, no real-time, more mutual fund than hedge fund)
- it supports high generality in strategy construction
- it supports “foreign” data (i.e., it minimizes assumptions about pandas.Series
or pandas.DataFrame
representing market information or trades)
- it is reasonably easy for a pandas
user to construct a strategy without knowing too many esoteric details of Python or pandas
(except, of course, the rules of index alignment)
Along the way, we will look to answer the following questions:
- what are generators, generator coroutines, and decorators, and where do they they actually show up in analytical code?
- why are generators and generator coroutines so well-suited to the design of simulators, backtesters, model training, &c.?
- how do we write libraries that accept and return pandas.Series
that do not lose generality?
- why is pandas
often considered a “tail-end” analytical tool, and how might we solve the problem of writing libraries that may grow a pandas.Series
?
In this tutorial, we will review some of the most parts of the Python programming language we don't use every day… but should! Using the motivating example of a portfolio construction backtester, we will build the rough outline of a library that allows users to design strategies to be automatically executed and evaluated for constructing a portfolio.
We will design this tool such that:
- it has moderate performance for low-frequency strategies (e.g., no intraday trading, no real-time, more mutual fund than hedge fund)
- it supports high generality in strategy construction
- it supports “foreign” data (i.e., it minimizes assumptions about pandas.Series
or pandas.DataFrame
representing market information or trades)
- it is reasonably easy for a pandas
user to construct a strategy without knowing too many esoteric details of Python or pandas
(except, of course, the rules of index alignment)
Along the way, we will look to answer the following questions:
- what are generators, generator coroutines, and decorators, and where do they they actually show up in analytical code?
- why are generators and generator coroutines so well-suited to the design of simulators, backtesters, model training, &c.?
- how do we write libraries that accept and return pandas.Series
that do not lose generality?
- why is pandas
often considered a “tail-end” analytical tool, and how might we solve the problem of writing libraries that may grow a pandas.Series
?
No previous knowledge expected
James has played a vital role in organizing the PyData community while serving as a liaison during his years as a NumFOCUS Vice President. He has attended 30+ PyData events throughout the world helping to recruit the best talent and ideas to better the community. James has also worked with core developers behind numerous NumFOCUS projects to advance their communities.