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.5.tar.gz (125.1 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.5-py3-none-any.whl (153.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pfund_plot-0.0.5.tar.gz
  • Upload date:
  • Size: 125.1 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.5.tar.gz
Algorithm Hash digest
SHA256 c9e0908652d6458733268bff0dd89b50953a520b9f3af649d055e41cf0d14934
MD5 1e5fc9e4011d63327a98327948e38676
BLAKE2b-256 a485d925669c989d819bf274af7de30f3ffcf540bcf4526fda9ecc398f9d1959

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pfund_plot-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 153.6 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ddc04b9a4bd035575dee64e04a2d2ce5f1d573f0e71a73e5f654ea5385f90fb2
MD5 ed1f5f7433fcc259bfa196dc60444e32
BLAKE2b-256 6d87ac1c36bea8ff9ac72f6cf5e2db24c02f7067c34a4f8419c64401c8bee579

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