示例#1
0
def plt_manual(xx):
    print(len(xx))
    xxx = []
    for i in range(len(xx)):
        manual_data = (x_pool[xx[i]],y_pool[xx[i]],t_pool[xx[i]],i_pool[xx[i]])
        histogram = Histogram(manual_data)
        histogram.createImage()
        y_pool[xx[i]] = histogram.result
        print(y_pool[xx[i]])
        if y_pool[xx[i]] != cf.NONE_SENSE_DATA_TYPE:
            xxx.append(xx[i])
        print(y_pool[xx[i]])

    return np.array(xxx)
示例#2
0
from mongo_engine import MongoEngine
import numpy as np
from histogram import Histogram
import config as cf

if __name__ == '__main__':
    mongo = MongoEngine()
    a = mongo.find_selective({'chanceType':1})
    b = mongo.find_selective({'chanceType':-1})
    c = mongo.find_selective({'chanceType':2})
    d = np.concatenate((a,b,c))
    print(d)

    for dd in d:
        list = mongo.find_pos_pre_list(dd['instrumentID'],dd['time'],cf.ROW_LENGTH)
        x = []
        for l in list:
            xx =[]
            xx.append(l['opend'])
            xx.append(l['high'])
            xx.append(l['low'])
            xx.append(l['close'])
            x.append(xx)
        x = np.array(x)
        y = list[0]['chanceType']
        time = list[0]['time']
        instrumentID = list[0]['instrumentID']
        ha = (x,y,time,instrumentID)
        histo = Histogram(ha)
        histo.createImage()
    # e = np.delete(d,[])