Metadata-Version: 2.4
Name: pfeed
Version: 0.0.24
Summary: Data pipeline for algo-trading, getting and storing both real-time and historical data made easy.
Keywords: algo-trading,data pipeline,data lake,ducklake,data lakehouse,trading data,financial data,historical data,live data,streaming data
Author: Stephen Yau
Author-email: Stephen Yau <softwareentrepreneer+pfeed@gmail.com>
License-Expression: Apache-2.0
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Intended Audience :: Information Technology
Classifier: Topic :: Office/Business :: Financial
Classifier: Topic :: Office/Business :: Financial :: Investment
Classifier: Topic :: Software Development :: Libraries
Classifier: Typing :: Typed
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Requires-Dist: pfund-blocks>=0.0.4
Requires-Dist: pfund-kit>=0.1.25
Requires-Dist: pyarrow>=26.0.1 ; sys_platform != 'emscripten'
Requires-Dist: polars>=2.1.0 ; sys_platform != 'emscripten'
Requires-Dist: duckdb>=2.0.0 ; sys_platform != 'emscripten'
Requires-Dist: pandera>=0.35.0
Requires-Dist: narwhals>=2.28.0 ; sys_platform != 'emscripten'
Requires-Dist: beautifulsoup4>=4.15.0
Requires-Dist: pyzmq>=27.3.0 ; sys_platform != 'emscripten'
Requires-Dist: pfeed-bybit>=0.0.2 ; extra == 'bybit'
Requires-Dist: huggingface-hub>=2.4.0 ; extra == 'huggingface'
Requires-Dist: lancedb>=0.41.0 ; extra == 'lancedb'
Requires-Dist: prefect>=3.9.2 ; extra == 'prefect'
Requires-Dist: ray[default]>=2.60.0 ; python_full_version < '3.15' and extra == 'ray'
Requires-Python: >=3.13
Project-URL: homepage, https://pfeed.pfund.ai
Project-URL: repository, https://github.com/PFund-Software-Ltd/pfeed
Project-URL: documentation, https://pfeed.pfund.ai/doc
Provides-Extra: bybit
Provides-Extra: huggingface
Provides-Extra: lancedb
Provides-Extra: prefect
Provides-Extra: ray
Description-Content-Type: text/markdown

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

[![Discord](https://img.shields.io/badge/Discord-%235865F2.svg?logo=discord&logoColor=white)](https://discord.gg/vqpS94tpdp)
[![X](https://img.shields.io/twitter/follow/pfund_ai?style=social)](https://x.com/pfund_ai)
[![Downloads](https://static.pepy.tech/badge/pfeed/month)](https://pepy.tech/project/pfeed)
[![PyPI](https://img.shields.io/pypi/v/pfeed.svg?cacheSeconds=300)](https://pypi.org/project/pfeed)
![PyPI - Support Python Versions](https://img.shields.io/pypi/pyversions/pfeed?cacheSeconds=300)
[![afterpython](https://afterpython.org/shield.svg)](https://afterpython.org)
[![View Code Wiki](https://assets.codewiki.google/readme-badge/static.svg)](https://codewiki.google/github.com/pfund-software-ltd/pfeed?utm_source=badge&utm_medium=github&utm_campaign=github.com/pfund-software-ltd/pfeed)
<!--[![Discussions](https://img.shields.io/badge/Discussions-Let's%20Chat-green)](https://github.com/PFund-Software-Ltd/pfeed/discussions)-->
<!-- [![PyPI version](https://badge.fury.io/py/pfeed.svg)](https://badge.fury.io/py/pfeed) -->
<!-- ![PyPI downloads](https://img.shields.io/pypi/dm/pfeed?label=downloads&cacheSeconds=86400) -->
<!-- ![GitHub stars](https://img.shields.io/github/stars/PFund-Software-Ltd/pfeed?style=social) -->


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

<!--<img alt="PFeed Architecture" src="afterpython/static/pfeed.png">-->

## 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 **local data lakehouse (Parquet + [DuckLake])**, 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
- [x] Download or stream reliable, validated and **clean data** for research, backtesting, or live trading
- [x] Get historical data (**dataframe**) or live data in standardized formats by just calling one **single** function
- [x] **Own your data** — store locally now, write directly to the cloud later
- [x] Build a local data lakehouse (Parquet + [DuckLake]) on your own machine
- [x] Interact with different kinds of data (including TradFi, CeFi and DeFi) using a **unified interface**

---

<details open>
<summary>Table of Contents</summary>

- [Installation](#installation)
- [Quick Start](#quick-start)
    - [Download Historical Data](#1-download-historical-data)
    - [Retrieve Stored Data](#2-retrieve-stored-data)
    - [Stream Live Data](#3-stream-live-data)
    - [Replay Stored Data as a Stream](#4-replay-stored-data-as-a-stream)
- [Supported Data Sources](#supported-data-sources)
- [Supported IOs](#supported-ios)
- [Related Projects](#related-projects)
- [Disclaimer](#disclaimer)

</details>



## Installation
> For more installation options, please refer to the [documentation](https://pfeed.pfund.ai/doc/installation).
```bash
# pick your data source, e.g. bybit, and add ray for parallel processing (recommended).
pip install "pfeed[bybit,ray]"
```

> [!IMPORTANT]
> **Windows users:** enable long paths first, or storing data fails with `[WinError 206] The filename or extension is too long`. pfeed's data folders are deeper than Windows' default 260-character path limit. Run once in PowerShell **as Administrator**, then open a new terminal:
> ```powershell
> New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
> ```


## Quick Start
> Want to try first? Run `pfeed` in your browser — no install needed — at
 **[pfeed.pfund.ai](https://pfeed.pfund.ai/)**.
```python
import pfeed as pe

bybit = pe.Bybit()
feed = bybit.market_feed
```

### 1. Download Historical Data
Download historical data
```python
result = feed.download(
    product="BTC_USDT_PERP",  # or BTC_USDT_PERPETUAL in full
    resolution="1minute",  # '1tick'/'1t' or '2second'/'2s' etc.
    start_date="2026-01-01",
    end_date="2026-01-01",
    io=pe.ParquetIO(),  # None to skip storing
)
df = result.data.collect()
```


### 2. Retrieve Stored Data
Retrieve stored data
```python
result = feed.retrieve(
    product="BTC_USDT_PERP",
    resolution="1m",  # 1-minute data
    start_date="2026-01-01",
    end_date="2026-01-01",
    io=pe.ParquetIO(),
)
df = result.data.collect()
```


### 3. Stream Live Data
Get streaming data
```python
feed.stream(
    product="BTC_USDT_CRYPTO",
    resolution="1tick",  # or just 'tick' for tick data
    # only DuckLake supports storing streamed data for now, set it to None to skip storing
    io=pe.DuckLakeIO(),
    callback=lambda msg: print(msg),
)
```


### 4. Replay Stored Data as a Stream
Replay stored data message by message, like a live stream
```python
feed.replay(
    product="BTC_USDT_PERP",
    resolution="1m",
    start_date="2026-01-01",
    end_date="2026-01-01",
    io=pe.ParquetIO(),  # where the data was stored
    callback=lambda msg: print(msg),
)
```

[Hyperliquid]: https://hyperliquid.xyz
[Bybit]: https://bybit.com
[Binance]: https://binance.com
[OKX]: https://okx.com

## Supported Data Sources
| Data Source          | Data Categories | Download Historical Data | Stream Live Data |
| -------------------- | --------------- | ------------------------ | ---------------- |
| [Hyperliquid]        | Market Data     | 🔴                       | 🔴               |
| [Bybit]              | Market Data     | 🟢                       | 🟢               |
| [OKX]                | Market Data     | 🔴                       | 🔴               |
| [Binance]            | Market Data     | 🔴                       | 🔴               |


[Lance]: https://lance.org/
[DuckLake]: https://ducklake.select/

## Supported IOs
| IO Format   | Status |
| ----------- | ------ |
| Parquet     | 🟢     |
| [DuckLake]  | 🟢     |
| [Lance]     | 🔴     |

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


[alphafund]: https://github.com/PFund-Software-Ltd/alphafund
[pfund]: https://github.com/PFund-Software-Ltd/pfund
[pytrade]: https://pytrade.org

## Related Projects
- [alphafund] - AI-Powered Personal Hedge Fund. Be Your Own Fund Manager.
- [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] - An Educational Hub for Trading with Python. Where Python Trading Begins


## 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.
