pyharmonics.search package
Submodules
pyharmonics.search.divergence module
- class pyharmonics.search.divergence.DivergenceSearch(technicals: TechnicalsBase)[source]
Bases:
objectSearch for divergences in the slope of lows or highs.
- BEARISH = False
- BULLISH = True
- EXAGGERATED = 'Exaggerated'
- HIDDEN = 'Hidden'
- REGULAR = 'Regular'
- search(candle_spread=20, limit_to=3)[source]
Search for divergences in the slope of the lows or highs.
>>> d = DivergenceSearch(technicals) >>> d.search() >>> d.search(limit_to=5)
- Parameters:
candle_spread (int) – The spread to search for the divergence.
limit_to (int) – The number of divergences to search.
pyharmonics.search.harmonic module
- class pyharmonics.search.harmonic.HarmonicSearch(technicals, patterns=None, fib_tolerance=0.03, check_anchor=True)[source]
Bases:
objectHarmonicSearch is a class for searching for harmonic patterns in technical data.
- ABC = 'ABC'
- ABCD = 'ABCD'
- PEAK = -1
- XABCD = 'XABCD'
- forming(limit_to=-1, percent_c_to_d=0.8)[source]
Search for forming harmonic patterns in the technical data. These are different from completed patterns in that they are still forming and may not complete.
>>> h = HarmonicSearch(t) >>> h.forming() >>> h.get_patterns(formed=False)
- Parameters:
limit_to (int) – Limits to patterns that whos CD leg is projected to form in the last n candles.
percent_c_to_d (float) – The percentage of the pattern that must be complete from C to D. .8 means patterns that are 80% formed. .95 would produce fewer results as teh patterns would have to reach 95% completion.
- get_patterns(family=None, formed=True)[source]
Return the formed or forming patterns.
>>> h.get_patterns() >>> h.get_patterns(family=h.XABCD) >>> h.get_patterns(family=h.ABCD, formed=False)
- Parameters:
family (str) – The family of patterns to return.
formed (bool) – True if the formed patterns are to be returned.
- Returns:
The formed or forming patterns.
- search(limit_to=-1)[source]
Search for harmonic patterns in the technical data. These are fully formed patterns.
>>> h = HarmonicSearch(t)
Search all peaks for patterns >>> h.search()
Search for patterns that complete within the most recent 3 peaks >>> h.search(limit_to=3)
- Parameters:
limit_to (int) – Limit to patterns that completed in the last n candles. ( This speeds up the search ) Should be a positive integer. Negative values search teh entire space.
Module contents
- class pyharmonics.search.DivergenceSearch(technicals: TechnicalsBase)[source]
Bases:
objectSearch for divergences in the slope of lows or highs.
- BEARISH = False
- BULLISH = True
- EXAGGERATED = 'Exaggerated'
- HIDDEN = 'Hidden'
- REGULAR = 'Regular'
- search(candle_spread=20, limit_to=3)[source]
Search for divergences in the slope of the lows or highs.
>>> d = DivergenceSearch(technicals) >>> d.search() >>> d.search(limit_to=5)
- Parameters:
candle_spread (int) – The spread to search for the divergence.
limit_to (int) – The number of divergences to search.
- class pyharmonics.search.HarmonicSearch(technicals, patterns=None, fib_tolerance=0.03, check_anchor=True)[source]
Bases:
objectHarmonicSearch is a class for searching for harmonic patterns in technical data.
- ABC = 'ABC'
- ABCD = 'ABCD'
- PEAK = -1
- XABCD = 'XABCD'
- forming(limit_to=-1, percent_c_to_d=0.8)[source]
Search for forming harmonic patterns in the technical data. These are different from completed patterns in that they are still forming and may not complete.
>>> h = HarmonicSearch(t) >>> h.forming() >>> h.get_patterns(formed=False)
- Parameters:
limit_to (int) – Limits to patterns that whos CD leg is projected to form in the last n candles.
percent_c_to_d (float) – The percentage of the pattern that must be complete from C to D. .8 means patterns that are 80% formed. .95 would produce fewer results as teh patterns would have to reach 95% completion.
- get_patterns(family=None, formed=True)[source]
Return the formed or forming patterns.
>>> h.get_patterns() >>> h.get_patterns(family=h.XABCD) >>> h.get_patterns(family=h.ABCD, formed=False)
- Parameters:
family (str) – The family of patterns to return.
formed (bool) – True if the formed patterns are to be returned.
- Returns:
The formed or forming patterns.
- search(limit_to=-1)[source]
Search for harmonic patterns in the technical data. These are fully formed patterns.
>>> h = HarmonicSearch(t)
Search all peaks for patterns >>> h.search()
Search for patterns that complete within the most recent 3 peaks >>> h.search(limit_to=3)
- Parameters:
limit_to (int) – Limit to patterns that completed in the last n candles. ( This speeds up the search ) Should be a positive integer. Negative values search teh entire space.