pypnf


Namepypnf JSON
Version 0.0.6 PyPI version JSON
download
home_pagehttps://github.com/swaschke/pypnf
SummaryA Package for Point and Figure Charting
upload_time2023-10-08 08:08:55
maintainer
docs_urlNone
authorStefan Waschke
requires_python>=3.6
licenseGPL2
keywords point and figure pnf sentiment indicator
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
![logo](https://github.com/swaschke/pypnf/blob/main/images/logo.png)

### A Python Package for Point & Figure Charting

[![license](https://img.shields.io/github/license/swaschke/pypnf)](#license)
[![Python Version](https://img.shields.io/pypi/pyversions/pypnf?style=flat)](https://pypi.org/project/pypnf/)
[![PyPi Version](https://img.shields.io/pypi/v/pypnf?style=flat)](https://pypi.org/project/pypnf/)
[![Package Status](https://img.shields.io/pypi/status/pypnf?style=flat)](https://pypi.org/project/pypnf/)

<hr>

### Installation
```python
pip install pypnf
```

<hr>

### Usage

#### Quickstart using integrated time-series example


```python
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

```python
from pypnf import PointFigureChart
from testdata 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](https://github.com/swaschke/pypnf/blob/main/images/chart.png)

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

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

```python
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.

```python
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.

```python
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.
```

<hr>

<h3>Literature</h3>

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

**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. <i>Harriman House</i>, ISBN: 978-0857192455<br> 

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

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

<hr>

<h3>Copyright</h3>
pyPnF is licensed under a GNU General Public License v2 (GPLv2).


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/swaschke/pypnf",
    "name": "pypnf",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "Point and Figure,PnF,Sentiment Indicator",
    "author": "Stefan Waschke",
    "author_email": "swaschke.pypnf@gmail.com",
    "download_url": "",
    "platform": null,
    "description": "\n![logo](https://github.com/swaschke/pypnf/blob/main/images/logo.png)\n\n### A Python Package for Point & Figure Charting\n\n[![license](https://img.shields.io/github/license/swaschke/pypnf)](#license)\n[![Python Version](https://img.shields.io/pypi/pyversions/pypnf?style=flat)](https://pypi.org/project/pypnf/)\n[![PyPi Version](https://img.shields.io/pypi/v/pypnf?style=flat)](https://pypi.org/project/pypnf/)\n[![Package Status](https://img.shields.io/pypi/status/pypnf?style=flat)](https://pypi.org/project/pypnf/)\n\n<hr>\n\n### Installation\n```python\npip install pypnf\n```\n\n<hr>\n\n### Usage\n\n#### Quickstart using integrated time-series example\n\n\n```python\nfrom pypnf import PointFigureChart\nfrom pypnf import dataset\n\nsymbol = 'AAPL'  # or 'MSFT'\n\nts = dataset(symbol)\n\npnf = PointFigureChart(ts=ts, method='cl', reversal=2, boxsize=5, scaling='abs', title=symbol)\n\nprint(pnf)\n```\n\n```\nPoint & Figure (abs|cl) 5 x 2 | AAPL\n---  -  -  -  -  -  -  -  ---\n135  .  .  .  .  .  .  X  135\n130  .  .  X  .  .  .  X  130\n125  .  .  X  O  .  .  X  125\n120  .  .  X  O  X  .  X  120\n115  .  .  X  O  X  O  X  115\n110  .  .  X  O  .  O  .  110\n105  .  .  X  .  .  .  .  105\n100  .  .  X  .  .  .  .  100\n 95  .  .  X  .  .  .  .   95\n 90  .  .  X  .  .  .  .   90\n 85  .  .  X  .  .  .  .   85\n 80  X  .  X  .  .  .  .   80\n 75  X  O  X  .  .  .  .   75\n 70  .  O  X  .  .  .  .   70\n 65  .  O  X  .  .  .  .   65\n 60  .  O  .  .  .  .  .   60\n---  -  -  -  -  -  -  -  ---\nprinted 7/7 columns.\n```\n\n##### Plotting Point&Figure Charts\n\n```python\nfrom pypnf import PointFigureChart\nfrom testdata import dataset\n\ndata = dataset('^SPX')\n\npnf = PointFigureChart(ts=data, method='h/l', reversal=2, boxsize=50, scaling='abs', title='^SPX')\npnf.bollinger(5, 2)\npnf.donchian(8,2)\npnf.psar(0.02, 0.2)\npnf.show()\n```\n![chart](https://github.com/swaschke/pypnf/blob/main/images/chart.png)\n\n#### Quickstart using time-series data loaded via the external package yfinance\n\nIf the yfinance and/or pandas package is not yet installed use:\n\n```python\npip install pandas\npip install yfinance\n```\n\nIn order to process the downloaded data with the PointFigureChart-class the time-series data needs to be  prepared.\n\n```python\nimport yfinance as yf\n\nsymbol = 'AAPL'\n\ndata = yf.Ticker(symbol)\nts = data.history(start='2018-01-01', end='2018-06-30')\n\n# reset index\nts.reset_index(level=0, inplace=True)\n\n# convert pd.timestamp to string\nts['Date'] = ts['Date'].dt.strftime('%Y-%m-%d')\n\n# select required keys\nts = ts[['Date','Open','High','Low','Close']]\n\n# convert DataFrame to dictionary\nts = ts.to_dict('list')\n```\n\nInitiate the PointFigureChart object with the prepared data and chart parameter, \nget the trendlines and print the resulting Point and Figure Chart.\n\n```python\nfrom pypnf import PointFigureChart\n\npnf = PointFigureChart(ts=ts, method='cl', reversal=3, boxsize=2, scaling='abs', title='AAPL')\npnf.get_trendlines()\nprint(pnf)\n```\n\n```\nPoint & Figure (abs|cl) 2 x 3 | AAPL\n--  -  -  -  -  -  -  -  -  -  -  -  --\n90  .  .  .  .  .  .  .  .  .  .  X  90\n88  .  .  .  .  .  .  .  .  .  .  X  88\n86  .  .  .  .  .  .  .  .  .  .  X  86\n84  .  .  .  .  .  .  .  .  .  .  X  84\n82  .  .  .  .  .  .  .  .  .  .  X  82\n80  .  .  .  .  X  .  .  .  .  .  X  80\n78  .  .  .  .  X  O  .  .  .  .  X  78\n76  .  .  .  .  X  O  .  .  .  .  X  76\n74  .  .  .  .  X  O  X  .  .  .  X  74\n72  .  .  .  .  X  O  X  O  .  .  X  72\n70  .  .  .  .  X  O  X  O  .  .  X  70\n68  .  .  .  .  X  O  .  O  X  .  X  68\n66  .  .  .  .  X  .  .  O  X  O  X  66\n64  .  .  .  .  X  .  .  O  X  O  X  64\n62  .  .  .  .  X  .  .  O  .  O  X  62\n60  .  .  .  .  X  .  .  .  .  O  X  60\n58  *  .  .  .  X  .  .  .  .  O  X  58\n56  X  *  .  .  X  .  .  .  .  O  .  56\n54  X  O  *  .  X  .  .  .  .  .  .  54\n52  X  O  .  *  X  .  .  .  .  .  *  52\n50  X  O  X  .  X  .  .  .  .  *  .  50\n48  X  O  X  O  X  .  .  .  *  .  .  48\n46  X  O  X  O  X  .  .  *  .  .  .  46\n44  X  O  X  O  .  .  *  .  .  .  .  44\n42  X  O  X  .  .  *  .  .  .  .  .  42\n40  X  O  X  .  *  .  .  .  .  .  .  40\n38  .  O  X  *  .  .  .  .  .  .  .  38\n36  .  O  *  .  .  .  .  .  .  .  .  36\n--  -  -  -  -  -  -  -  -  -  -  -  --\nlast trendline: bullish support line of length 10\nprinted 11/11 columns.\n```\n\n<hr>\n\n<h3>Literature</h3>\n\n**Weber, Zieg (2003)** The Complete Guide to Point-and-Figure Charting - The new science of an old art. <i>Harriman House</i>, ISBN: 1-897-5972-82<br>\n\n**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. <i>Harriman House</i>, ISBN: 978-0857192455<br> \n\n**du Plessis (2015)** 21st Century Point and Figure - New and advanced techniques for using Point and Figure charts. <i>Harriman House</i>, ISBN: 978-0857194428<br>\n\n**Shah (2018)** Trading the Markets the Point & Figure way : become a noiseless trader and achieve consistent success in markets. <i>Notion Press</i>, ISBN:  978-1642492248<br> \n\n<hr>\n\n<h3>Copyright</h3>\npyPnF is licensed under a GNU General Public License v2 (GPLv2).\n\n",
    "bugtrack_url": null,
    "license": "GPL2",
    "summary": "A Package for Point and Figure Charting",
    "version": "0.0.6",
    "project_urls": {
        "Homepage": "https://github.com/swaschke/pypnf"
    },
    "split_keywords": [
        "point and figure",
        "pnf",
        "sentiment indicator"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6c7b167087a8db1efd578456085f82656d8b63d97821cc1cb55b8dbaff117657",
                "md5": "72ab200f2dbeaddb3d11c305668a082e",
                "sha256": "fa9248015e9a258732cc32f918f539f8e2933ef169d12529b2c4922bf2b8c85e"
            },
            "downloads": -1,
            "filename": "pypnf-0.0.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "72ab200f2dbeaddb3d11c305668a082e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 184945,
            "upload_time": "2023-10-08T08:08:55",
            "upload_time_iso_8601": "2023-10-08T08:08:55.836450Z",
            "url": "https://files.pythonhosted.org/packages/6c/7b/167087a8db1efd578456085f82656d8b63d97821cc1cb55b8dbaff117657/pypnf-0.0.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-08 08:08:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "swaschke",
    "github_project": "pypnf",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pypnf"
}
        
Elapsed time: 0.13944s