Utilities and helpers

Utilities for indicator results

Condense

results.condense() will remove non-essential results so it only returns meaningful data records. For example, when used on Candlestick Patterns, it will only return records where a signal is generated.

# Example: only show Marubozu signals
results = quotes.get_marubozu(quotes).condense();

🚩 Warning: In all cases, .condense() will remove non-essential results and will produce fewer records than are in quotes.

Find indicator result by date

results.find(lookup_date) is a simple lookup for your indicator results collection. Just specify the date you want returned.

# fetch historical quotes from your favorite feed
quotes = get_historical_quotes("MSFT")

# calculate indicator series
results = indicators.get_ema(quotes, 20)

# find result on a specific date
from datetime import datetime
lookup_date = datetime(2018, 10, 12)
result = results.find(lookup_date)

Remove warmup periods

results.remove_warmup_periods() will remove the recommended initial warmup periods from indicator results. An alternative .remove_warmup_periods(remove_periods) is also provided if you want to customize the pruning amount.

# auto remove recommended warmup periods
results = indicators.get_ema(quotes, 20).remove_warmup_periods()

# remove user-specific quantity of periods
results = indicators.get_ema(quotes, 20).remove_warmup_periods(10)

See individual indicator pages for information on recommended pruning quantities.

🚩 Note: .remove_warmup_periods() is not available on indicators that do not have any recommended pruning; however, you can still do a custom pruning by using the customizable .remove_warmup_periods(remove_periods).

🚩 Warning: .remove_warmup_periods() will reverse-engineer some parameters in determing the recommended pruning amount. Consequently, on rare occassions when there are unusual results, there can be an erroneous increase in the amount of pruning. If you want more certainty, use the .remove_warmup_periods(remove_periods) with a specific number of remove_periods.