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.4.tar.gz (124.3 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.4-py3-none-any.whl (152.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pfund_plot-0.0.4.tar.gz
  • Upload date:
  • Size: 124.3 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.4.tar.gz
Algorithm Hash digest
SHA256 9ea0d6301aa4742641e2d519c0242ab4feba872052b29d0969c49fa617bd99c5
MD5 5375437bf70be335c23b09f7aa4c18fa
BLAKE2b-256 661201a7da439901bc532840b9c4b5112bce85c6ee8df9cdefa25a59ac3255a4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pfund_plot-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 152.3 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 af7f7b963dcb8c15c066f00d80a4031265500545c1a8b427d6b7579bc87b8aab
MD5 f95ab2750a4de1fae4fa58d50f0814b0
BLAKE2b-256 25165f6b3c0b1b000e245d4fe45f14fe4a36fdefe0a5baa9cd826023cfe5ea6e

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