Skip to main content

A library for financial data visualization

Project description

PFund-Plot: Financial Charts in One Line of Code

Discord X Downloads PyPI PyPI - Support Python Versions afterpython Discussions Jupyter Notebook Marimo Ask DeepWiki View Code Wiki

TL;DR: pfund-plot handles the plotting libraries, so traders just get charts that work

Problem

Traders often need to quickly visualize their data without investing time in learning new tools. For example, plotting a candlestick should be as simple as writing a single line of code.

Solution

We created a high-level financial visualization layer that combines the best features from existing plotting libraries into an easy-to-use interface.


pfund-plot candlestick streaming example

pfund-plot is a financial visualization layer on top of existing plotting libraries, giving traders a simple, domain-specific interface for plotting and streaming market data.

Core Features

  • Multi-Display Mode: support displaying plots in a Jupyter notebook, Marimo notebook, browser and desktop window
  • Intuitive & Chainable API: plt.ohlc(df).style(...).control(...).mode(...).show()
  • Streaming Plots: support streaming data in real-time
  • DataFrame Agnostic: support pandas, polars, and dask
  • Financial Plots: plot financial data by just one function call
  • Combine multiple plots into a dashboard quickly for visualization

Installation

pip install pfund-plot

Quickstart

1. Plotting in a Jupyter or Marimo Notebook

To use data sources other than Bybit, please go to pfeed and install the corresponding extras. For example: pip install "pfeed[data_source1, data_source2]"

import pfeed as pe
import pfund_plot as plt

feed = pe.Bybit().market_feed
result = feed.download(product='BTC_USDT_PERP', resolution='1h', rollback_period='1d')
df = result.data.collect()

# Notebook mode:
plt.ohlc(df)

2. Plotting in a Python Script

# Browser mode:
plt.ohlc(df).mode('browser').show()

# Desktop mode:
if __name__ == "__main__":  # Required because desktop mode uses multiprocessing.
    plt.ohlc(df).mode('desktop').show()

3. Streaming a Plot

# Streaming requires pipeline_mode=True.
feed = pe.Bybit(pipeline_mode=True).market_feed
feed.stream(product='BTC_USDT_PERP', resolution='1s')

# In a Python script:
plt.ohlc(feed).control(update_interval=1000).mode('browser')  # or mode('desktop') under if __name__ == "__main__"

# In a notebook environment (not recommended to start streaming in a notebook unless you know what you're doing):
# await plt.ohlc(feed).control(update_interval=1000).show_async()

Tapping into the JavaScript World

Python developers sometimes envy the JavaScript visualization ecosystem for its rich set of interactive charts and dashboards. With pfund-plot, they can still enjoy the benefits of the JavaScript world while keeping the same Python-first API. For example:

plt.ohlc(df).backend('svelte')

This renders the following chart using TradingView's Lightweight Charts:

pfund-plot TradingView Lightweight Charts example

This is meant as a showcase rather than a core direction: pfund-plot remains Python-first, and JavaScript-backed charts are supported where they fit naturally. If you want to bring more useful JavaScript visualizations into pfund-plot, contributions are welcome.

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

pfund_plot-0.0.2.tar.gz (119.0 kB view details)

Uploaded Source

Built Distribution

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

pfund_plot-0.0.2-py3-none-any.whl (147.0 kB view details)

Uploaded Python 3

File details

Details for the file pfund_plot-0.0.2.tar.gz.

File metadata

  • Download URL: pfund_plot-0.0.2.tar.gz
  • Upload date:
  • Size: 119.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","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 pfund_plot-0.0.2.tar.gz
Algorithm Hash digest
SHA256 df96393bc8e630340bdf4ce56fb49bcaa98f18340572a3341ca836a8606c242a
MD5 6b26e124997551584e2564552b09bddc
BLAKE2b-256 2102947a41d1d7f8c3aa68f5ab507e7e798888b0463e58f93b97305c7c368106

See more details on using hashes here.

File details

Details for the file pfund_plot-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: pfund_plot-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 147.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","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 pfund_plot-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 50c7bd3f9c03e096799a61ebd557ac6b2d32dfb1e2d017fee05954ce6c8ae5eb
MD5 0c11b78ffde950ed06bccde056d1eacc
BLAKE2b-256 790aeb80252f2cb60f42b538158e1ac5907caccd441ceeda74ff5ec4da6ea973

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