Skip to main content

gann-swing

Python module to calculate Gann swings

Why?

I've gotten sick of waiting for someone to write a robust, correct Python module to calculate Gann swings with all the variations and optional parameters I want, so thought I may as well take it on myself

To run all test cases & confirm everything is working OK

$ pytest -v

To use it

(add in later)

Consuming data from different data sources

GannSwing is expecting data to be provided in a Pandas dataframe with the following set of column headings:

  • Timestamp
  • Open
  • High
  • Low
  • Close

All these columns are mandatory; any other columns in the dataframe are ignored.

Optuma

Optuma lets you copy/paste data in a CSV, tab-limited format. Here's an example of how to consume this data format

$ ipython
> from gannswing import GannSwing
> from pandas import pd
> bars = pd.read_csv('./tests/data/optuma.csv', delimiter='\t', usecols=['Date', 'Open', 'High', 'Low', 'Close'])
> bars.rename(columns={'Date': 'Timestamp'}, inplace=True)
> gs = GannSwing(bars=bars)

ProfitSource

(add later)

Yahoo Finance

(add later)

To-do list

Quite a long list, but it gives me a task list to prioritise and work to:

  • calculate ticksize
  • work out the structure of the Pandas dataframe to deliver results
  • package it into a proper Python module that I can install using pip install gann-swings
  • implement support for 1-bar, 2-bar, 3-bar, ... swings
  • be able to draw a quick chart of swings overlaid on top of a bar chart as a visual reference point
  • build a huge test suite that covers all the functionality. Tests should be able to confirm that it e.g. calculates swings correctly when it gets 17 outside days in a row...
  • work out the trend as well as the swings
  • calculate the days and price difference between successive swings
  • option to create a swing for inside days in a down trend
  • option to filter out tiny swings
  • option to compare the open & close on outside days to determine whether where to put a swing in the daily chart without waiting for the next up or down day
  • build in support for consuming OHLC data from a range of common data sources

Metadata

Release files for gannswing 0.0.1

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

Source distribution (sdist)

Source distribution for gannswing 0.0.1
File Size Uploaded
gannswing-0.0.1.tar.gz 194.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gannswing 0.0.1
File Interpreter ABI Platform
gannswing-0.0.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 199.7 kB

Release files / gannswing-0.0.1.tar.gz

Download URL gannswing-0.0.1.tar.gz
Size 194.8 kB
Tags Source
SHA-256 checksum
How to use checksums
8b0aaf65c8b1d84f2c7fe7112a38933529aa6a75ee5ff370d9c60b8aca556606
BLAKE2b-256 checksum
How to use checksums
2b0d0c6f35fddec48979a6dce8dd85db331d32244df57da465ae8bc0537659a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.28.2

Release files / gannswing-0.0.1-py2.py3-none-any.whl

Download URL gannswing-0.0.1-py2.py3-none-any.whl
Size 4.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
5b69cbef844a155bf0f66f67c30f2729624f77a5e5ac4109223a233e3fa71b10
BLAKE2b-256 checksum
How to use checksums
2ce14e675b1f23559792aa68edcd254f6b701574fd2e1f5692b4e5ba0230c1a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.28.2

Release history Release notifications | RSS feed

This release

0.0.1 This release

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