Esempio n. 1
0
def dowork1(socklist,mode,seq):
    
    client = MongoClient('mongodb://'+mongo_user+':'+mongo_passwd+'@'+mongo_url+':'+mongo_port+'/'+mongo_sid)
    mdb = client.mcdb
    mgconnect = mdb.ga
    di = dataint.DataInt()
    dp = DataProcUnit()
    i=0

    for sci in range(len(socklist)):
        #print socklist.STKCODE
        code = socklist.STKCODE.iloc[i]
        data = di.createData(code)
        i+=1
        if len(data) < 30:
            print('可交易天数少于30 days,不予处理')
            print "code is:", code
            continue

        dict_zb = mgconnect.find_one({'stock_code': code})

        dict_zb1 = {'secid': code, 'stock_code': code,
                    'opt_indic': {'kama': {'weight': 0.2, 'parameter': 15},
                                  'tema': {'weight': 0.32, 'parameter': 30}}
                    }

        if dict_zb == None:
            dict_zb = dict_zb1

        dp.processData(data, dict_zb, mode, buylist=[], salelist=[], positionlist=[], emptylist=[])
Esempio n. 2
0
    def upstkstatus(self):
        sql1 = '''select t.stkcode
                  ,CASE WHEN t1.trdate=to_date('%s','yyyy-mm-dd') THEN status
            			      ELSE DECODE(status,1,2,-1,-2) END status
            from bs_t1 t , (SELECT stkcode,MAX(trdate) trdate FROM bs_t1 GROUP BY stkcode) t1
            WHERE t.stkcode=t1.stkcode AND t.trdate=t1.trdate'''
        di = dataint.DataInt()
        nowtime = di.getCurrentTime()
        d = pd.read_sql(sql1 % (nowtime), self.db)

        for i in xrange(len(d)):
            sql1 = '''update stk_dig_t set status=%s, stdate=sysdate where stkcode='%s' '''
            self.cur.execute(sql1 % (d['STATUS'].iloc[i], d['STKCODE'].iloc[i]))
            self.db.commit()
Esempio n. 3
0
 def getdictzb(self):
     dataInit = dataint.DataInt()
     dict = dataInit.getDict()
     return dict