def start_sell(): print("trade is a sell") trade.close_trade() global last_alert last_alert = "sell" hist.tradehist("sell test")
def open_trade(): balance = trex.get_balance("BTC")["result"]["Available"] buy_amount = (balance / buyprice) - (balance / buyprice) * 0.0025 print(trex.buy_limit(ticker, buy_amount, rate=buyprice)) print("buying", buy_amount, "of", ticker) hist.tradehist( "bought " + str(buy_amount) + " of " + ticker + " at " + str(buyprice) ) return
def open_trade(): balancedf = kraken.get_account_balance() balance = balancedf.vol["ZUSD"] buy_amount = (balance / buyprice) - (balance / buyprice) * 0.0025 # kraken.add_standard_order(TICKER, "buy", "market", balance) print("buying", buy_amount, "of", TICKER, " for ", balance) hist.tradehist( "bought " + str(buy_amount) + " of " + TICKER + " at " + str(buyprice) ) return buy_amount
def close_trade(): sell_price = marketcheck() balancedf = kraken.get_account_balance() sell_amount = balancedf.vol['XETH'] # print(kraken.add_standard_order(TICKER, "sell", "market", sell_amount)) print("selling", sell_amount, "of", TICKER) hist.tradehist( "sold " + str(sell_amount) + " of " + TICKER + " at " + str(sell_price) ) hist.tradehist( "profit = " + "{:.25f}".format((sell_price * sell_amount) - (buyprice * sell_amount)) )
def close_trade(): sell_price = marketcheck(ticker) sell_amount = trex.get_balance("ETH")["result"]["Available"] print(trex.sell_limit(ticker, sell_amount, rate=sell_price)) print("selling", sell_amount, "of", ticker) hist.tradehist( "sold " + str(sell_amount) + " of " + ticker + " at " + str(sell_price) ) hist.tradehist( "profit = " + "{:.25f}".format((sell_price * sell_amount) - (buyprice * sell_amount)) )
def start_buy(): print("trade is a buy") trade.open_trade() global last_alert last_alert = "buy" hist.tradehist("buy test")