From 504bed83ae434abf63ffd6f3225e1fd77050acf4 Mon Sep 17 00:00:00 2001 From: Death916 Date: Fri, 21 Sep 2018 18:56:22 -0700 Subject: [PATCH] retry --- trade.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/trade.py b/trade.py index 240ee74..3cf050a 100644 --- a/trade.py +++ b/trade.py @@ -24,10 +24,9 @@ def marketcheck(ticker): def open_trade(): global buyprice buyprice = marketcheck(ticker) - global buy_amount balance = trex.get_balance('BTC')['result']['Available'] buy_amount = balance / buyprice - # print(trex.buy_limit(ticker, amount, rate=buyprice)) + 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 @@ -35,10 +34,10 @@ def open_trade(): def close_trade(): global sellprice sellprice = marketcheck(ticker) - global buy_amount - sell_amount = buy_amount - #sell_amount = trex.get_balance('ETH')['result']['Available'] - # print(trex.sell_limit(ticker, amount, rate=sellprice)) + + + sell_amount = trex.get_balance('ETH')['result']['Available'] + print(trex.sell_limit(ticker, sell_amount, rate=sellprice)) print('selling', sell_amount, 'of', ticker) hist.tradehist('sold ' + str(sell_amount) + ' of ' + ticker + ' at ' + str(sellprice)) hist.tradehist('profit = ' + '{:.25f}'.format((sellprice * sell_amount) - (buyprice * sell_amount)))