Data pipeline for algo-trading, getting and storing both real-time and historical data made easy.
Project description
PFeed: Data Pipeline for Algo-Trading, Getting and Storing Real-Time and Historical Data Made Easy.
Problem
Starting algo-trading requires reliable, clean data. However, the time-consuming and mundane tasks of data cleaning and storage often discourage traders from embarking on their algo-trading journey.
Solution
By leveraging modern data engineering tools, pfeed
handles the tedious data work and outputs backtesting-ready data, allowing traders to focus on strategy development.
PFeed (/piː fiːd/) is a data pipeline for algorithmic trading, serving as a bridge 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, by automating the processes of 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, with the option to connect to the cloud
- Interact with different kinds of data (including TradFi, CeFi and DeFi) using a unified interface
Table of Contents
Installation
For more installation options, please refer to the documentation.
# [RECOMMENDED]: Full Features, choose this if you do not care about the package size
pip install -U "pfeed[all]"
# Minimal Features, only supports getting, downloading and streaming data
pip install -U "pfeed[core]"
Quick Start
1. Get Historical Data in Dataframe (No storage)
Get Bybit's data in dataframe, e.g. 1-minute data (data is downloaded on the fly if not stored locally)
import pfeed as pe
feed = pe.BybitFeed(data_tool='polars')
df = feed.get_historical_data(
'BTC_USDT_PERP',
resolution='1minute', # 'raw' or '1tick'/'1t' or '2second'/'2s' etc.
start_date='2024-03-01',
end_date='2024-03-01',
)
Printing the first few rows of df
:
ts | product | resolution | open | high | low | close | volume | |
---|---|---|---|---|---|---|---|---|
0 | 2024-03-01 00:00:00 | BTC_USDT_PERP | 1m | 61184.1 | 61244.5 | 61175.8 | 61244.5 | 159.142 |
1 | 2024-03-01 00:01:00 | BTC_USDT_PERP | 1m | 61245.3 | 61276.5 | 61200.7 | 61232.2 | 227.242 |
2 | 2024-03-01 00:02:00 | BTC_USDT_PERP | 1m | 61232.2 | 61249 | 61180 | 61184.2 | 91.446 |
By using pfeed, you are just a few lines of code away from getting a standardized dataframe, how convenient!
2. Download Historical Data on the Command Line Interface (CLI)
For more CLI commands, please refer to the documentation.
# download data, default data type (dtype) is 'raw' data
pfeed download -d BYBIT -p BTC_USDT_PERP --start-date 2024-03-01 --end-date 2024-03-08
# download multiple products BTC_USDT_PERP and ETH_USDT_PERP as minute data and store them locally
pfeed download -d BYBIT -p BTC_USDT_PERP -p ETH_USDT_PERP --dtypes minute --use-minio
3. Download Historical Data in Python
import pfeed as pe
# compared to the CLI approach, this approach is more convenient for downloading multiple products
pe.download(
data_source='bybit',
pdts=[
'BTC_USDT_PERP',
'ETH_USDT_PERP',
'BCH_USDT_PERP',
],
dtypes=['raw'], # data types, e.g. 'raw', 'tick', 'second', 'minute' etc.
start_date='2024-03-01',
end_date='2024-03-08',
use_minio=False,
)
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pfeed-0.0.2.tar.gz
.
File metadata
- Download URL: pfeed-0.0.2.tar.gz
- Upload date:
- Size: 134.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.12.4 Darwin/24.0.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f9e741320492676202fd05fc4e401688cef44b16f818532e8b0cdfadeb4eb51 |
|
MD5 | 2b7509a29d52cdc7bcabdc0d6a82b526 |
|
BLAKE2b-256 | 425eb281f29dd8028f1130ad627c6742bf205334b8e877474d25dfbb386e3536 |
File details
Details for the file pfeed-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: pfeed-0.0.2-py3-none-any.whl
- Upload date:
- Size: 55.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.12.4 Darwin/24.0.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a41a5f70b107e099e4f358415ebc02c2d5a7a4a5a9774dfbf013b78f7b82a5be |
|
MD5 | 434f4f0e2881e9cfc772b168b7c55b03 |
|
BLAKE2b-256 | 43ed81c9d64f843e3aefbca0e7b94f831c38a9d7b4a943d51a7021d73829b8dc |