Skip to main content

pyharmonics

pyharmonics detects harmonic patterns in OHLC candle data for any stock or crypto asset. See http://www.harmonictrader.com for more information on harmonic patterns and follow author Scott Carney.

video tutorial https://www.youtube.com/watch?v=oLPU_f7AiGE

Installation

From git

$ git clone git@github.com:niall-oc/pyharmonics.git
$ cd pyharmonics
$ pip install .
$ cd src
$ python
>>> from pyharmonics.marketdata import BinanceCandleData
...

From pypi

$ pip install pyharmonics
$ python
>>> from pyharmonics.marketdata import BinanceCandleData

Complete Guide

https://pyharmonics.readthedocs.io/en/latest/

Quick Guide

Use the market data features or generate your own market data matching the dataframe schema below. close_time, dts can be omitted

>>> from pyharmonics.marketdata import BinanceCandleData
>>> b = BinanceCandleData()
>>> b.get_candles('BTCUSDT', b.MIN_15, 1000)
>>> b.df
>>> b.df
                               open      high       low     close     volume  close_time                       dts
index                                                                                                             
2023-07-09 07:44:59+01:00  30249.04  30267.04  30233.79  30262.33   79.71611  1688885099 2023-07-09 07:44:59+01:00
2023-07-09 07:59:59+01:00  30262.32  30267.87  30235.00  30254.79  136.31718  1688885999 2023-07-09 07:59:59+01:00
2023-07-09 08:14:59+01:00  30254.80  30283.50  30233.33  30283.50  185.04086  1688886899 2023-07-09 08:14:59+01:00
2023-07-09 08:29:59+01:00  30283.50  30283.50  30263.37  30263.37   74.17937  1688887799 2023-07-09 08:29:59+01:00
2023-07-09 08:44:59+01:00  30263.37  30270.09  30243.10  30257.30  121.15791  1688888699 2023-07-09 08:44:59+01:00
...                             ...       ...       ...       ...        ...         ...                       ...
2023-07-19 16:29:59+01:00  29841.37  29902.00  29841.36  29878.00  267.42077  1689780599 2023-07-19 16:29:59+01:00
2023-07-19 16:44:59+01:00  29878.00  29933.00  29866.15  29890.01  245.03318  1689781499 2023-07-19 16:44:59+01:00
2023-07-19 16:59:59+01:00  29890.01  29995.16  29890.00  29956.46  611.16786  1689782399 2023-07-19 16:59:59+01:00
2023-07-19 17:14:59+01:00  29956.46  29979.00  29901.70  29930.57  365.35485  1689783299 2023-07-19 17:14:59+01:00
2023-07-19 17:29:59+01:00  29930.57  29930.57  29870.00  29901.40  244.14513  1689784199 2023-07-19 17:29:59+01:00

[1000 rows x 7 columns]

Create a technicals object for further analysis.

>>> from pyharmonics.technicals import Technicals
>>> t = Technicals(b.df, b.symbol, b.interval)

Search for a harmonic pattern.

>>> from pyharmonics.search import HarmonicSearch
>>> m = HarmonicSearch(t)
>>> m.search()

Plot the findings.

>>> from pyharmonics.plotter import Plotter
>>> p = Plotter(t, 'BTCUSDT', b.MIN_15)
>>> p.add_harmonic_plots(m.get_patterns(family=m.XABCD))
>>> p.show()

You will see something like this.

This is an image

See all harmonic patterns.

>>> p = Plotter(t, 'BTCUSDT', b.HOUR_1)
>>> p.add_harmonic_plots(m.get_patterns())
>>> p.show()

You will see something like this.

This is an image

See all forming patterns.

>>> h = HarmonicSearch(t)
>>> h.forming()
>>> p = Plotter(t, 'BTCUSDT', b.HOUR_1)
>>> p.add_harmonic_plots(h.get_patterns(formed=False))
>>> p.show()

etc.

Metadata

Release files for pyharmonics 1.5.3

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

Source distribution (sdist)

Source distribution for pyharmonics 1.5.3
File Size Uploaded Provenance Actions
pyharmonics-1.5.3.tar.gz 48.6 kB Without provenance Details for pyharmonics-1.5.3.tar.gz

Built distribution (wheel)

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

Total release size: 94.4 kB

Release files / pyharmonics-1.5.3.tar.gz

Download URL pyharmonics-1.5.3.tar.gz
Size 48.6 kB
Tags Source
SHA-256 checksum
How to use checksums
84f0109624a33c010a75972fb3e5b2b88a00429105d7987821944fb40cab24a1
BLAKE2b-256 checksum
How to use checksums
624f496b97968ea4ea0baf5079719f2ed9c01f100cc157fc99bfec9226768604
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / pyharmonics-1.5.3-py3-none-any.whl

Download URL pyharmonics-1.5.3-py3-none-any.whl
Size 45.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
70fc643ffdc4762c63a7cb2c08980bdad5583a70a8559547e1330c0fd578b519
BLAKE2b-256 checksum
How to use checksums
55a03033f8b6e6990556cdb3c2bc66736dcfc104f2626984bda7888f8cb1540c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Security for pyharmonics 1.5.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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