Exemplo n.º 1
0
    def __init__(self, ct_name):
        self.ct_name = ct_name
        self.candles = CandleTable.get_candle_array(ct_name)

        self.pt_name_close = CandleTable.to_point_table(ct_name, Candle.CLOSE)
        self.points_close = PointTable.get_point_array(self.pt_name_close)

        self.pt_name_volume = CandleTable.to_point_table(
            ct_name, Candle.VOLUME)
        self.points_volume = PointTable.get_point_array(self.pt_name_volume)
Exemplo n.º 2
0
    def calc_vol_tables(self):
        if self.calc_stats:
            self.strat_stat_array = []
            self.ss_tn = StratStatTable.calc_name(self.table_name, self.NAME)
            if DBManager.exists_table(self.ss_tn):
                DBManager.drop_table(self.ss_tn)
            sst = StratStatTable(self.ss_tn)
            sst.save()

        pt_name = CandleTable.to_point_table(self.table_name, "volume")
        pt_close = CandleTable.to_point_table(self.table_name, "close")
        self.points = PointTable.get_point_array(pt_name)
        self.points_close = PointTable.get_point_array(pt_close)
        pt_name_1 = "TEMP1"
        mv1 = MovingAverage(pt_name_1, self.points)
        pt_name_2 = "TEMP2"
        mv2 = MovingAverage(pt_name_2, self.points)
        self.vol_pts_short = mv1.simple(self.VOL_PERIOD_SHORT)
        self.vol_pts_long = mv2.simple(self.VOL_PERIOD_LONG)

        ##pp = PointPopulator(self.table_name)
        ##self.stddev_pts_short = pp.create_stddev(self.STDDEV_PERIOD_SHORT)
        ##self.stddev_pts_long = pp.create_stddev(self.STDDEV_PERIOD_LONG)
        DBManager.drop_matching_tables("TEMP")