{"id":13699853,"url":"https://github.com/alpacahq/pipeline-live","last_synced_at":"2025-06-18T18:34:00.840Z","repository":{"id":51664048,"uuid":"145539929","full_name":"alpacahq/pipeline-live","owner":"alpacahq","description":"Pipeline Extension for Live Trading","archived":false,"fork":false,"pushed_at":"2023-07-25T19:34:27.000Z","size":221,"stargazers_count":207,"open_issues_count":15,"forks_count":58,"subscribers_count":48,"default_branch":"master","last_synced_at":"2025-05-26T09:43:56.730Z","etag":null,"topics":["algo-trading","algotrading","finance","financial-analysis","financial-data-analysis","hacktoberfest","iex-api","iextrading","pandas","pipeline","python","trading","trading-bot","zipline"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/pipeline-live/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alpacahq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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":null,"dei":null}},"created_at":"2018-08-21T09:22:41.000Z","updated_at":"2025-02-02T20:58:46.000Z","dependencies_parsed_at":"2024-04-17T10:53:12.504Z","dependency_job_id":"a33b8a2c-feea-44c4-bd13-7a8bbbdd5136","html_url":"https://github.com/alpacahq/pipeline-live","commit_stats":null,"previous_names":["alpacahq/pipeline_live"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/alpacahq/pipeline-live","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alpacahq%2Fpipeline-live","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alpacahq%2Fpipeline-live/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alpacahq%2Fpipeline-live/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alpacahq%2Fpipeline-live/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alpacahq","download_url":"https://codeload.github.com/alpacahq/pipeline-live/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alpacahq%2Fpipeline-live/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260609419,"owners_count":23035941,"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":["algo-trading","algotrading","finance","financial-analysis","financial-data-analysis","hacktoberfest","iex-api","iextrading","pandas","pipeline","python","trading","trading-bot","zipline"],"created_at":"2024-08-02T20:00:44.609Z","updated_at":"2025-06-18T18:33:55.820Z","avatar_url":"https://github.com/alpacahq.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":["Trading \u0026 Backtesting","交易与回测"],"readme":"# ⚠️ This software is very outdated and is not recommended for use in new setups ⚠️\n\nWe will keep this project up and with the documentation for the parts that remain\nfor those users who are still using this, but we suggest migrating to another tool\nuntil we perform a major refactoring of this project to bring it up to speed. If this\nis something you'd like to see please reach out to us to let us know!\n\nThe docs below still talk about zipline and Quantopian however Quantopian has since\ngone out of business and the below hasn't yet been updated to reflect this.\n\nIf you're looking for another modern alternative to zipline, we recommend checking\nout [zipline-reloaded](https://github.com/stefan-jansen/zipline-reloaded) in the meantime\nwhile we review committing to a major refactor of this project.\n\n## Zipline Pipeline Extension for Live Trading\n`pipeline-live` is an extension for zipline pipeline independently usable\nfor live trading, outside of zipline. While zipline is a great backtesting\nlibrary, the default Pipeline API requires complicated setup for data bundle,\nwhich is often challenging to average users. Quantopian's proprietary data\nsources such as Morningstar is also not available to many. This library is\nto address this issue by using online API data sources and simplify the interface\nfor live trading usage.\nThe interface complies the original zipline/pipeline for the most part.  For more\ndetails about the Pipeline API, please see\n[Quantopian's tutorial](https://www.quantopian.com/tutorials/pipeline) and\n[zipline document](https://www.zipline.io/).\n\nIf you are looking to use this library for your Quantopian algorithm,\ncheck out the [migration document](./migration.md).\n\n## Data Sources\nThis library predominantly relies on the [Alpaca Data API](https://docs.alpaca.markets/api-documentation/api-v2/market-data/) for daily\nprice data. [IEX Cloud](https://iexcloud.io/docs/api/) data is also supported, though if too much\ndata is requested, it stops being free. (See the note in the IEX section below.)\n\n\n## Install\n\n`pipeline-live` is a PyPI module and you can install it using `pip` command.\n\n```sh\n$ pip install pipeline-live\n```\n\nThis module is tested and expected to work with python 3.6 and later\n\n## Example\nHere is a simple pipeline example.\nPlease make sure to first set your API keys to these environment variables:\n\nusing python\n```py\nimport os\nos.environ[\"APCA_API_KEY_ID\"] = \u003cALPACA_API_KEY\u003e\nos.environ[\"APCA_API_SECRET_KEY\"] = \u003cALPACA_SECRET_KEY\u003e\n# if you use the paper endpoint:\nos.environ[\"APCA_API_BASE_URL\"] = \"https://paper-api.alpaca.markets\"\n```\n\n(or do it with bash if you prefer)\n\n```py\nfrom pipeline_live.engine import LivePipelineEngine\nfrom pipeline_live.data.sources.alpaca import list_symbols\nfrom pipeline_live.data.alpaca.pricing import USEquityPricing\nfrom pipeline_live.data.alpaca.factors import AverageDollarVolume\nfrom zipline.pipeline import Pipeline\n\neng = LivePipelineEngine(list_symbols)\ntop5 = AverageDollarVolume(window_length=20).top(5)\npipe = Pipeline({\n    'close': USEquityPricing.close.latest,\n}, screen=top5)\n\ndf = eng.run_pipeline(pipe)\n\n'''\n        close\nAAPL   215.49\nAMZN  1902.90\nFB     172.90\nQQQ    180.80\nSPY    285.79\n'''\n```\n\n## Data Cache\nSince most of the data does not change during the day, the data access layer\ncaches the dataset on disk.  In case you need to purge the cache, the cache\ndata is located in `$ZIPLINE_ROOT/data/daily_cache`.\n\n## Pipeline API\n\n### pipeline_live.engine.LivePipelineEngine\nThis class provides the similar interface to `zipline.pipeline.engine.SimplePipelineEngine`.\nThe main difference is its `run_pipeline` does not require the start and end dates as parameters,\nand returns a DataFrame with the data for the current date (US/Eastern time).\nIts constructor accepts `list_symbol` function that is supposed to return the full set of\nsymbols as a string list, which is used as the maximum universe inside the engine.\n\n## Alpaca Data API\nThe [Alpaca Data API](https://docs.alpaca.markets/api-documentation/api-v2/market-data/) is currently the least-limited source of pricing data\nsupported by pipeline-live. In order to use the Alpaca Data API, you'll need to\nregister for an Alpaca account [here](https://app.alpaca.markets/signup) and generate API key information with\nthe dashboard. Once you have your keys generated, you need to store them in\nthe following environment variables:\n\n```\nAPCA_API_BASE_URL\nAPCA_API_KEY_ID\nAPCA_API_SECRET_KEY\n```\n\n### pipeline_live.data.alpaca.pricing.USEquityPricing\nThis class provides the basic price information retrieved from\n[Alpaca Data API](https://docs.alpaca.markets/api-documentation/api-v2/market-data/bars/).\n\n## Where Did the Polygon integration go?\nAlpaca used to offer an integration with polygon, however with the removal of\nthat integration from the Alpaca api we removed the polygon integration here as well.\n\n## IEX Data Source API\nTo use IEX-source data, you need to sign up for an IEX Cloud account and save\nyour IEX token as an environment variable called `IEX_TOKEN`.\n\nIMPORTANT NOTE: IEX data is now limited for free accounts. In order to\navoid using more messages than you are allotted each month, please\nbe sure that you are not using IEX-sourced factors too frequently\nor on too many securities. For more information about how many messages\neach method will cost, please refer to [this part](https://iexcloud.io/docs/api/#data-weighting) of the IEX Cloud documentation.\n\n### pipeline_live.data.iex.pricing.USEquityPricing\nThis class provides the basic price information retrieved from\n[IEX Chart API](https://iextrading.com/developer/docs/#chart).\n\n### pipeline_live.data.iex.fundamentals.IEXCompany\nThis provides the DataSet interface using\n[IEX Company API](https://iextrading.com/developer/docs/#company).\n\n### pipeline_live.data.iex.fundamentals.IEXKeyStats\nThis provides the DataSet interface using\n[IEX Key Stats API](https://iextrading.com/developer/docs/#key-stats).\n\n### pipeline_live.data.iex.factors\nIt is important to note that the original builtin factors from zipline does\nnot work here as is, since some of them rely on zipline's USEquityPricing class.\nThis package provides the same set of zipline's builtin factor classes using\n`pipeline_live.data.iex.pricing.USEquityPricing` class. For the complete\nlist of builtin factors, please refer [zipline document](https://www.zipline.io/appendix.html#built-in-factors)\n\n### pipeline_live.data.iex.classifiers.Sector()\nA shortcut for `IEXCompany.sector.latest`\n\n### pipeline_live.data.iex.classifiers.Industry()\nA shortcut for `IEXCompany.industry.latest`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falpacahq%2Fpipeline-live","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falpacahq%2Fpipeline-live","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falpacahq%2Fpipeline-live/lists"}