Skip to main content

Data pipeline for algo-trading, getting and storing both real-time and historical data made easy.

Project description

PFeed: The Single Source of Truth for Algo-Trading Data. Uniting Traders to Clean Once & Share with All.

Twitter Follow Downloads PyPI PyPI - Support Python Versions afterpython Discussions Ask DeepWiki View Code Wiki

This library is NOT ready for use, please wait for 0.1.0 release.

TL;DR: use pfeed to manage your trading data; other traders will help you clean it

PFeed Architecture

For illustration purposes only, not everything shown is currently supported.

Problem

Starting algo-trading requires reliable and clean data, but traders often work in silos, each writing duplicated code to clean the same datasets—wasting time and effort. Accessing clean, ready-to-use data is a challenge, forcing traders to handle tedious data tasks before they can even start trading.

Solution

pfeed leverages modern data engineering tools to centralize data cleaning efforts, automate ETL/ELT, store data in a data lake with Delta Lake support, and output backtesting-ready data, allowing traders to focus on strategy development.


pfeed (/piː fiːd/) is the data engine for trading, serving as a pipeline between raw data sources and traders. It enables you to download historical data, stream real-time data, and store cleaned data in a local data lake for quantitative analysis, supporting both batch processing and streaming workflows through streamlined data collection, cleaning, transformation, and storage.

Core Features

  • Download or stream reliable, validated and clean data for research, backtesting, or live trading
  • Get historical data (dataframe) or live data in standardized formats by just calling a single function
  • Own your data by storing them locally using MinIO + Deltalake, or in the cloud
  • Interact with different kinds of data (including TradFi, CeFi and DeFi) using a unified interface
  • Scale using modern data tools (e.g. Polars, Dask) and workflow orchestration frameworks (e.g. Prefect for batch processing)

Table of Contents

Installation

For more installation options, please refer to the documentation.

# [RECOMMENDED]: Core Features, including MinIO, DeltaLake, Ray, Prefect, etc.
pip install -U "pfeed[core]"

# add your desired data sources, e.g. databento, polygon, etc.
pip install -U "pfeed[core,databento,polygon]"

# Minimal Features
pip install -U "pfeed"

Quick Start

Create data feed object

import pfeed as pe

bybit = pe.Bybit(data_tool='polars')
feed = bybit.market_feed  # this could be xxx.news_feed if the data source supports it

1. Get Historical Data in Dataframe

Get Bybit's data in dataframe, e.g. 1-minute data (data is downloaded on the fly if not found in storage)

df = feed.get_historical_data(
    product='BTC_USDT_PERP',  # or BTC_USDT_PERPETUAL in full
    resolution='1minute',  # '1tick'/'1t' or '2second'/'2s' etc.
    start_date='2025-01-01',
    end_date='2025-01-01',
)
See the first few rows of df:
date resolution product symbol open high low close volume
2025-01-01 00:00:00 1m BTC_USDT_PERP BTCUSDT 93530 93590.8 93501.3 93590.5 30.284
2025-01-01 00:01:00 1m BTC_USDT_PERP BTCUSDT 93590.5 93627.7 93571.8 93625 30.334

By using pfeed, you are just one function call away from getting a standardized dataframe

2. Download Historical Data

Download historical data to the storage (e.g. local, MinIO, DuckDB etc.)

feed.download(
    product='ETH_USDT_SPOT',
    resolution='1s',  # 1-second data
    rollback_period='1w',  # rollback 1 week
    to_storage='local',
)

Supported Data Sources

Data Source Get Historical Data Download Historical Data Get Live Data Stream Live Data
Yahoo Finance 🟢
Bybit 🟢 🟢 🟡 🔴
*Interactive Brokers 🔴 🔴 🔴
*FirstRate Data 🔴 🔴
*Databento 🔴 🔴 🔴 🔴
*Polygon 🔴 🔴 🔴 🔴
Binance 🔴 🔴 🔴 🔴
OKX 🔴 🔴 🔴 🔴

🟢 = finished
🟡 = in progress
🔴 = todo
⚪ = not applicable
* = paid data

Related Projects

  • PFund — A Complete Algo-Trading Framework for Machine Learning, TradFi, CeFi and DeFi ready. Supports Vectorized and Event-Driven Backtesting, Paper and Live Trading
  • PyTrade.org - A curated list of Python libraries and resources for algorithmic trading.

Disclaimer

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

This framework is intended for educational and research purposes only. It should not be used for real trading without understanding the risks involved. Trading in financial markets involves significant risk, and there is always the potential for loss. Your trading results may vary. No representation is being made that any account will or is likely to achieve profits or losses similar to those discussed on this platform.

The developers of this framework are not responsible for any financial losses incurred from using this software. This includes but not limited to losses resulting from inaccuracies in any financial data output by PFeed. Users should conduct their due diligence, verify the accuracy of any data produced by PFeed, and consult with a professional financial advisor before engaging in real trading activities.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pfeed-0.0.7.tar.gz (136.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pfeed-0.0.7-py3-none-any.whl (206.1 kB view details)

Uploaded Python 3

File details

Details for the file pfeed-0.0.7.tar.gz.

File metadata

  • Download URL: pfeed-0.0.7.tar.gz
  • Upload date:
  • Size: 136.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pfeed-0.0.7.tar.gz
Algorithm Hash digest
SHA256 724ceb4a016dc4abe88a23f2d8621eaba0bbd488d6530d160f9972daa9d4cf2d
MD5 7b9f9e1b01002ff2f4711797194ca091
BLAKE2b-256 28964237db05565faaeb410db08c79d84ed02aa48798f65e8ad88cf3320aad2a

See more details on using hashes here.

File details

Details for the file pfeed-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: pfeed-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 206.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pfeed-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 f3339efb10a7a6c0ad36b3efc4d5a8d03d19a84b3320dfc92e9d14d064779acf
MD5 96b9a0c0b315488b31c690f25f5d3606
BLAKE2b-256 01e525cd807d4f0b3c04a95e7c9018da6fa7ffe383c1fbb96f41e31604d98562

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page