mirror of
https://github.com/Death916/emailtrade.git
synced 2026-04-11 04:56:34 -07:00
comments and trade variable
This commit is contained in:
parent
4ac606e845
commit
e5beb8d181
1 changed files with 11 additions and 5 deletions
16
getsignal.py
16
getsignal.py
|
|
@ -2,14 +2,15 @@
|
|||
|
||||
import imapclient
|
||||
import pyzmail
|
||||
import glogin
|
||||
|
||||
imap = imapclient.IMAPClient('imap.gmail.com', ssl=True)
|
||||
imap.login('email', 'pass')
|
||||
#login to server
|
||||
imap = glogin.connect()
|
||||
imap.select_folder('CRYPTO/trade', readonly=True)
|
||||
|
||||
|
||||
alert = imap.search(b'UNSEEN')
|
||||
|
||||
#get all unseen uids
|
||||
for num in range(0, 100000):
|
||||
if num in alert:
|
||||
uid = num
|
||||
|
|
@ -19,18 +20,23 @@ msg = imap.fetch([uid], [b'BODY[]', b'FLAGS'])
|
|||
|
||||
|
||||
message = pyzmail.PyzMessage.factory(msg[uid][b'BODY[]'])
|
||||
|
||||
trade = None
|
||||
if 'strategy says sell now' in message.get_subject():
|
||||
print('sell signal found')
|
||||
print(message.get_subject())
|
||||
trade = sell
|
||||
elif 'strategy says buy now' in message.get_subject():
|
||||
print('buy signal found')
|
||||
print(message.get_subject())
|
||||
trade = buy
|
||||
|
||||
|
||||
else:
|
||||
|
||||
print('failed')
|
||||
|
||||
class start_trade():
|
||||
#class start_trade():
|
||||
|
||||
|
||||
|
||||
#
|
||||
Loading…
Add table
Add a link
Reference in a new issue