diff --git a/README.md b/README.md index 1c78e53..9d64f33 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,23 @@ Visualization uses external library [plotly](https://plot.ly/). Below You can se +Below is an example of Final Simulation Report summary: +``` +**************************************************** + Final simulation report: +**************************************************** +Wallet at Start: | 50.0DGB | +Wallet at End: | 51.3464723121DGB | +Strategy result: -5.68% +Buy & Hold: -8.16% +Strategy vs Buy & Hold: 2.47% +Total txn: 10 +Simulated (data time): 0 days, 4 hours and 55 minutes +Transactions per hour: 2.03 +Simulation run time: 0 hours 1 minutes and 13 seconds +Created new window in existing browser session. +``` + ## Donate If you would like to support the project in other way than code-contributing, you can donate Mosquito development on diff --git a/core/report.py b/core/report.py index 8e8911e..ea5f1f9 100644 --- a/core/report.py +++ b/core/report.py @@ -33,6 +33,8 @@ def write_final_stats(self, ticker_start, ticker_end, wallet, trades): print('****************************************************') print('* Final simulation report: *') print('****************************************************') + print('Wallet at Start:', self.get_wallet_text(wallet.initial_balance)) + print('Wallet at End:', self.get_wallet_text(wallet.current_balance)) print(self.get_color_text('Strategy result: ', curr_bal_percent)) print(self.get_color_text('Buy & Hold: ', buy_and_hold)) print(self.get_color_text('Strategy vs Buy & Hold: ', curr_bal_percent-buy_and_hold)) @@ -67,7 +69,7 @@ def calc_stats(self, ticker_data, wallet): date_time = datetime.fromtimestamp(ticker_data['date'][0]).strftime('%c') + ',' current_close = 'close:' + format(ticker_data.iloc[0]['close'], '2f') + ',' # Wallet - wallet_text = self.get_wallet_text(wallet) + wallet_text = self.get_wallet_text(wallet.current_balance) # Balance balance = self.calc_balance(ticker_data, wallet.current_balance) balance_text = self.get_color_text('$: ', balance) + ',' @@ -90,9 +92,9 @@ def get_wallet_text(wallet, currencies=None): """ # TODO return only wallet of given currencies wallet_string = '' - for symbol, balance in wallet.current_balance.items(): + for symbol, balance in wallet.items(): if balance > 0: - wallet_string += ' | ' + str(balance) + symbol + wallet_string += '| ' + str(balance) + symbol wallet_string += ' |' return wallet_string diff --git a/strategies/bumblebee.py b/strategies/bumblebee.py index ecd7ee6..8ef13c2 100644 --- a/strategies/bumblebee.py +++ b/strategies/bumblebee.py @@ -15,7 +15,7 @@ class Bumblebee(Base): def __init__(self, args): super(Bumblebee, self).__init__(args) self.name = 'ema' - self.min_history_ticks = 60 # 60 minute interval + self.min_history_ticks = 60 # 300 minute interval self.pair = 'BTC_DGB' def calculate(self, look_back, wallet): @@ -40,11 +40,14 @@ def calculate(self, look_back, wallet): volume = df['volume'].values # ** Ema ** - # ema = talib.EMA(close, timeperiod=len(close))[end_index] # end_index = len(df.index) - 1 + # ema = talib.EMA(close, timeperiod=len(close))[end_index] + # print('ema:', ema) # ** Slope ** + # end_index = len(df.index) - 1 # slope = talib.LINEARREG_SLOPE(close, timeperiod=len(close))[end_index] + # print('slope:', slope) # ** OBV (On Balance Volume) obv = talib.OBV(close, volume) @@ -58,9 +61,9 @@ def calculate(self, look_back, wallet): perc_change = percent_change(look_back, 2) print('perc_change:', perc_change) - if obv >= 200: + if obv >= 20: new_action = TradeState.buy - elif obv < 0 or perc_change <= -1.0: + elif obv < -5: # or perc_change <= -1.0: new_action = TradeState.sell df_last = df.iloc[[-1]]