def hodl_sell_strat(self): for market in self.held_coins: cur_price = float(self.bittrex_coins[market]['Last']) bought_price = self.held_coins[market]['price_bought'] change = utils.percent_change(bought_price, cur_price) desired_gain = self.held_coins[market]['desired_gain'] if change >= desired_gain: coin_to_sell = utils.get_second_market_coin(market) balance = self.api.get_balance(coin_to_sell) if balance['success']: amount = float(balance['result']['Available']) utils.sell(self.api, amount, market, self.bittrex_coins) else: utils.print_and_write_to_logfile( "Could not retrieve balance: " + balance['message'])
def low_high_sell_strat(self): for market in self.held_coins: cur_price = float(self.bittrex_coins[market]['Last']) bought_price = self.held_coins[market]['price_bought'] change = utils.percent_change(bought_price, cur_price) desired_gain = self.held_coins[market]['desired_gain'] high_bar = self.held_coins[market]['high_bar'] if change >= desired_gain and change >= high_bar: self.held_coins[market]['high_bar'] = high_bar + 10 utils.json_to_file(self.held_coins, 'held_coins.json') elif high_bar != desired_gain and change < high_bar - 10: coin_to_sell = utils.get_second_market_coin(market) balance = self.api.get_balance(coin_to_sell) if balance['success']: amount = float(balance['result']['Available']) self.update_bittrex_coins() utils.sell(self.api, amount, market, self.bittrex_coins) else: utils.print_and_write_to_logfile("Could not retrieve balance: " + balance['message'])