# Prophet, a Python microframework for backtesting a trading strategy

> Prophet is a small Python framework for financial markets, built around four ideas: a pluggable data generator, a universe of symbols, an order generator that decides what to buy, and a set of portfolio analyzers that score the result. It is a research tool rather than a trading system, and its release tags date from 2014.

**Emsu/prophet** — Financial markets analysis framework for programmers

- Repository: https://github.com/Emsu/prophet
- Website: http://prophet.michaelsu.io
- Stars: 1,091 · Forks: 121
- Language: Python
- License: BSD-3-Clause
- Published: 2026-10-19 · Updated: 2026-10-19 · Language: en
- Canonical page: https://hysenlabs.com/projects/emsu-prophet

## Four objects and a backtest loop

The stated goal is narrow. Prophet is a Python microframework for financial markets, and it exists so that the programmer can concentrate on modeling financial strategies, portfolio management and the analysis of backtests rather than on plumbing. The claim is a small number of functions to learn, with enough flexibility to accommodate sophistication later. The API shows how small it is. A Prophet object is created, given a universe of symbols, given a data generator, and given an order generator. The backtest is then run over a date range, and the resulting portfolio is handed to analyzers that produce a report. The trade is legible. Instead of a pipeline of hooks and callbacks, a strategy is one class with a run method, and the framework calls it for each date with the prices, the timestamp and the cash available.

## Your order generator holds the strategy

The strategy is a class you write, and the quick start example is short enough to read in full. The class has a run method that receives the prices, the timestamp, the cash and keyword arguments, and it returns an Orders object.

```python
class OrderGenerator(object):

    def run(self, prices, timestamp, cash, **kwargs):
        symbol = "AAPL"
        orders = Orders()
        if (prices.loc[timestamp, symbol] * 100) < cash:
            orders.add_order(symbol, 100)

        return orders
```

The logic is a plain conditional on price and cash, and the order is a symbol and a share count. That is the whole extension point, and it means a strategy is ordinary Python that you can unit test without the framework. The Orders object is a container, and the framework consumes it after each call. Once the backtest has run, the same order generator is asked what to do today, which is what turns a research tool into something with a path toward live use.

```python
today = datetime(2014, 11, 10)
print(prophet.generate_orders(today))
```

The README notes why the example date is in the past, since there may be no data for the current date when the market is closed, and the examples should not fail.

## The universe, the data generator and the backtest

Data arrives through a generator that the framework registers, so the source of prices is a replaceable part. The quick start uses YahooCloseData from prophet.data, and the method that installs it is register_data_generators. The universe is set separately with set_universe, and the quick start uses two symbols, AAPL and XOM, which is what the price frame is indexed by in the strategy example. The backtest itself takes a start date, and the quick start begins it in January 2010.

```python
prophet = Prophet()
prophet.set_universe(['AAPL', 'XOM'])

prophet.register_data_generators(YahooCloseData())
prophet.set_order_generator(OrderGenerator())
backtest = prophet.run_backtest(start=datetime(2010, 1, 1))
```

The dependency list explains what the data side is built on. pandas is required, along with pandas-datareader, which is where the Yahoo data comes from, plus pytz for time zones, seaborn for the reporting, and six for Python 2 compatibility. The repository also carries prophet/utils/tradingcalendar.py, a trading calendar utility taken from Zipline, which is how the framework knows which days are trading days. That detail is not cosmetic. A backtest that treats a weekend as a trading day, or that does not align a price series to a calendar, produces numbers that look plausible and are wrong.

## Analyzers turn the run into four numbers

The analysis step is separate from the run, and the separation is what makes the framework useful for research. You register analyzers with register_portfolio_analyzers and then call analyze_backtest with the backtest result. The default set is imported as default_analyzers from prophet.analyze.

```python
prophet.register_portfolio_analyzers(default_analyzers)
analysis = prophet.analyze_backtest(backtest)
print(analysis)
```

The output is a small table of four measures, the Sharpe ratio, the average return, the cumulative return and the volatility. Four numbers is a deliberately thin report, and the point of the analyzer interface is that it is a pluggable list, so a team can add its own measure without touching the backtest engine. The same structure applies to the data side. YahooCloseData is one implementation of a data generator, and a team with a proprietary data source is expected to write another rather than to patch the framework. The design is consistent throughout, three extension points, data generators, order generators and analyzers, each registered on the Prophet object and each doing one job.

## Installing it, and setting up a checkout

The published install is a single pip command, with a commented line above it about installing pip through easy_install.

```bash
# sudo easy_install pip
pip install prophet
```

The package is called prophet on PyPI, and the setup metadata pins it to a small dependency set, with pytz, pandas, pandas-datareader, seaborn and six, and the development status is declared as Alpha. Working on the project itself uses a slightly older style of setup, with a git clone, a virtualenv, the development requirements and an editable install.

```bash
git clone git@github.com:Emsu/prophet.git
cd prophet
virtualenv env
. env/bin/activate
pip install -r dev-requirements.txt
python setup.py develop
```

The repository is small in the way a microframework is small. The prophet/ package holds the code, tests/ and tox.ini hold the test suite, examples/ holds quickstart.py and a tutorial directory, and docs/ holds the documentation that the README points to for details. Continuous integration is configured through .travis.yml. The documentation site is at prophet.michaelsu.io, and the README also points to a mailing list and a Trello board where the work in progress is tracked.

## A framework that has not moved in over a decade

The maintenance picture is the part to weigh before adopting this. The release history has two tags, v0.1.0 on 2014-11-22 and v0.1.1 on 2014-11-24, and the setup metadata in the repository says version 0.1.2, so the working version moved past the last tag years ago. The last push to the default branch was on 2026-04-13, which is more than six months before this article, and the code itself was written against pandas 0.15 and the Python 2 era, with six still in the dependency list and a stated Python 2 and 3 compatibility. The library code and its pandas dependency have both moved a long way since, and the framework has not been updated to follow. The licence is BSD, declared as a BSD licence in the setup metadata and with the OSI BSD classifier, and the credits section names pandas as the foundation, says the project was inspired by QSTK and Zipline, and notes that the trading calendar utility comes from Zipline under the Apache 2.0 licence. So the terms are permissive, but a redistribution carries two licences, one for the framework and one for the file borrowed from Zipline.

## Conclusion

Prophet fits a programmer who wants to express a trading idea as a short Python class and see how it would have performed, since the framework keeps the data, the decision and the scoring separate and the quick start fits on one screen. It does not fit a production trading system, since nothing here places orders with a broker or manages risk, and it does not fit a project that needs a maintained dependency tree, because the last push was on 2026-04-13 and the releases date from 2014. Verify three things before you build on it: that the pandas and pandas-datareader versions your environment already has still work with the API, that the data generator you need exists or is easy to write, and that the BSD terms and the Apache 2.0 licensed trading calendar inside it fit your use.

## FAQ

### What is the Prophet financial framework?

It is a Python microframework for financial markets that lets a programmer focus on modeling financial strategies, portfolio management and analyzing backtests. It provides a small number of functions to learn while staying flexible enough for more involved work.

### How do I install Prophet?

Install it from PyPI with pip install prophet. The package depends on pytz, pandas, pandas-datareader, seaborn and six, and its development status is declared as Alpha.

### How do I write a strategy in Prophet?

You write a class with a run method that receives the prices, the timestamp and the cash, and returns an Orders object built with add_order. You register it with set_order_generator, run a backtest with run_backtest, and score the result with analyze_backtest.

### Is Prophet still maintained?

The repository is not archived and the last push was on 2026-04-13, but the release tags date from 2014, with v0.1.0 on 2014-11-22 and v0.1.1 on 2014-11-24, and the setup metadata in the tree says version 0.1.2. The framework still targets the pandas 0.15 era and keeps six for Python 2 compatibility.

## Sources

- [Emsu/prophet on GitHub](https://github.com/Emsu/prophet)
- [License: BSD-3-Clause](https://github.com/Emsu/prophet/blob/master/LICENSE)
- [Project website](http://prophet.michaelsu.io)
- [README](https://github.com/Emsu/prophet/blob/master/README.md)
- [Releases](https://github.com/Emsu/prophet/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/emsu-prophet
