def auto_test_sample(self):
        test_ret = []
        samp_h = sample_handler()
        samp_h.prepare_samples()

        for date in self.date_list:
            q_simu = quote_simulator(date)
            q_simu.prepare_quote_simulator()
            while q_simu.get_next_data() == 0:
                quote_data = q_simu.get_ret_data()
                samp_c = sample_comparer(samp_h, quote_data)
                samp_c.distance_T = self.distance_t
                ret = samp_c.process_compare_single(2)
                if ret != 0:
                    q_simu.set_distance(samp_c.best_retset[2])
                    test_ret.append([date, q_simu.point, samp_c.best_retset[2], 0, 0])
        print(test_ret)
        self.test_ret = test_ret
Exemple #2
0
    def auto_test_sample(self):
        test_ret = []
        samp_h = sample_handler()
        samp_h.prepare_samples()

        for date in self.date_list:
            dayk = dayk_handler(date)
            dayk.prepare_dayk()
            dayk.reset_ret()
            sp_comp = sample_dayk_comparer(dayk, samp_h)
            sp_comp.init_compare_data()
            sp_comp.get_sample(2)

            for i in range(0, samp_h.length):
                for j in range(19, dayk.length - sp_comp.inspect_bars):
                    if sp_comp.distance < self.distance_t:
                        sp_comp.set_ret(self.distance_t)
                        print("set: ", date, " num:", sp_comp.point)
                        test_ret.append(
                            [date, sp_comp.point, sp_comp.distance, 0, 0])
                    sp_comp.get_data(1)
                #sp_comp.get_sample(1)
        self.test_ret = test_ret
Exemple #3
0
from strategies.ml.data_handler.sample_handler import *
import time

onemk = [
    [20000, 20001, 20002, 20003],
    [20004, 20005, 20006, 20007],
    [20020, 20001, 20002, 20003],
    [20000, 20001, 20002, 20003],
    [20000, 20001, 20002, 20003],
    [20002, 20001, 20002, 20003],
    [20004, 20003, 20002, 20003]
]

if __name__ == "__main__":
    start = time.time()
    samp_h = sample_handler()
    samp_h.prepare_samples()

    #samp_c = sample_comparer(samp_h, onemk)
    #samp_c.norm_compare_data()
    #print(onemk)
    #print(samp_c.onemk)
    #ret = samp_c.process_k_distance()
    #print(ret)

    samp_c = sample_comparer(samp_h, onemk)
    ret = samp_c.process_compare()
    print(ret)
    end = time.time()
    print("Time:", end-start)
 def prepare_sample_simulator(self):
     self.sample_handler = sample_handler()
     self.sample_handler.prepare_samples()
Exemple #5
0
from strategies.ml.data_handler.sample_handler import *


def set_all_avail():
    samp.set_all_avail()
    print("Set All Samples Avail!")


def set_sample_avail(id):
    samp.set_sample_avail(id)
    print("Set Sample", str(id), "Avail!")


def set_sample_avail_only(id):
    samp.set_sample_avail_only(id)
    print("Set Only Sample", str(id), "Avail!")


if __name__ == "__main__":

    samp = sample_handler()
    samp.init_db()

    #set_all_avail()
    set_sample_avail_only(3)