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.3.tar.gz (124.2 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.3-py3-none-any.whl (152.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pfund_plot-0.0.3.tar.gz
  • Upload date:
  • Size: 124.2 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.3.tar.gz
Algorithm Hash digest
SHA256 201d9c23fe8ced4a133d50e0db09d162b06ec9a3182b63fb1b3fe5c4da8b8d7e
MD5 ed23af466f4fa4bb2ce4634b8a34932c
BLAKE2b-256 4aa770e80bb34b18bcba00f051df42261ac1e2e2a1e13044889799f781af0b28

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pfund_plot-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 152.2 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d4bc5dd85c5ad127b12923611abb9289ffe279b357966f30a3cf969cb798d512
MD5 e4622c5ec877c475161518c32a54b614
BLAKE2b-256 fef5c7f6685d17967f1e5d82c3cdedc0056ef7955e211c0b7afcdc2a5d5da766

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