Skip to main content

logo

A Python Package for Point & Figure Charting

license Python Version PyPi Version Package Status


Installation

pip install pypnf

Usage

Quickstart using integrated time-series example

from pypnf import PointFigureChart
from pypnf import dataset

symbol = 'AAPL'  # or 'MSFT'

ts = dataset(symbol)

pnf = PointFigureChart(ts=ts, method='cl', reversal=2, boxsize=5, scaling='abs', title=symbol)

print(pnf)
Point & Figure (abs|cl) 5 x 2 | AAPL
---  -  -  -  -  -  -  -  ---
135  .  .  .  .  .  .  X  135
130  .  .  X  .  .  .  X  130
125  .  .  X  O  .  .  X  125
120  .  .  X  O  X  .  X  120
115  .  .  X  O  X  O  X  115
110  .  .  X  O  .  O  .  110
105  .  .  X  .  .  .  .  105
100  .  .  X  .  .  .  .  100
 95  .  .  X  .  .  .  .   95
 90  .  .  X  .  .  .  .   90
 85  .  .  X  .  .  .  .   85
 80  X  .  X  .  .  .  .   80
 75  X  O  X  .  .  .  .   75
 70  .  O  X  .  .  .  .   70
 65  .  O  X  .  .  .  .   65
 60  .  O  .  .  .  .  .   60
---  -  -  -  -  -  -  -  ---
printed 7/7 columns.
Plotting Point&Figure Charts
from pypnf import PointFigureChart
from pypnf import dataset

data = dataset('^SPX')

pnf = PointFigureChart(ts=data, method='h/l', reversal=2, boxsize=50, scaling='abs', title='^SPX')
pnf.bollinger(5, 2)
pnf.donchian(8,2)
pnf.psar(0.02, 0.2)
pnf.show()

chart

Quickstart using time-series data loaded via the external package yfinance

If the yfinance and/or pandas package is not yet installed use:

pip install pandas
pip install yfinance

In order to process the downloaded data with the PointFigureChart-class the time-series data needs to be prepared.

import yfinance as yf

symbol = 'AAPL'

data = yf.Ticker(symbol)
ts = data.history(start='2018-01-01', end='2018-06-30')

# reset index
ts.reset_index(level=0, inplace=True)

# convert pd.timestamp to string
ts['Date'] = ts['Date'].dt.strftime('%Y-%m-%d')

# select required keys
ts = ts[['Date','Open','High','Low','Close']]

# convert DataFrame to dictionary
ts = ts.to_dict('list')

Initiate the PointFigureChart object with the prepared data and chart parameter, get the trendlines and print the resulting Point and Figure Chart.

from pypnf import PointFigureChart

pnf = PointFigureChart(ts=ts, method='cl', reversal=3, boxsize=2, scaling='abs', title='AAPL')
pnf.get_trendlines()
print(pnf)
Point & Figure (abs|cl) 2 x 3 | AAPL
--  -  -  -  -  -  -  -  -  -  -  -  --
90  .  .  .  .  .  .  .  .  .  .  X  90
88  .  .  .  .  .  .  .  .  .  .  X  88
86  .  .  .  .  .  .  .  .  .  .  X  86
84  .  .  .  .  .  .  .  .  .  .  X  84
82  .  .  .  .  .  .  .  .  .  .  X  82
80  .  .  .  .  X  .  .  .  .  .  X  80
78  .  .  .  .  X  O  .  .  .  .  X  78
76  .  .  .  .  X  O  .  .  .  .  X  76
74  .  .  .  .  X  O  X  .  .  .  X  74
72  .  .  .  .  X  O  X  O  .  .  X  72
70  .  .  .  .  X  O  X  O  .  .  X  70
68  .  .  .  .  X  O  .  O  X  .  X  68
66  .  .  .  .  X  .  .  O  X  O  X  66
64  .  .  .  .  X  .  .  O  X  O  X  64
62  .  .  .  .  X  .  .  O  .  O  X  62
60  .  .  .  .  X  .  .  .  .  O  X  60
58  *  .  .  .  X  .  .  .  .  O  X  58
56  X  *  .  .  X  .  .  .  .  O  .  56
54  X  O  *  .  X  .  .  .  .  .  .  54
52  X  O  .  *  X  .  .  .  .  .  *  52
50  X  O  X  .  X  .  .  .  .  *  .  50
48  X  O  X  O  X  .  .  .  *  .  .  48
46  X  O  X  O  X  .  .  *  .  .  .  46
44  X  O  X  O  .  .  *  .  .  .  .  44
42  X  O  X  .  .  *  .  .  .  .  .  42
40  X  O  X  .  *  .  .  .  .  .  .  40
38  .  O  X  *  .  .  .  .  .  .  .  38
36  .  O  *  .  .  .  .  .  .  .  .  36
--  -  -  -  -  -  -  -  -  -  -  -  --
last trendline: bullish support line of length 10
printed 11/11 columns.

Literature

Weber, Zieg (2003) The Complete Guide to Point-and-Figure Charting - The new science of an old art. Harriman House, ISBN: 1-897-5972-82

du Plessis (2012) The Definitive Guide to Point and Figure: A Comprehensive Guide to the Theory and Practical Use of the Point and Figure Charting Method. 2nd Edition. Harriman House, ISBN: 978-0857192455

du Plessis (2015) 21st Century Point and Figure - New and advanced techniques for using Point and Figure charts. Harriman House, ISBN: 978-0857194428

Shah (2018) Trading the Markets the Point & Figure way : become a noiseless trader and achieve consistent success in markets. Notion Press, ISBN: 978-1642492248


Copyright

pyPnF is licensed under a GNU General Public License v2 (GPLv2).

Metadata

Release files for pypnf 0.9

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

Source distribution (sdist)

Source distribution for pypnf 0.9
File Size Uploaded
pypnf-0.9.tar.gz 189.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pypnf 0.9
File Interpreter ABI Platform
pypnf-0.9-py3-none-any.whl Python 3 none any Details

Total release size: 379.9 kB

Release files / pypnf-0.9.tar.gz

Download URL pypnf-0.9.tar.gz
Size 189.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9d6c84684a4ccec838d20d11a3592012800fccafb67f97172b23c19e999dc5ad
BLAKE2b-256 checksum
How to use checksums
9dd56fb927f682a95f735fc3d99bf33735e12ff37f1236f2f358768aaf220476
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.0

Release files / pypnf-0.9-py3-none-any.whl

Download URL pypnf-0.9-py3-none-any.whl
Size 190.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c93f364f4f6446aca245e0cb8b4ae17308c16515fb8151788e7379ac78f88558
BLAKE2b-256 checksum
How to use checksums
60a0bcca9fc5e8ab919deaad4d23966c0517ec9c201db4a5ce1ea53c1f553773
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.0

Release history Release notifications | RSS feed

This release

0.9 This release

2 release files

0.0.7

2 release files

0.0.6

1 release file

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.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