Ejemplo n.º 1
0
 def TravlRandom(self, num):
     """跑随机, num: 随机的个数"""
     indexs = agl.GenRandomArray(2000, num)
     alldatas = stock.AllDatas()
     for index in indexs:
         self.p.OnTick(alldatas.get(index), None, None)
     self.p.EndHandle()
Ejemplo n.º 2
0
    def _test_AsynDrawKline(self):
        code = '300033'
        start_day = '2017-8-25'
        #df = stock.getHisdatDataFrameFromRedis(code, start_day)
        df = stock.getFiveHisdatDf(code, start_day=start_day)
        import account
        account = account.LocalAcount(account.BackTesting())
        #随机找三个交易点
        indexs = agl.GenRandomArray(len(df), 3)
        trade_bSell = [0, 1, 0]
        df_trades = df[df.index.map(lambda x: x in df.index[indexs])]
        df_trades = df_trades.copy()
        df_trades[AsynDrawKline.enum.trade_bSell] = trade_bSell

        plt.ion()
        for i in range(10):
            AsynDrawKline.drawKline(df[i * 10:], df_trades)

        plt.ioff()