mirror of
https://github.com/Death916/emailtrade.git
synced 2026-04-10 03:04:40 -07:00
start buy and sell functions
This commit is contained in:
parent
e5beb8d181
commit
be318e7e1b
1 changed files with 19 additions and 12 deletions
31
getsignal.py
31
getsignal.py
|
|
@ -7,7 +7,6 @@ import glogin
|
||||||
#login to server
|
#login to server
|
||||||
imap = glogin.connect()
|
imap = glogin.connect()
|
||||||
imap.select_folder('CRYPTO/trade', readonly=True)
|
imap.select_folder('CRYPTO/trade', readonly=True)
|
||||||
|
|
||||||
alert = imap.search(b'UNSEEN')
|
alert = imap.search(b'UNSEEN')
|
||||||
|
|
||||||
#get all unseen uids
|
#get all unseen uids
|
||||||
|
|
@ -15,28 +14,36 @@ for num in range(0, 100000):
|
||||||
if num in alert:
|
if num in alert:
|
||||||
uid = num
|
uid = num
|
||||||
|
|
||||||
|
|
||||||
msg = imap.fetch([uid], [b'BODY[]', b'FLAGS'])
|
msg = imap.fetch([uid], [b'BODY[]', b'FLAGS'])
|
||||||
|
|
||||||
|
|
||||||
message = pyzmail.PyzMessage.factory(msg[uid][b'BODY[]'])
|
message = pyzmail.PyzMessage.factory(msg[uid][b'BODY[]'])
|
||||||
|
|
||||||
trade = None
|
trade = None
|
||||||
|
|
||||||
|
def start_buy():
|
||||||
|
if trade == "buy":
|
||||||
|
print('trade is a buy')
|
||||||
|
|
||||||
|
def start_sell():
|
||||||
|
if trade == "sell":
|
||||||
|
print('trade is a sell')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if 'strategy says sell now' in message.get_subject():
|
if 'strategy says sell now' in message.get_subject():
|
||||||
print('sell signal found')
|
print('sell signal found')
|
||||||
print(message.get_subject())
|
print(message.get_subject())
|
||||||
trade = sell
|
trade = "sell"
|
||||||
|
|
||||||
elif 'strategy says buy now' in message.get_subject():
|
elif 'strategy says buy now' in message.get_subject():
|
||||||
print('buy signal found')
|
print('buy signal found')
|
||||||
print(message.get_subject())
|
print(message.get_subject())
|
||||||
trade = buy
|
trade = "buy"
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
print('failed')
|
print('failed')
|
||||||
|
|
||||||
#class start_trade():
|
|
||||||
|
|
||||||
|
|
||||||
|
#start_buy()
|
||||||
#
|
#start_sell()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue