mirror of
https://github.com/Death916/emailtrade.git
synced 2026-04-10 03:04:40 -07:00
fixes
This commit is contained in:
parent
1afba9e91b
commit
4115aa8ddd
2 changed files with 13 additions and 18 deletions
27
getsignal.py
27
getsignal.py
|
|
@ -16,7 +16,7 @@ last_alert = 0
|
|||
|
||||
def start_buy():
|
||||
print('trade is a buy')
|
||||
trade.open_trade(1)
|
||||
trade.open_trade()
|
||||
global last_alert
|
||||
last_alert = "buy"
|
||||
hist.tradehist('buy test')
|
||||
|
|
@ -25,7 +25,7 @@ def start_buy():
|
|||
def start_sell():
|
||||
|
||||
print('trade is a sell')
|
||||
trade.close_trade(1)
|
||||
trade.close_trade()
|
||||
global last_alert
|
||||
last_alert = "sell"
|
||||
hist.tradehist('sell test')
|
||||
|
|
@ -51,12 +51,11 @@ last_uid = 0
|
|||
|
||||
def main():
|
||||
s = gconnect()
|
||||
idle = s
|
||||
s.idle()
|
||||
start_time = time.time()
|
||||
while True:
|
||||
|
||||
responses = idle.idle_check(30)
|
||||
responses = s.idle_check(30)
|
||||
print("Server sent:", responses if responses else "nothing")
|
||||
|
||||
|
||||
|
|
@ -91,18 +90,14 @@ def main():
|
|||
|
||||
if trade.open_orders() != None:
|
||||
print(trade.open_orders())
|
||||
if time.time() - start_time > 1740:
|
||||
try:
|
||||
s.idle_done()
|
||||
print('restarting connection')
|
||||
s = gconnect()
|
||||
s.idle()
|
||||
start_time = time.time()
|
||||
except:
|
||||
print('restart failed')
|
||||
s = gconnect()
|
||||
s.idle()
|
||||
start_time = time.time()
|
||||
if time.time() - start_time > 1000:
|
||||
|
||||
s.idle_done()
|
||||
print('restarting connection')
|
||||
s = gconnect()
|
||||
s.idle()
|
||||
start_time = time.time()
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
4
trade.py
4
trade.py
|
|
@ -21,7 +21,7 @@ def marketcheck(ticker):
|
|||
return price
|
||||
|
||||
|
||||
def open_trade(amount):
|
||||
def open_trade():
|
||||
global buyprice
|
||||
buyprice = marketcheck(ticker)
|
||||
global buy_amount
|
||||
|
|
@ -31,7 +31,7 @@ def open_trade(amount):
|
|||
hist.tradehist('bought ' + str(buy_amount) + ' of ' + ticker + ' at ' + str(buyprice))
|
||||
return
|
||||
|
||||
def close_trade(amount):
|
||||
def close_trade():
|
||||
global sellprice
|
||||
sellprice = marketcheck(ticker)
|
||||
amount = .0005 / sellprice
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue