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
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) begin = datetime.datetime.now() lastupdated = begin keys = fix_opts(get_opts(s))
def __call__(self, *args, **kwargs): try: result = self.__callable(*args, **kwargs) except Exception as e: error(traceback.format_exc()) raise if __name__ == '__main__': # c = pymmd.MMDConnection('pvlchi6ppymmd1', 9999) ps.init(host='pvlchi6sweb1', auth=str(r.body), timeout=30) query = """(And (> OptionVolume 5650) (< OptionVolume 5750) (ExportValues OptionShortDesc))""" s = ps.option_script( query) #gives back to you a pysark RuleEngineClient instance cores = 5 start = datetime.datetime.now().date( ) #gives back to you today's full date mktopen = datetime.time(13, 30, 0) #gives back to you the time at 13:30:00 dtm = datetime.datetime.combine( start, mktopen ) #gives to to you the sum of ^ date and time, so 2017-01-05 13:30:00 timestamp = (dtm - datetime.datetime( 1970, 1, 1)).total_seconds() #seconds since start of 1970 ts = int(timestamp * 1000) #just integer version of the seconds since 1970 * 1000
to_email = '*****@*****.**' msg['Subject'] = subject content = MIMEText(body, 'plain') msg.attach(content) s.sendmail(from_email, to_email, msg.as_string()) if __name__ == '__main__': ps.init(host='pvlchi6sweb1', auth=str(r.body), timeout = 30) query = """(And (> OptionVolume 5000) (< OptionVolume 5500) (ExportValues OptionShortDesc OptionVolume))""" volume = """(ExportValues OptionShortDesc OptionVolume)""" s = ps.option_script(query) v = ps.option_script(volume) 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) begin = datetime.datetime.now() #error checking here... #not all of the names in the prints widget are being shown in the options list recieved here #keys = fix_opts(get_opts(s)) #print keys