{"id":13394859,"url":"https://github.com/quantopian/zipline","last_synced_at":"2025-05-14T08:05:17.343Z","repository":{"id":5131596,"uuid":"6297520","full_name":"quantopian/zipline","owner":"quantopian","description":"Zipline, a Pythonic Algorithmic Trading Library","archived":false,"fork":false,"pushed_at":"2024-02-13T08:02:51.000Z","size":170757,"stargazers_count":18450,"open_issues_count":362,"forks_count":4821,"subscribers_count":1016,"default_branch":"master","last_synced_at":"2025-05-14T08:04:36.729Z","etag":null,"topics":["algorithmic-trading","python","quant","zipline"],"latest_commit_sha":null,"homepage":"https://www.zipline.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"DISID/disid-blog","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/quantopian.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-10-19T15:50:29.000Z","updated_at":"2025-05-14T05:40:20.000Z","dependencies_parsed_at":"2023-07-05T19:33:29.685Z","dependency_job_id":"550f6021-b8d0-4294-81e6-d0df80bb38a6","html_url":"https://github.com/quantopian/zipline","commit_stats":{"total_commits":5145,"total_committers":152,"mean_commits":"33.848684210526315","dds":0.8262390670553936,"last_synced_commit":"014f1fc339dc8b7671d29be2d85ce57d3daec343"},"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quantopian%2Fzipline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quantopian%2Fzipline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quantopian%2Fzipline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quantopian%2Fzipline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/quantopian","download_url":"https://codeload.github.com/quantopian/zipline/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254101588,"owners_count":22014907,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithmic-trading","python","quant","zipline"],"created_at":"2024-07-30T17:01:34.247Z","updated_at":"2025-05-14T08:05:17.305Z","avatar_url":"https://github.com/quantopian.png","language":"Python","readme":".. image:: https://media.quantopian.com/logos/open_source/zipline-logo-03_.png\n    :target: https://www.zipline.io\n    :width: 212px\n    :align: center\n    :alt: Zipline\n\n=============\n\n|Gitter|\n|pypi version status|\n|pypi pyversion status|\n|travis status|\n|appveyor status|\n|Coverage Status|\n\nZipline is a Pythonic algorithmic trading library. It is an event-driven\nsystem for backtesting. Zipline is currently used in production as the backtesting and live-trading\nengine powering `Quantopian \u003chttps://www.quantopian.com\u003e`_ -- a free,\ncommunity-centered, hosted platform for building and executing trading\nstrategies. Quantopian also offers a `fully managed service for professionals \u003chttps://factset.quantopian.com\u003e`_\nthat includes Zipline, Alphalens, Pyfolio, FactSet data, and more.\n\n- `Join our Community! \u003chttps://groups.google.com/forum/#!forum/zipline\u003e`_\n- `Documentation \u003chttps://www.zipline.io\u003e`_\n- Want to Contribute? See our `Development Guidelines \u003chttps://www.zipline.io/development-guidelines\u003e`_\n\nFeatures\n========\n\n- **Ease of Use:** Zipline tries to get out of your way so that you can\n  focus on algorithm development. See below for a code example.\n- **\"Batteries Included\":** many common statistics like\n  moving average and linear regression can be readily accessed from\n  within a user-written algorithm.\n- **PyData Integration:** Input of historical data and output of performance statistics are\n  based on Pandas DataFrames to integrate nicely into the existing\n  PyData ecosystem.\n- **Statistics and Machine Learning Libraries:** You can use libraries like matplotlib, scipy,\n  statsmodels, and sklearn to support development, analysis, and\n  visualization of state-of-the-art trading systems.\n\nInstallation\n============\n\nZipline currently supports Python 2.7, 3.5, and 3.6, and may be installed via\neither pip or conda.\n\n**Note:** Installing Zipline is slightly more involved than the average Python\npackage. See the full `Zipline Install Documentation`_ for detailed\ninstructions.\n\nFor a development installation (used to develop Zipline itself), create and\nactivate a virtualenv, then run the ``etc/dev-install`` script.\n\nQuickstart\n==========\n\nSee our `getting started tutorial \u003chttps://www.zipline.io/beginner-tutorial\u003e`_.\n\nThe following code implements a simple dual moving average algorithm.\n\n.. code:: python\n\n    from zipline.api import order_target, record, symbol\n\n    def initialize(context):\n        context.i = 0\n        context.asset = symbol('AAPL')\n\n\n    def handle_data(context, data):\n        # Skip first 300 days to get full windows\n        context.i += 1\n        if context.i \u003c 300:\n            return\n\n        # Compute averages\n        # data.history() has to be called with the same params\n        # from above and returns a pandas dataframe.\n        short_mavg = data.history(context.asset, 'price', bar_count=100, frequency=\"1d\").mean()\n        long_mavg = data.history(context.asset, 'price', bar_count=300, frequency=\"1d\").mean()\n\n        # Trading logic\n        if short_mavg \u003e long_mavg:\n            # order_target orders as many shares as needed to\n            # achieve the desired number of shares.\n            order_target(context.asset, 100)\n        elif short_mavg \u003c long_mavg:\n            order_target(context.asset, 0)\n\n        # Save values for later inspection\n        record(AAPL=data.current(context.asset, 'price'),\n               short_mavg=short_mavg,\n               long_mavg=long_mavg)\n\n\nYou can then run this algorithm using the Zipline CLI.\nFirst, you must download some sample pricing and asset data:\n\n.. code:: bash\n\n    $ zipline ingest\n    $ zipline run -f dual_moving_average.py --start 2014-1-1 --end 2018-1-1 -o dma.pickle --no-benchmark\n\nThis will download asset pricing data data sourced from Quandl, and stream it through the algorithm over the specified time range.\nThen, the resulting performance DataFrame is saved in ``dma.pickle``, which you can load and analyze from within Python.\n\nYou can find other examples in the ``zipline/examples`` directory.\n\nQuestions?\n==========\n\nIf you find a bug, feel free to `open an issue \u003chttps://github.com/quantopian/zipline/issues/new\u003e`_ and fill out the issue template.\n\nContributing\n============\n\nAll contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas are welcome. Details on how to set up a development environment can be found in our `development guidelines \u003chttps://www.zipline.io/development-guidelines\u003e`_.\n\nIf you are looking to start working with the Zipline codebase, navigate to the GitHub `issues` tab and start looking through interesting issues. Sometimes there are issues labeled as `Beginner Friendly \u003chttps://github.com/quantopian/zipline/issues?q=is%3Aissue+is%3Aopen+label%3A%22Beginner+Friendly%22\u003e`_ or `Help Wanted \u003chttps://github.com/quantopian/zipline/issues?q=is%3Aissue+is%3Aopen+label%3A%22Help+Wanted%22\u003e`_.\n\nFeel free to ask questions on the `mailing list \u003chttps://groups.google.com/forum/#!forum/zipline\u003e`_ or on `Gitter \u003chttps://gitter.im/quantopian/zipline\u003e`_.\n\n.. note::\n\n   Please note that Zipline is not a community-led project. Zipline is\n   maintained by the Quantopian engineering team, and we are quite small and\n   often busy.\n\n   Because of this, we want to warn you that we may not attend to your pull\n   request, issue, or direct mention in months, or even years. We hope you\n   understand, and we hope that this note might help reduce any frustration or\n   wasted time.\n\n\n.. |Gitter| image:: https://badges.gitter.im/Join%20Chat.svg\n   :target: https://gitter.im/quantopian/zipline?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge\n.. |pypi version status| image:: https://img.shields.io/pypi/v/zipline.svg\n   :target: https://pypi.python.org/pypi/zipline\n.. |pypi pyversion status| image:: https://img.shields.io/pypi/pyversions/zipline.svg\n   :target: https://pypi.python.org/pypi/zipline\n.. |travis status| image:: https://travis-ci.org/quantopian/zipline.svg?branch=master\n   :target: https://travis-ci.org/quantopian/zipline\n.. |appveyor status| image:: https://ci.appveyor.com/api/projects/status/3dg18e6227dvstw6/branch/master?svg=true\n   :target: https://ci.appveyor.com/project/quantopian/zipline/branch/master\n.. |Coverage Status| image:: https://coveralls.io/repos/quantopian/zipline/badge.svg\n   :target: https://coveralls.io/r/quantopian/zipline\n\n.. _`Zipline Install Documentation` : https://www.zipline.io/install\n","funding_links":[],"categories":["Python","Libraries \u0026 Packages","Backtesting and Live Trading","Science","Trading System","资源列表","Trading System (Back Test \u0026 Live trading)","金融数据处理","科学","Science and Data Analysis","Libraries","Uncategorized","Open Source","金融股票","Backtest + live trading","Backtesters","Backtesting \u0026 Trading","科学计算和数据分析","Science [🔝](#readme)","回测引擎","Awesome Python","Trading","回测"],"sub_categories":["General - Event Driven Frameworks","Traditional Market","科学计算和数据分析","Trading \u0026 Backtesting","General-Purpose Machine Learning","Uncategorized","网络服务_其他","General purpose","交易与回测","Arbitrage","Books","Science","Ranking/Recommender","Python"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquantopian%2Fzipline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquantopian%2Fzipline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquantopian%2Fzipline/lists"}