Skip to main content
File added late

1 file was added to this release more than 14 days after its initial publication. Inspect the release files before installing.

Finance Plot

Plotting financial data in Python for the most part sucks. mpl_finance is horribly slow -- and plotly too -- when displaying 100k candlesticks or more.

Meet Finance Plotter, or finplot! It utilizes pyqtgraph underneath, which to my surprise was an excellent library. Finance Plot is built to immitate matplotlib's api, but with better default looks and much better performance.

Also included is some zooming+scaling logic, so you won't get that "panning all over the place" feeling as one normally finds in most non-finance plot libraries. Plus manual line drawing, where each line segment shows % and time change.

The left mouse button pans, the mouse wheel zooms, and holding Ctrl allows you to draw lines.

Easy installation

$ pip install finplot

Example

sample

This 25-liner pulls some BitCoin data off of Bittrex and shows the above:

import finplot as fplt
import numpy as np
import pandas as pd
import requests

# pull some data
symbol = 'USDT-BTC'
url = 'https://bittrex.com/Api/v2.0/pub/market/GetTicks?marketName=%s&tickInterval=fiveMin' % symbol
data = requests.get(url).json()

# format it in pandas
df = pd.DataFrame(data['result'])
df = df.rename(columns={'T':'time', 'O':'open', 'C':'close', 'H':'high', 'L':'low', 'V':'volume'})
df = df.astype({'time':'datetime64[ns]'})

# create three plots
ax,ax2,ax3 = fplt.create_plot(symbol, rows=3)

# plot candle sticks
candle_src = fplt.PandasDataSource(df[['time','open','close','high','low']])
fplt.candlestick_ochl(candle_src, ax=ax)

# put an MA in there
fplt.plot(df['time'], df['close'].rolling(25).mean(), ax=ax, color='#0000ff', legend='ma-25')

# place some dumb markers
hi_wicks = df['high'] - df[['open','close']].T.max().T
df.loc[(hi_wicks>hi_wicks.quantile(0.99)), 'marker'] = df['close']
fplt.plot(df['time'], df['marker'], ax=ax, color='#000000', style='^', legend='dumb mark')

# draw some random crap on our second plot
df['rnd'] = np.random.normal(size=len(df))
fplt.plot(df['time'], df['rnd'], ax=ax2, color='#992277', legend='stuff')
fplt.set_y_range(ax2, -1.4, +1.7) # fix y-axis range

# finally a volume bar chart in our third plot
volume_src = fplt.PandasDataSource(df[['time','open','close','volume']])
fplt.volume_ocv(volume_src, ax=ax3)

# we're done
fplt.show()

Realtime updating with realistic indicator

Included in this repo are a 40-liner Bitfinex example and a slightly longer BitMEX websocket example, which both update in realtime with Bitcoin/Dollar pulled from the exchange. They also shows realistic and useful indicators (TD Sequential for BFX and Bollinger Bands for BitMEX).

Enjoy!

Metadata

Release files for finplot 0.3.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

File added late

1 file was uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.

We recommend inspecting the release files before installing.

Source distribution (sdist)

Source distribution for finplot 0.3.6
File Size Uploaded
finplot-0.3.6.tar.gz 16.9 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for finplot 0.3.6
File Interpreter ABI Platform
finplot-0.3.6-py3.8.egg Legacy Egg format - - Details
finplot-0.3.6-py3-none-any.whl Python 3 none any Details

Total release size: 80.0 kB

Release files / finplot-0.3.6.tar.gz

Download URL finplot-0.3.6.tar.gz
Size 16.9 kB
Tags Source
SHA-256 checksum
How to use checksums
205ab913c1631c55bf4403c3dbc48be65cb08e042c479e2217dab12dd21c251b
BLAKE2b-256 checksum
How to use checksums
b7207892bf56072641d9ce783838197900de3f4052d05c69ab805e2f899f6423
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0 requests/2.20.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.0 CPython/3.6.7

Release files / finplot-0.3.6-py3.8.egg

File added late

This file was uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.

We recommend inspecting the release file before installing.

Download URL finplot-0.3.6-py3.8.egg
Size 43.6 kB
Tags Egg
SHA-256 checksum
How to use checksums
5670b58a1381253fe68586fda94ea0b2a60d33dc6b65a8369e140756b065974b
BLAKE2b-256 checksum
How to use checksums
59972102a9c6fb0891a7df0b851549c8aebf910ca812cfcbbcaf60f199482ac3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.6

Release files / finplot-0.3.6-py3-none-any.whl

Download URL finplot-0.3.6-py3-none-any.whl
Size 19.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d0feecb266d975355e61ef320f37e246ca5c72ce708785f1b2137f6f2f90be92
BLAKE2b-256 checksum
How to use checksums
269b36cfdbaba7fba2a0c346d3f54ee8e45048dfb1b352d4910a6be14cd56177
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0 requests/2.20.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.0 CPython/3.6.7

Release history Release notifications | RSS feed

1.9.7

2 release files

1.9.6

2 release files

1.9.5

2 release files

1.9.4

2 release files

1.9.3

2 release files

1.9.2

2 release files

1.9.1

2 release files

1.9.0

2 release files

1.8.4

2 release files

1.8.3

2 release files

1.8.2

2 release files

1.8.1

2 release files

1.8

2 release files

1.7

2 release files

1.6

2 release files

1.5.4

2 release files

1.5.3

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

This release

0.3.6 This release

3 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.2

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page