示例#1
0
def safeSendDDMsg(ddrotUrl='', msg='', timeout=10):
    if not Point.isStcokTime(): return
    code = output = None
    try:
        code, output = sendDDMsg(ddrotUrl, msg, timeout)
    except Exception as ex:
        print('safeSendDDMsg exception:' + str(ex))
        pass
    return code, output
示例#2
0
 def watchOnce(self):
     if not Point.isStcokTime():
         print('is not stock time, current time:' + str(dt.current_time()))
         return
     try:
         point = Point.getNow(self.code)
     except:
         return
     self.onNewPoint(point)
    def scanOnce(cls, beforeDayNum, concurrentNum):
        cls.logInfo('ready scan')
        if not Point.isStcokTime():
            return

        begin = time.time()

        stockList = StockList.getAllStock()
        index = 0
        for stock in stockList:
            cls.safeAnaOneStock(stock, beforeDayNum)
            index = index + 1
            cls.logInfo("name:%s,index:%s" % (stock.name, index))
        end = time.time()
        cost = end - begin
        cls.logInfo('scan once finish, stock num:' + str(len(stockList)) +
                    ' cost:' + str(int(cost)) + ' seconds')
示例#4
0
 def scanOnce(cls,
              beforeDayNum=10,
              concurrentNum=multiprocessing.cpu_count()):
     #for test
     if not Point.isStcokTime(): return
     begin = time.time()
     concurrentPool = pool.Pool(concurrentNum)
     stockList = StockList.getAllStock()
     index = 0
     for stock in stockList:
         concurrentPool.spawn(cls.scan, stock, beforeDayNum)
         index = index + 1
         cls.logInfo("name:%s,index:%s" % (stock.name, index))
     concurrentPool.join()
     end = time.time()
     cost = end - begin
     cls.logInfo('scan once finish, stock num:' + str(len(stockList)) +
                 ' cost:' + str(int(cost)) + ' seconds')
示例#5
0
def asyncSendMsg(msg):
    if msg == '':
        return
    if not Point.isStcokTime():
        return
    get_msg_queue().push(msg)
示例#6
0
 def run(cls):
     while 1:
         #for test
         gevent.sleep(60)
         if not Point.isStcokTime(): continue
         cls.safeCheckOnce()