mirror of
https://github.com/Death916/emailtrade.git
synced 2026-04-10 03:04:40 -07:00
fixed logging and reset
This commit is contained in:
parent
15bec8b2d3
commit
1afba9e91b
2 changed files with 8 additions and 5 deletions
|
|
@ -16,16 +16,16 @@ last_alert = 0
|
||||||
|
|
||||||
def start_buy():
|
def start_buy():
|
||||||
print('trade is a buy')
|
print('trade is a buy')
|
||||||
trade.open_trade(0)
|
trade.open_trade(1)
|
||||||
global last_alert
|
global last_alert
|
||||||
last_alert = "buy"
|
last_alert = "buy"
|
||||||
hist.tradehist('buy test')
|
hist.tradehist('buy test')
|
||||||
|
|
||||||
|
|
||||||
def start_sell():
|
def start_sell():
|
||||||
|
|
||||||
print('trade is a sell')
|
print('trade is a sell')
|
||||||
trade.close_trade(0)
|
trade.close_trade(1)
|
||||||
global last_alert
|
global last_alert
|
||||||
last_alert = "sell"
|
last_alert = "sell"
|
||||||
hist.tradehist('sell test')
|
hist.tradehist('sell test')
|
||||||
|
|
@ -100,6 +100,9 @@ def main():
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
except:
|
except:
|
||||||
print('restart failed')
|
print('restart failed')
|
||||||
|
s = gconnect()
|
||||||
|
s.idle()
|
||||||
|
start_time = time.time()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
4
trade.py
4
trade.py
|
|
@ -28,7 +28,7 @@ def open_trade(amount):
|
||||||
buy_amount = .0005 / buyprice
|
buy_amount = .0005 / buyprice
|
||||||
# print(trex.buy_limit(ticker, amount, rate=buyprice))
|
# print(trex.buy_limit(ticker, amount, rate=buyprice))
|
||||||
print('buying', buy_amount, 'of', ticker)
|
print('buying', buy_amount, 'of', ticker)
|
||||||
hist.tradehist('bought ' + str(amount) + ' of ' + ticker + ' at ' + str(buyprice))
|
hist.tradehist('bought ' + str(buy_amount) + ' of ' + ticker + ' at ' + str(buyprice))
|
||||||
return
|
return
|
||||||
|
|
||||||
def close_trade(amount):
|
def close_trade(amount):
|
||||||
|
|
@ -39,7 +39,7 @@ def close_trade(amount):
|
||||||
print('selling', amount, 'of', ticker)
|
print('selling', amount, 'of', ticker)
|
||||||
hist.tradehist('sold ' + str(amount) + ' of ' + ticker + ' at ' + str(sellprice))
|
hist.tradehist('sold ' + str(amount) + ' of ' + ticker + ' at ' + str(sellprice))
|
||||||
global buy_amount
|
global buy_amount
|
||||||
hist.tradehist('profit = ' + '{:.20f}'.format((sellprice * amount) - (buyprice * buy_amount)))
|
hist.tradehist('profit = ' + '{:.25f}'.format((sellprice * amount) - (buyprice * amount)))
|
||||||
|
|
||||||
def open_orders():
|
def open_orders():
|
||||||
trex.get_open_orders()
|
trex.get_open_orders()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue