mirror of
https://github.com/Death916/emailtrade.git
synced 2026-04-10 03:04:40 -07:00
retry
This commit is contained in:
parent
f32f6ce52f
commit
504bed83ae
1 changed files with 5 additions and 6 deletions
11
trade.py
11
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)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue