Repository: froggleston/cryptofrog-strategies Branch: main Commit: bebdf6341548 Files: 7 Total size: 55.4 KB Directory structure: gitextract__iqrbgj2/ ├── .gitignore ├── CryptoFrog.py ├── LICENSE ├── README.md ├── cryptofrog.config.json ├── custom_indicators.py └── live_plotting.ipynb ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ pip-wheel-metadata/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py db.sqlite3 db.sqlite3-journal # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock # PEP 582; used by e.g. github.com/David-OConnor/pyflow __pypackages__/ # Celery stuff celerybeat-schedule celerybeat.pid # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ ================================================ FILE: CryptoFrog.py ================================================ from typing import Dict, List, Optional, Tuple from datetime import datetime, timedelta from cachetools import TTLCache ## I hope you know what these are already from pandas import DataFrame import numpy as np ## Indicator libs import talib.abstract as ta from finta import TA as fta ## FT stuffs from freqtrade.strategy import IStrategy, merge_informative_pair, stoploss_from_open, IntParameter, DecimalParameter, CategoricalParameter import freqtrade.vendor.qtpylib.indicators as qtpylib from freqtrade.exchange import timeframe_to_minutes from freqtrade.persistence import Trade from skopt.space import Dimension class CryptoFrog(IStrategy): # ROI table - this strat REALLY benefits from roi and trailing hyperopt: minimal_roi = { "0": 0.213, "39": 0.103, "96": 0.037, "166": 0 } # Stoploss: stoploss = -0.085 # Trailing stop: trailing_stop = True trailing_stop_positive = 0.01 trailing_stop_positive_offset = 0.047 trailing_only_offset_is_reached = False use_custom_stoploss = True custom_stop = { # Linear Decay Parameters 'decay-time': 166, # minutes to reach end, I find it works well to match this to the final ROI value - default 1080 'decay-delay': 0, # minutes to wait before decay starts 'decay-start': -0.085, # -0.32118, # -0.07163, # starting value: should be the same or smaller than initial stoploss - default -0.30 'decay-end': -0.02, # ending value - default -0.03 # Profit and TA 'cur-min-diff': 0.03, # diff between current and minimum profit to move stoploss up to min profit point 'cur-threshold': -0.02, # how far negative should current profit be before we consider moving it up based on cur/min or roc 'roc-bail': -0.03, # value for roc to use for dynamic bailout 'rmi-trend': 50, # rmi-slow value to pause stoploss decay 'bail-how': 'immediate', # set the stoploss to the atr offset below current price, or immediate # Positive Trailing 'pos-trail': True, # enable trailing once positive 'pos-threshold': 0.005, # trail after how far positive 'pos-trail-dist': 0.015 # how far behind to place the trail } # Dynamic ROI droi_trend_type = CategoricalParameter(['rmi', 'ssl', 'candle', 'any'], default='any', space='sell', optimize=True) droi_pullback = CategoricalParameter([True, False], default=True, space='sell', optimize=True) droi_pullback_amount = DecimalParameter(0.005, 0.02, default=0.005, space='sell') droi_pullback_respect_table = CategoricalParameter([True, False], default=False, space='sell', optimize=True) # Custom Stoploss cstp_threshold = DecimalParameter(-0.05, 0, default=-0.03, space='sell') cstp_bail_how = CategoricalParameter(['roc', 'time', 'any'], default='roc', space='sell', optimize=True) cstp_bail_roc = DecimalParameter(-0.05, -0.01, default=-0.03, space='sell') cstp_bail_time = IntParameter(720, 1440, default=720, space='sell') stoploss = custom_stop['decay-start'] custom_trade_info = {} custom_current_price_cache: TTLCache = TTLCache(maxsize=100, ttl=300) # 5 minutes # run "populate_indicators" only for new candle process_only_new_candles = False # Experimental settings (configuration will overide these if set) use_sell_signal = True sell_profit_only = False ignore_roi_if_buy_signal = False use_dynamic_roi = True timeframe = '5m' informative_timeframe = '1h' # Optional order type mapping order_types = { 'buy': 'limit', 'sell': 'limit', 'stoploss': 'market', 'stoploss_on_exchange': False } plot_config = { 'main_plot': { 'Smooth_HA_H': {'color': 'orange'}, 'Smooth_HA_L': {'color': 'yellow'}, }, 'subplots': { "StochRSI": { 'srsi_k': {'color': 'blue'}, 'srsi_d': {'color': 'red'}, }, "MFI": { 'mfi': {'color': 'green'}, }, "BBEXP": { 'bbw_expansion': {'color': 'orange'}, }, "FAST": { 'fastd': {'color': 'red'}, 'fastk': {'color': 'blue'}, }, "SQZMI": { 'sqzmi': {'color': 'lightgreen'}, }, "VFI": { 'vfi': {'color': 'lightblue'}, }, "DMI": { 'dmi_plus': {'color': 'orange'}, 'dmi_minus': {'color': 'yellow'}, }, "EMACO": { 'emac_1h': {'color': 'red'}, 'emao_1h': {'color': 'blue'}, }, } } def informative_pairs(self): pairs = self.dp.current_whitelist() #pairs.append("BTC/USDT") #pairs.append("ETH/USDT") informative_pairs = [(pair, self.informative_timeframe) for pair in pairs] return informative_pairs ## smoothed Heiken Ashi def HA(self, dataframe, smoothing=None): df = dataframe.copy() df['HA_Close']=(df['open'] + df['high'] + df['low'] + df['close'])/4 df.reset_index(inplace=True) ha_open = [ (df['open'][0] + df['close'][0]) / 2 ] [ ha_open.append((ha_open[i] + df['HA_Close'].values[i]) / 2) for i in range(0, len(df)-1) ] df['HA_Open'] = ha_open df.set_index('index', inplace=True) df['HA_High']=df[['HA_Open','HA_Close','high']].max(axis=1) df['HA_Low']=df[['HA_Open','HA_Close','low']].min(axis=1) if smoothing is not None: sml = abs(int(smoothing)) if sml > 0: df['Smooth_HA_O']=ta.EMA(df['HA_Open'], sml) df['Smooth_HA_C']=ta.EMA(df['HA_Close'], sml) df['Smooth_HA_H']=ta.EMA(df['HA_High'], sml) df['Smooth_HA_L']=ta.EMA(df['HA_Low'], sml) return df def hansen_HA(self, informative_df, period=6): dataframe = informative_df.copy() dataframe['hhclose']=(dataframe['open'] + dataframe['high'] + dataframe['low'] + dataframe['close']) / 4 dataframe['hhopen']= ((dataframe['open'].shift(2) + dataframe['close'].shift(2))/ 2) #it is not the same as real heikin ashi since I found that this is better. dataframe['hhhigh']=dataframe[['open','close','high']].max(axis=1) dataframe['hhlow']=dataframe[['open','close','low']].min(axis=1) dataframe['emac'] = ta.SMA(dataframe['hhclose'], timeperiod=period) #to smooth out the data and thus less noise. dataframe['emao'] = ta.SMA(dataframe['hhopen'], timeperiod=period) return {'emac': dataframe['emac'], 'emao': dataframe['emao']} ## detect BB width expansion to indicate possible volatility def bbw_expansion(self, bbw_rolling, mult=1.1): bbw = list(bbw_rolling) m = 0.0 for i in range(len(bbw)-1): if bbw[i] > m: m = bbw[i] if (bbw[-1] > (m * mult)): return 1 return 0 ## do_indicator style a la Obelisk strategies def do_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: # Stoch fast - mainly due to 5m timeframes stoch_fast = ta.STOCHF(dataframe) dataframe['fastd'] = stoch_fast['fastd'] dataframe['fastk'] = stoch_fast['fastk'] #StochRSI for double checking things period = 14 smoothD = 3 SmoothK = 3 dataframe['rsi'] = ta.RSI(dataframe, timeperiod=14) stochrsi = (dataframe['rsi'] - dataframe['rsi'].rolling(period).min()) / (dataframe['rsi'].rolling(period).max() - dataframe['rsi'].rolling(period).min()) dataframe['srsi_k'] = stochrsi.rolling(SmoothK).mean() * 100 dataframe['srsi_d'] = dataframe['srsi_k'].rolling(smoothD).mean() # Bollinger Bands because obviously bollinger = qtpylib.bollinger_bands(qtpylib.typical_price(dataframe), window=20, stds=1) dataframe['bb_lowerband'] = bollinger['lower'] dataframe['bb_middleband'] = bollinger['mid'] dataframe['bb_upperband'] = bollinger['upper'] # SAR Parabol - probably don't need this dataframe['sar'] = ta.SAR(dataframe) ## confirm wideboi variance signal with bbw expansion dataframe["bb_width"] = ((dataframe["bb_upperband"] - dataframe["bb_lowerband"]) / dataframe["bb_middleband"]) dataframe['bbw_expansion'] = dataframe['bb_width'].rolling(window=4).apply(self.bbw_expansion) # confirm entry and exit on smoothed HA dataframe = self.HA(dataframe, 4) # thanks to Hansen_Khornelius for this idea that I apply to the 1hr informative # https://github.com/hansen1015/freqtrade_strategy hansencalc = self.hansen_HA(dataframe, 6) dataframe['emac'] = hansencalc['emac'] dataframe['emao'] = hansencalc['emao'] # money flow index (MFI) for in/outflow of money, like RSI adjusted for vol dataframe['mfi'] = fta.MFI(dataframe) ## sqzmi to detect quiet periods dataframe['sqzmi'] = fta.SQZMI(dataframe) #, MA=hansencalc['emac']) # Volume Flow Indicator (MFI) for volume based on the direction of price movement dataframe['vfi'] = fta.VFI(dataframe, period=14) dmi = fta.DMI(dataframe, period=14) dataframe['dmi_plus'] = dmi['DI+'] dataframe['dmi_minus'] = dmi['DI-'] dataframe['adx'] = fta.ADX(dataframe, period=14) ## for stoploss - all from Solipsis4 ## simple ATR and ROC for stoploss dataframe['atr'] = ta.ATR(dataframe, timeperiod=14) dataframe['roc'] = ta.ROC(dataframe, timeperiod=9) dataframe['rmi'] = RMI(dataframe, length=24, mom=5) ssldown, sslup = SSLChannels_ATR(dataframe, length=21) dataframe['sroc'] = SROC(dataframe, roclen=21, emalen=13, smooth=21) dataframe['ssl-dir'] = np.where(sslup > ssldown,'up','down') dataframe['rmi-up'] = np.where(dataframe['rmi'] >= dataframe['rmi'].shift(),1,0) dataframe['rmi-up-trend'] = np.where(dataframe['rmi-up'].rolling(5).sum() >= 3,1,0) dataframe['candle-up'] = np.where(dataframe['close'] >= dataframe['close'].shift(),1,0) dataframe['candle-up-trend'] = np.where(dataframe['candle-up'].rolling(5).sum() >= 3,1,0) return dataframe ## stolen from Obelisk's Ichi strat code and backtest blog post, and Solipsis4 def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: # Populate/update the trade data if there is any, set trades to false if not live/dry self.custom_trade_info[metadata['pair']] = self.populate_trades(metadata['pair']) if self.config['runmode'].value in ('backtest', 'hyperopt'): assert (timeframe_to_minutes(self.timeframe) <= 30), "Backtest this strategy in 5m or 1m timeframe." if self.timeframe == self.informative_timeframe: dataframe = self.do_indicators(dataframe, metadata) else: if not self.dp: return dataframe informative = self.dp.get_pair_dataframe(pair=metadata['pair'], timeframe=self.informative_timeframe) informative = self.do_indicators(informative.copy(), metadata) dataframe = merge_informative_pair(dataframe, informative, self.timeframe, self.informative_timeframe, ffill=True) skip_columns = [(s + "_" + self.informative_timeframe) for s in ['date', 'open', 'high', 'low', 'close', 'volume', 'emac', 'emao']] dataframe.rename(columns=lambda s: s.replace("_{}".format(self.informative_timeframe), "") if (not s in skip_columns) else s, inplace=True) # Slam some indicators into the trade_info dict so we can dynamic roi and custom stoploss in backtest if self.dp.runmode.value in ('backtest', 'hyperopt'): self.custom_trade_info[metadata['pair']]['roc'] = dataframe[['date', 'roc']].copy().set_index('date') self.custom_trade_info[metadata['pair']]['atr'] = dataframe[['date', 'atr']].copy().set_index('date') self.custom_trade_info[metadata['pair']]['sroc'] = dataframe[['date', 'sroc']].copy().set_index('date') self.custom_trade_info[metadata['pair']]['ssl-dir'] = dataframe[['date', 'ssl-dir']].copy().set_index('date') self.custom_trade_info[metadata['pair']]['rmi-up-trend'] = dataframe[['date', 'rmi-up-trend']].copy().set_index('date') self.custom_trade_info[metadata['pair']]['candle-up-trend'] = dataframe[['date', 'candle-up-trend']].copy().set_index('date') return dataframe ## cryptofrog signals def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: dataframe.loc[ ( ( ## close ALWAYS needs to be lower than the heiken low at 5m (dataframe['close'] < dataframe['Smooth_HA_L']) & ## Hansen's HA EMA at informative timeframe (dataframe['emac_1h'] < dataframe['emao_1h']) ) & ( ( ## potential uptick incoming so buy (dataframe['bbw_expansion'] == 1) & (dataframe['sqzmi'] == False) & ( (dataframe['mfi'] < 20) | (dataframe['dmi_minus'] > 30) ) ) | ( # this tries to find extra buys in undersold regions (dataframe['close'] < dataframe['sar']) & ((dataframe['srsi_d'] >= dataframe['srsi_k']) & (dataframe['srsi_d'] < 30)) & ((dataframe['fastd'] > dataframe['fastk']) & (dataframe['fastd'] < 23)) & (dataframe['mfi'] < 30) ) | ( # find smaller temporary dips in sideways ( ((dataframe['dmi_minus'] > 30) & qtpylib.crossed_above(dataframe['dmi_minus'], dataframe['dmi_plus'])) & (dataframe['close'] < dataframe['bb_lowerband']) ) | ( ## if nothing else is making a buy signal ## just throw in any old SQZMI shit based fastd ## this needs work! (dataframe['sqzmi'] == True) & ((dataframe['fastd'] > dataframe['fastk']) & (dataframe['fastd'] < 20)) ) ) ## volume sanity checks & (dataframe['vfi'] < 0.0) & (dataframe['volume'] > 0) ) ), 'buy'] = 1 return dataframe ## more going on here def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: dataframe.loc[ ( ( ## close ALWAYS needs to be higher than the heiken high at 5m (dataframe['close'] > dataframe['Smooth_HA_H']) & ## Hansen's HA EMA at informative timeframe (dataframe['emac_1h'] > dataframe['emao_1h']) ) & ( ## try to find oversold regions with a corresponding BB expansion ( (dataframe['bbw_expansion'] == 1) & ( (dataframe['mfi'] > 80) | (dataframe['dmi_plus'] > 30) ) ) ## volume sanity checks & (dataframe['vfi'] > 0.0) & (dataframe['volume'] > 0) ) ), 'sell'] = 1 return dataframe """ Everything from here completely stolen from the godly work of @werkkrew Custom Stoploss """ def custom_stoploss(self, pair: str, trade: 'Trade', current_time: datetime, current_rate: float, current_profit: float, **kwargs) -> float: trade_dur = int((current_time.timestamp() - trade.open_date_utc.timestamp()) // 60) if self.config['runmode'].value in ('live', 'dry_run'): dataframe, last_updated = self.dp.get_analyzed_dataframe(pair=pair, timeframe=self.timeframe) sroc = dataframe['sroc'].iat[-1] # If in backtest or hyperopt, get the indicator values out of the trades dict (Thanks @JoeSchr!) else: sroc = self.custom_trade_info[trade.pair]['sroc'].loc[current_time]['sroc'] if current_profit < self.cstp_threshold.value: if self.cstp_bail_how.value == 'roc' or self.cstp_bail_how.value == 'any': # Dynamic bailout based on rate of change if (sroc/100) <= self.cstp_bail_roc.value: return 0.001 if self.cstp_bail_how.value == 'time' or self.cstp_bail_how.value == 'any': # Dynamic bailout based on time if trade_dur > self.cstp_bail_time.value: return 0.001 return 1 """ Freqtrade ROI Overload for dynamic ROI functionality """ def min_roi_reached_dynamic(self, trade: Trade, current_profit: float, current_time: datetime, trade_dur: int) -> Tuple[Optional[int], Optional[float]]: minimal_roi = self.minimal_roi _, table_roi = self.min_roi_reached_entry(trade_dur) # see if we have the data we need to do this, otherwise fall back to the standard table if self.custom_trade_info and trade and trade.pair in self.custom_trade_info: if self.config['runmode'].value in ('live', 'dry_run'): dataframe, last_updated = self.dp.get_analyzed_dataframe(pair=trade.pair, timeframe=self.timeframe) rmi_trend = dataframe['rmi-up-trend'].iat[-1] candle_trend = dataframe['candle-up-trend'].iat[-1] ssl_dir = dataframe['ssl-dir'].iat[-1] # If in backtest or hyperopt, get the indicator values out of the trades dict (Thanks @JoeSchr!) else: rmi_trend = self.custom_trade_info[trade.pair]['rmi-up-trend'].loc[current_time]['rmi-up-trend'] candle_trend = self.custom_trade_info[trade.pair]['candle-up-trend'].loc[current_time]['candle-up-trend'] ssl_dir = self.custom_trade_info[trade.pair]['ssl-dir'].loc[current_time]['ssl-dir'] min_roi = table_roi max_profit = trade.calc_profit_ratio(trade.max_rate) pullback_value = (max_profit - self.droi_pullback_amount.value) in_trend = False if self.droi_trend_type.value == 'rmi' or self.droi_trend_type.value == 'any': if rmi_trend == 1: in_trend = True if self.droi_trend_type.value == 'ssl' or self.droi_trend_type.value == 'any': if ssl_dir == 'up': in_trend = True if self.droi_trend_type.value == 'candle' or self.droi_trend_type.value == 'any': if candle_trend == 1: in_trend = True # Force the ROI value high if in trend if (in_trend == True): min_roi = 100 # If pullback is enabled, allow to sell if a pullback from peak has happened regardless of trend if self.droi_pullback.value == True and (current_profit < pullback_value): if self.droi_pullback_respect_table.value == True: min_roi = table_roi else: min_roi = current_profit / 2 else: min_roi = table_roi return trade_dur, min_roi # Change here to allow loading of the dynamic_roi settings def min_roi_reached(self, trade: Trade, current_profit: float, current_time: datetime) -> bool: trade_dur = int((current_time.timestamp() - trade.open_date_utc.timestamp()) // 60) if self.use_dynamic_roi: _, roi = self.min_roi_reached_dynamic(trade, current_profit, current_time, trade_dur) else: _, roi = self.min_roi_reached_entry(trade_dur) if roi is None: return False else: return current_profit > roi # Get the current price from the exchange (or local cache) def get_current_price(self, pair: str, refresh: bool) -> float: if not refresh: rate = self.custom_current_price_cache.get(pair) # Check if cache has been invalidated if rate: return rate ask_strategy = self.config.get('ask_strategy', {}) if ask_strategy.get('use_order_book', False): ob = self.dp.orderbook(pair, 1) rate = ob[f"{ask_strategy['price_side']}s"][0][0] else: ticker = self.dp.ticker(pair) rate = ticker['last'] self.custom_current_price_cache[pair] = rate return rate """ Stripped down version from Schism, meant only to update the price data a bit more frequently than the default instead of getting all sorts of trade information """ def populate_trades(self, pair: str) -> dict: # Initialize the trades dict if it doesn't exist, persist it otherwise if not pair in self.custom_trade_info: self.custom_trade_info[pair] = {} # init the temp dicts and set the trade stuff to false trade_data = {} trade_data['active_trade'] = False # active trade stuff only works in live and dry, not backtest if self.config['runmode'].value in ('live', 'dry_run'): # find out if we have an open trade for this pair active_trade = Trade.get_trades([Trade.pair == pair, Trade.is_open.is_(True),]).all() # if so, get some information if active_trade: # get current price and update the min/max rate current_rate = self.get_current_price(pair, True) active_trade[0].adjust_min_max_rates(current_rate) return trade_data # nested hyperopt class class HyperOpt: # defining as dummy, so that no error is thrown about missing # sell indicator space when hyperopting for all spaces @staticmethod def indicator_space() -> List[Dimension]: return [] ## goddamnit def RMI(dataframe, *, length=20, mom=5): """ Source: https://github.com/freqtrade/technical/blob/master/technical/indicators/indicators.py#L912 """ df = dataframe.copy() df['maxup'] = (df['close'] - df['close'].shift(mom)).clip(lower=0) df['maxdown'] = (df['close'].shift(mom) - df['close']).clip(lower=0) df.fillna(0, inplace=True) df["emaInc"] = ta.EMA(df, price='maxup', timeperiod=length) df["emaDec"] = ta.EMA(df, price='maxdown', timeperiod=length) df['RMI'] = np.where(df['emaDec'] == 0, 0, 100 - 100 / (1 + df["emaInc"] / df["emaDec"])) return df["RMI"] def SSLChannels_ATR(dataframe, length=7): """ SSL Channels with ATR: https://www.tradingview.com/script/SKHqWzql-SSL-ATR-channel/ Credit to @JimmyNixx for python """ df = dataframe.copy() df['ATR'] = ta.ATR(df, timeperiod=14) df['smaHigh'] = df['high'].rolling(length).mean() + df['ATR'] df['smaLow'] = df['low'].rolling(length).mean() - df['ATR'] df['hlv'] = np.where(df['close'] > df['smaHigh'], 1, np.where(df['close'] < df['smaLow'], -1, np.NAN)) df['hlv'] = df['hlv'].ffill() df['sslDown'] = np.where(df['hlv'] < 0, df['smaHigh'], df['smaLow']) df['sslUp'] = np.where(df['hlv'] < 0, df['smaLow'], df['smaHigh']) return df['sslDown'], df['sslUp'] def SROC(dataframe, roclen=21, emalen=13, smooth=21): df = dataframe.copy() roc = ta.ROC(df, timeperiod=roclen) ema = ta.EMA(df, timeperiod=emalen) sroc = ta.ROC(ema, timeperiod=smooth) return sroc ================================================ FILE: LICENSE ================================================ Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ================================================ FILE: README.md ================================================ # cryptofrog-strategies CryptoFrog - My First Strategy for freqtrade **_DO NOT USE THIS FOR LIVE TRADING_** # "Release" Notes - 2021-04-26: The informatives branch now includes a big refactor to include new KAMA and Madrid Squeeze code. Hyperopting now in the main strategy. I'll pull this into main whenever I feel it's ready. - 2021-04-20: You'll need the latest freqtrade develop branch otherwise you might see weird "supersell" results in your backtraces. Head to the freqtrade discord for more info. Heavily borrowing ideas from: - https://github.com/werkkrew/freqtrade-strategies : Amazing work on Solipsis that influenced my general framework and custom_stoploss - https://github.com/brookmiles/freqtrade-stuff : Great Ichi based strat from Obelisk - https://github.com/hansen1015/freqtrade_strategy/blob/main/heikin.py : Using the smoothed Heiken Ashi on the CryptoFrog 1hr informative timeframe # Things to Know - Fairly conservative strategy focusing on fewer buys and longer holds to find large peaks. - Designed to trade altcoins against stablecoins, and I've used USDT intentionally to gain relative stability within BTC/ETH dump cycles - Hyperopting is now available for most of the key indicator thresholds. - Protections need to be enabled. I've included a basic template config - hit me up on the freqtrade discord for any info but no surprises expected really - Included a live_plotting.ipynb notebook that can be used to immediately and easily view backtest results # TODO - Better buy signals - Better informative pair work looking for BTC/ETH trends - More testing # Preprequisites You'll need: - Python 3.7+ - Jupyter Notebook for the live_plotting.ipynb - finta - TA-Lib (I run my bot on a Raspberry Pi 400, so you'll need to build TA-Lib as per the Freqtrade docs if you're doing the same) - Pandas - Numpy - Pandas-TA indicator library - ~~Solipsis_v4 custom_indicators.py (now included in this repo - thanks for the go-ahead @werkkrew)~~ ================================================ FILE: cryptofrog.config.json ================================================ { "max_open_trades": -1, "stake_currency": "USDT", "stake_amount": 150, "tradable_balance_ratio": 0.99, "fiat_display_currency": "GBP", "dry_run": true, "dry_run_wallet": 1500, "unfilledtimeout": { "buy": 20, "sell": 40 }, "bid_strategy": { "price_side" : "ask", "ask_last_balance": 0.0, "use_order_book": true, "order_book_top": 1, "check_depth_of_market": { "enabled": true, "bids_to_ask_delta": 1 } }, "ask_strategy": { "price_side" : "bid", "use_order_book": true, "order_book_min": 1, "order_book_max": 1, }, "exchange": { "name": "", "sandbox": false, "key": "", "secret": "", "ccxt_config": {"enableRateLimit": true}, "ccxt_async_config": { "enableRateLimit": false, "rateLimit": 500 }, "pair_whitelist":[], "pair_blacklist": [ "GBP/USDT", "EUR/USDT", "BUSD/USDT", "USDC/USDT" ] }, "pairlists": [ { "method": "StaticPairList" }, // { // "method": "VolumePairList", // "number_assets": 80, // "sort_key": "quoteVolume", // "refresh_period": 300 // }, {"method": "AgeFilter", "min_days_listed": 30}, // {"method": "PrecisionFilter"}, {"method": "PriceFilter", "low_price_ratio": 0.01}, {"method": "SpreadFilter", "max_spread_ratio": 0.003}, { "method": "RangeStabilityFilter", "lookback_days": 3, "min_rate_of_change": 0.1, "refresh_period": 360 }, ], "protections": [ { "method": "CooldownPeriod", "stop_duration_candles": 1 }, { "method": "StoplossGuard", "lookback_period_candles": 6, "trade_limit": 2, "stop_duration_candles": 1440, "only_per_pair": true }, // { // "method": "LowProfitPairs", // "lookback_period_candles": 3, // "trade_limit": 2, // "stop_duration_candles": 4, // "required_profit": 0.015 // }, // { // "method": "LowProfitPairs", // "lookback_period_candles": 24, // "trade_limit": 3, // "stop_duration_candles": 12, // "required_profit": 0.01 // } ], "edge": { "enabled": false, "process_throttle_secs": 3600, "calculate_since_number_of_days": 10, "allowed_risk": 0.02, "stoploss_range_min": -0.01, "stoploss_range_max": -0.3, "stoploss_range_step": -0.01, "minimum_winrate": 0.60, "minimum_expectancy": 0.20, "min_trade_number": 10, "max_trade_duration_minute": 1440, "remove_pumps": false }, "api_server": { "enabled": false, "listen_ip_address": "127.0.0.1", "listen_port": 8080, "verbosity": "error", "enable_openapi": false, "jwt_secret_key": "", "CORS_origins": [], "username": "", "password": "" }, "telegram": { "enabled": false, "token": "", "chat_id": "" }, "initial_state": "running", "forcebuy_enable": false, "internals": { "process_throttle_secs": 5 }, "db_url": "sqlite:///cryptofrog.sqlite", "user_data_dir" : "user_data", "strategy": "CryptoFrog", "strategy_path": "user_data/strategies" } ================================================ FILE: custom_indicators.py ================================================ """ Solipsis Custom Indicators and Maths """ import numpy as np import talib.abstract as ta import freqtrade.vendor.qtpylib.indicators as qtpylib from pandas import DataFrame, Series """ Misc. Helper Functions """ def same_length(bigger, shorter): return np.concatenate((np.full((bigger.shape[0] - shorter.shape[0]), np.nan), shorter)) """ Maths """ def linear_growth(start: float, end: float, start_time: int, end_time: int, trade_time: int) -> float: """ Simple linear growth function. Grows from start to end after end_time minutes (starts after start_time minutes) """ time = max(0, trade_time - start_time) rate = (end - start) / (end_time - start_time) return min(end, start + (rate * time)) """ TA Indicators """ def zema(dataframe, period, field='close'): """ Source: https://github.com/freqtrade/technical/blob/master/technical/indicators/overlap_studies.py#L79 Modified slightly to use ta.EMA instead of technical ema """ df = dataframe.copy() df['ema1'] = ta.EMA(df[field], timeperiod=period) df['ema2'] = ta.EMA(df['ema1'], timeperiod=period) df['d'] = df['ema1'] - df['ema2'] df['zema'] = df['ema1'] + df['d'] return df['zema'] def RMI(dataframe, *, length=20, mom=5): """ Source: https://github.com/freqtrade/technical/blob/master/technical/indicators/indicators.py#L912 """ df = dataframe.copy() df['maxup'] = (df['close'] - df['close'].shift(mom)).clip(lower=0) df['maxdown'] = (df['close'].shift(mom) - df['close']).clip(lower=0) df.fillna(0, inplace=True) df["emaInc"] = ta.EMA(df, price='maxup', timeperiod=length) df["emaDec"] = ta.EMA(df, price='maxdown', timeperiod=length) df['RMI'] = np.where(df['emaDec'] == 0, 0, 100 - 100 / (1 + df["emaInc"] / df["emaDec"])) return df["RMI"] def mastreak(dataframe: DataFrame, period: int = 4, field='close') -> Series: """ MA Streak Port of: https://www.tradingview.com/script/Yq1z7cIv-MA-Streak-Can-Show-When-a-Run-Is-Getting-Long-in-the-Tooth/ """ df = dataframe.copy() avgval = zema(df, period, field) arr = np.diff(avgval) pos = np.clip(arr, 0, 1).astype(bool).cumsum() neg = np.clip(arr, -1, 0).astype(bool).cumsum() streak = np.where(arr >= 0, pos - np.maximum.accumulate(np.where(arr <= 0, pos, 0)), -neg + np.maximum.accumulate(np.where(arr >= 0, neg, 0))) res = same_length(df['close'], streak) return res def pcc(dataframe: DataFrame, period: int = 20, mult: int = 2): """ Percent Change Channel PCC is like KC unless it uses percentage changes in price to set channel distance. https://www.tradingview.com/script/6wwAWXA1-MA-Streak-Change-Channel/ """ df = dataframe.copy() df['previous_close'] = df['close'].shift() df['close_change'] = (df['close'] - df['previous_close']) / df['previous_close'] * 100 df['high_change'] = (df['high'] - df['close']) / df['close'] * 100 df['low_change'] = (df['low'] - df['close']) / df['close'] * 100 df['delta'] = df['high_change'] - df['low_change'] mid = zema(df, period, 'close_change') rangema = zema(df, period, 'delta') upper = mid + rangema * mult lower = mid - rangema * mult return upper, rangema, lower def SSLChannels(dataframe, length=10, mode='sma'): """ Source: https://www.tradingview.com/script/xzIoaIJC-SSL-channel/ Source: https://github.com/freqtrade/technical/blob/master/technical/indicators/indicators.py#L1025 Usage: dataframe['sslDown'], dataframe['sslUp'] = SSLChannels(dataframe, 10) """ if mode not in ('sma'): raise ValueError(f"Mode {mode} not supported yet") df = dataframe.copy() if mode == 'sma': df['smaHigh'] = df['high'].rolling(length).mean() df['smaLow'] = df['low'].rolling(length).mean() df['hlv'] = np.where(df['close'] > df['smaHigh'], 1, np.where(df['close'] < df['smaLow'], -1, np.NAN)) df['hlv'] = df['hlv'].ffill() df['sslDown'] = np.where(df['hlv'] < 0, df['smaHigh'], df['smaLow']) df['sslUp'] = np.where(df['hlv'] < 0, df['smaLow'], df['smaHigh']) return df['sslDown'], df['sslUp'] def SSLChannels_ATR(dataframe, length=7): """ SSL Channels with ATR: https://www.tradingview.com/script/SKHqWzql-SSL-ATR-channel/ Credit to @JimmyNixx for python """ df = dataframe.copy() df['ATR'] = ta.ATR(df, timeperiod=14) df['smaHigh'] = df['high'].rolling(length).mean() + df['ATR'] df['smaLow'] = df['low'].rolling(length).mean() - df['ATR'] df['hlv'] = np.where(df['close'] > df['smaHigh'], 1, np.where(df['close'] < df['smaLow'], -1, np.NAN)) df['hlv'] = df['hlv'].ffill() df['sslDown'] = np.where(df['hlv'] < 0, df['smaHigh'], df['smaLow']) df['sslUp'] = np.where(df['hlv'] < 0, df['smaLow'], df['smaHigh']) return df['sslDown'], df['sslUp'] def WaveTrend(dataframe, chlen=10, avg=21, smalen=4): """ WaveTrend Ocillator by LazyBear https://www.tradingview.com/script/2KE8wTuF-Indicator-WaveTrend-Oscillator-WT/ """ df = dataframe.copy() df['hlc3'] = (df['high'] + df['low'] + df['close']) / 3 df['esa'] = ta.EMA(df['hlc3'], timeperiod=chlen) df['d'] = ta.EMA((df['hlc3'] - df['esa']).abs(), timeperiod=chlen) df['ci'] = (df['hlc3'] - df['esa']) / (0.015 * df['d']) df['tci'] = ta.EMA(df['ci'], timeperiod=avg) df['wt1'] = df['tci'] df['wt2'] = ta.SMA(df['wt1'], timeperiod=smalen) df['wt1-wt2'] = df['wt1'] - df['wt2'] return df['wt1'], df['wt2'] def T3(dataframe, length=5): """ T3 Average by HPotter on Tradingview https://www.tradingview.com/script/qzoC9H1I-T3-Average/ """ df = dataframe.copy() df['xe1'] = ta.EMA(df['close'], timeperiod=length) df['xe2'] = ta.EMA(df['xe1'], timeperiod=length) df['xe3'] = ta.EMA(df['xe2'], timeperiod=length) df['xe4'] = ta.EMA(df['xe3'], timeperiod=length) df['xe5'] = ta.EMA(df['xe4'], timeperiod=length) df['xe6'] = ta.EMA(df['xe5'], timeperiod=length) b = 0.7 c1 = -b*b*b c2 = 3*b*b+3*b*b*b c3 = -6*b*b-3*b-3*b*b*b c4 = 1+3*b+b*b*b+3*b*b df['T3Average'] = c1 * df['xe6'] + c2 * df['xe5'] + c3 * df['xe4'] + c4 * df['xe3'] return df['T3Average'] def SROC(dataframe, roclen=21, emalen=13, smooth=21): df = dataframe.copy() roc = ta.ROC(df, timeperiod=roclen) ema = ta.EMA(df, timeperiod=emalen) sroc = ta.ROC(ema, timeperiod=smooth) return sroc ================================================ FILE: live_plotting.ipynb ================================================ { "cells": [ { "cell_type": "code", "execution_count": null, "id": "difficult-binding", "metadata": {}, "outputs": [], "source": [ "import json, os\n", "from pathlib import Path\n", "\n", "from freqtrade.configuration import Configuration\n", "from freqtrade.data.btanalysis import load_trades_from_db, load_backtest_data, load_backtest_stats\n", "from freqtrade.data.history import load_pair_history\n", "from freqtrade.data.dataprovider import DataProvider\n", "from freqtrade.plugins.pairlistmanager import PairListManager\n", "from freqtrade.exceptions import ExchangeError, OperationalException\n", "from freqtrade.exchange import Exchange\n", "from freqtrade.resolvers import ExchangeResolver, StrategyResolver\n", "from freqtrade.state import RunMode\n", "\n", "import numpy as np\n", "import pandas as pd\n", "import random\n", "from collections import deque\n", "\n", "import nest_asyncio\n", "nest_asyncio.apply()\n", "\n", "configs=[\"cryptofrog.config.json\"]\n", "\n", "ft_config = Configuration.from_files(files=configs)\n", "ft_exchange = ExchangeResolver.load_exchange(ft_config['exchange']['name'], config=ft_config, validate=True)\n", "ft_pairlists = PairListManager(ft_exchange, ft_config)\n", "ft_dataprovider = DataProvider(ft_config, ft_exchange, ft_pairlists)\n", "\n", "data_location = Path(ft_config['user_data_dir'], 'data', 'binance')\n", "backtest_dir = Path(ft_config['user_data_dir'], 'backtest_results')\n", "\n", "# Load strategy using values set above\n", "strategy = StrategyResolver.load_strategy(ft_config)\n", "strategy.dp = ft_dataprovider\n", "\n", "# Generate buy/sell signals using strategy\n", "timeframe = \"5m\"\n", "\n", "backtest = False\n", "\n", "if ft_config[\"timeframe\"] is not None:\n", " timeframe = ft_config[\"timeframe\"]\n", " print(\"Using config timeframe:\" , timeframe)\n", "elif strategy.timeframe is not None:\n", " timeframe = strategy.timeframe\n", " print(\"Using strategy timeframe:\" , timeframe)\n", "else:\n", " print(\"Using default timeframe:\" , timeframe)\n", "\n", "def do_analysis(pair, strategy, timeframe, only_backtest=False, hist_and_backtest=True):\n", " if only_backtest is True:\n", " print(\"Loading backtest data...\")\n", " trades = load_backtest_data(backtest_dir)\n", " else:\n", " print(\"Loading historic data...\")\n", " candles = load_pair_history(datadir=data_location,\n", " timeframe=timeframe,\n", " pair=pair,\n", " data_format = \"json\",\n", " )\n", "\n", " # Confirm success\n", " print(\"Loaded \" + str(len(candles)) + f\" rows of data for {pair} from {data_location}\")\n", " df = strategy.analyze_ticker(candles, {'pair': pair})\n", " \n", " if hist_and_backtest is True:\n", " print(\"Loading backtest trades data...\")\n", " trades = load_backtest_data(backtest_dir) \n", " else:\n", " # Fetch trades from database\n", " print(\"Loading DB trades data...\")\n", " trades = load_trades_from_db(ft_config['db_url'])\n", "\n", " print(f\"Generated {df['buy'].sum()} buy / {df['sell'].sum()} sell signals\")\n", " data = df.set_index('date', drop=False)\n", " # print(data.info())\n", " # print(data.tail())\n", " # print(data[\"buy\"].dropna())\n", " return (data, trades)\n", " \n", " return (pd.Dataframe(), trades)\n", "\n", "def do_plot(pair, data, trades, plot_config=None):\n", " from freqtrade.plot.plotting import generate_candlestick_graph\n", " import plotly.offline as pyo\n", "\n", " # Filter trades to one pair\n", " trades_red = trades.loc[trades['pair'] == pair].copy()\n", "\n", " # Limit graph period to your BT timerange\n", " data_red = data['2021-04-01':'2021-04-20']\n", "\n", " plotconf = strategy.plot_config\n", " if plot_config is not None:\n", " plotconf = plot_config\n", " \n", " # Generate candlestick graph\n", " graph = generate_candlestick_graph(pair=pair,\n", " data=data_red,\n", " trades=trades_red,\n", " plot_config=plotconf\n", " )\n", "\n", " pyo.iplot(graph, show_link = False)" ] }, { "cell_type": "code", "execution_count": null, "id": "effective-vintage", "metadata": { "scrolled": false }, "outputs": [], "source": [ "# example inline plot config to override strat\n", "plot_config = {\n", " 'main_plot': {\n", " },\n", " 'subplots': {\n", " 'STR' :{\n", " 'mastreak': {'color': 'black'},\n", " },\n", " 'KAMA' :{\n", " 'kama': {'color': 'red'},\n", " },\n", " 'RMI' :{\n", " 'rmi': {'color': 'blue'},\n", " },\n", " 'MP' :{\n", " 'mp': {'color': 'green'},\n", " }, \n", " }\n", "}\n", "\n", "## set the pairlist you want to plot\n", "pairlist = [\"WIN/USDT\", \"SC/USDT\"]\n", "\n", "## don't do this for more than a couple of pairs and for a few days otherwise Slowness Will Occur\n", "for i in pairlist:\n", " (data, trades) = do_analysis(i, strategy, timeframe)\n", " do_plot(i, data, trades) #, plot_config=plot_config)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.5" } }, "nbformat": 4, "nbformat_minor": 5 }