Skip to main content

A Python package for calculating Gann swings

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gannswing-0.0.1.tar.gz (194.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gannswing-0.0.1-py2.py3-none-any.whl (4.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file gannswing-0.0.1.tar.gz.

File metadata

  • Download URL: gannswing-0.0.1.tar.gz
  • Upload date:
  • Size: 194.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.28.2

File hashes

Hashes for gannswing-0.0.1.tar.gz
Algorithm Hash digest
SHA256 8b0aaf65c8b1d84f2c7fe7112a38933529aa6a75ee5ff370d9c60b8aca556606
MD5 d479b8649744253fe66e2276d5d68dfd
BLAKE2b-256 2b0d0c6f35fddec48979a6dce8dd85db331d32244df57da465ae8bc0537659a1

See more details on using hashes here.

File details

Details for the file gannswing-0.0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: gannswing-0.0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.28.2

File hashes

Hashes for gannswing-0.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 5b69cbef844a155bf0f66f67c30f2729624f77a5e5ac4109223a233e3fa71b10
MD5 84d6cb0686083d923c5bb5310fe704a6
BLAKE2b-256 2ce14e675b1f23559792aa68edcd254f6b701574fd2e1f5692b4e5ba0230c1a2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page