def grab_spy_today(): ps.init(host='pvlchi6ppymmd1', auth=str(r.body), timeout=30) query = """(And (in StockSymbol :SPX) (ExportValues StockSymbol StockLast StockOpen))""" s = ps.option_script(query) frame = convert(s) change = (float(frame['StockLast'][0]) - float(frame['StockOpen'][0])) / frame['StockOpen'][0] s.channel.close() ps.close() return change
from_email = '*****@*****.**' to_email = '*****@*****.**' msg['Subject'] = subject content = MIMEText(body, 'plain') msg.attach(content) s.sendmail(from_email, to_email, msg.as_string()) if __name__ == '__main__': logging.init('printmaps') log.info('Hello, this is the start of the program') ps.init(host='pvlchi6sweb1', auth=str(r.body), timeout=30) maxV = 1000000 minV = 0 query = """(And (> OptionVolume 0) (< OptionVolume 10000000) (ExportValues OptionShortDesc OptionVolume))""" s = ps.option_script(query) cores = 5 start = datetime.datetime.now().date() mktopen = datetime.time(13, 30, 0) dtm = datetime.datetime.combine(start, mktopen) timestamp = (dtm - datetime.datetime(1970, 1, 1)).total_seconds() ts = int(timestamp * 1000)