def Simple_Open_Close_System(self):
        future_api_client = FutureAPIClient(Future_REST_URL, Future_Api_Key,
                                            Future_Secret_Key)
        while True:
            for i in range(len(self.check_open_close_diff_infos)):
                if i % len(self.type_list) == 0:
                    print('\n\n\n\n\n')

                symbol = self.check_open_close_diff_infos[i]['symbol']
                contract_type = self.check_open_close_diff_infos[i][
                    'contract_type']
                type = self.check_open_close_diff_infos[i]['type']
                klinelist = future_api_client.get_kline(
                    symbol, contract_type, type)
                if len(klinelist.klinelist) < 10:
                    print(
                        str(self.check_open_close_diff_infos[i]) +
                        '\tFuture_API_Client_ERROR!')
                    continue

                s = ''
                s += str(self.check_open_close_diff_infos[i])
                s += '\n'
                tech_indicat = FutureTechnicalIndicator(klinelist)
                s += self.Simple_Open_Close_Policy(tech_indicat.open_list,
                                                   tech_indicat.close_list)

                print(s)

                time.sleep(1)
            break

        pass
    def Check_Open_Close_Diff(self):
        future_api_client = FutureAPIClient(Future_REST_URL, Future_Api_Key,
                                            Future_Secret_Key)
        while True:
            for i in range(len(self.check_open_close_diff_infos)):
                if i % len(self.type_list) == 0:
                    print('\n\n\n\n\n')
                symbol = self.check_open_close_diff_infos[i]['symbol']
                contract_type = self.check_open_close_diff_infos[i][
                    'contract_type']
                type = self.check_open_close_diff_infos[i]['type']
                klinelist = future_api_client.get_kline(
                    symbol, contract_type, type)
                if len(klinelist.klinelist) < 10:
                    print(
                        str(self.check_open_close_diff_infos[i]) +
                        '\tFuture_API_Client_ERROR!')
                    continue
                tech_indicat = FutureTechnicalIndicator(klinelist)
                open_close_diff = Open_Close_Diff(tech_indicat.open_list,
                                                  tech_indicat.close_list)

                s = ''
                s += str(self.check_open_close_diff_infos[i])
                s += '\n'
                s += 'close_price_count= %d' % len(tech_indicat.close_list)
                s += '\top_cl_same_count= %d' % open_close_diff.open_close_same_count
                s += '\top_cl_diff_count= %d' % open_close_diff.open_close_diff_count
                s += '\tsame_diff_sum= %d' % (
                    open_close_diff.open_close_same_count +
                    open_close_diff.open_close_diff_count)
                s += '\n'
                s += 'op_cl_all_same= %d' % open_close_diff.open_close_all_same_count
                s += '\top_cl_all_diff= %d' % open_close_diff.open_close_all_diff_count
                s += '\tprof_all_same= %.2f' % open_close_diff.profit_all_same
                s += '\tprof_all_diff  = %.2f' % open_close_diff.profit_all_diff
                s += '\tprof_diff/same= %.2f' % (
                    open_close_diff.profit_all_diff /
                    open_close_diff.profit_all_same * 100)
                s += '%'
                s += '\tprof_diff-same= %.2f' % (
                    open_close_diff.profit_all_diff -
                    open_close_diff.profit_all_same)
                s += '\tclose_avg= %.2f' % (sum(tech_indicat.close_list) /
                                            len(tech_indicat.close_list))
                s += '\tprofit_percent= %.2f' % (
                    (open_close_diff.profit_all_diff -
                     open_close_diff.profit_all_same) /
                    (sum(tech_indicat.close_list) /
                     len(tech_indicat.close_list)) * 100)
                s += '%'
                s += '\n'
                print(s)

                time.sleep(1)
            break

        pass
Пример #3
0
    def test_Open_Close_Diff(self):
        klinelist = KLineList()
        for i in range(10):
            klinesingle = KLineSingle()
            klinelist.klinelist.append(klinesingle)

        # 收盘价一直上涨的情况
        if True:
            for i in range(10):
                klinelist.klinelist[i].open = (i + 0) + 100
                klinelist.klinelist[i].close = (i + 1) + 100
            tech_indicat = FutureTechnicalIndicator(klinelist)
            for i in range(10):
                self.assertEqual(tech_indicat.open_list[i], (i + 0) + 100)
                self.assertEqual(tech_indicat.close_list[i], (i + 1) + 100)

            open_close_diff = Open_Close_Diff(tech_indicat.open_list,
                                              tech_indicat.close_list)
            self.assertEqual(open_close_diff.open_close_same_count, 9)
            self.assertEqual(open_close_diff.open_close_diff_count, 0)

        # 收盘价一直下跌的情况
        if True:
            for i in range(10):
                klinelist.klinelist[i].open = 100 - (i + 0)
                klinelist.klinelist[i].close = 100 - (i + 1)
            tech_indicat = FutureTechnicalIndicator(klinelist)
            for i in range(10):
                self.assertEqual(tech_indicat.open_list[i], 100 - (i + 0))
                self.assertEqual(tech_indicat.close_list[i], 100 - (i + 1))

            open_close_diff = Open_Close_Diff(tech_indicat.open_list,
                                              tech_indicat.close_list)
            self.assertEqual(open_close_diff.open_close_same_count, 9)
            self.assertEqual(open_close_diff.open_close_diff_count, 0)

        # 收盘价有涨有跌的情况
        if True:
            klinelist.klinelist[0].open = 110.0
            klinelist.klinelist[0].close = 100.0
            klinelist.klinelist[1].open = 110.0
            klinelist.klinelist[1].close = 50.0
            klinelist.klinelist[2].open = 60.0
            klinelist.klinelist[2].close = 100.0
            klinelist.klinelist[3].open = 90.0
            klinelist.klinelist[3].close = 60.0
            klinelist.klinelist[4].open = 80.0
            klinelist.klinelist[4].close = 70.0  # diff
            klinelist.klinelist[5].open = 75.0
            klinelist.klinelist[5].close = 80.0
            klinelist.klinelist[6].open = 90.0
            klinelist.klinelist[6].close = 100.0
            klinelist.klinelist[7].open = 95.0
            klinelist.klinelist[7].close = 90.0
            klinelist.klinelist[8].open = 60.0
            klinelist.klinelist[8].close = 80.0  # diff
            klinelist.klinelist[9].open = 75.0
            klinelist.klinelist[9].close = 70.0
            tech_indicat = FutureTechnicalIndicator(klinelist)
            open_close_diff = Open_Close_Diff(tech_indicat.open_list,
                                              tech_indicat.close_list)
            self.assertEqual(open_close_diff.open_close_same_count, 7)
            self.assertEqual(open_close_diff.open_close_diff_count, 2)

        pass
Пример #4
0
    def test_MA_Simple(self):
        klinelist = KLineList()
        for i in range(10):
            klinesingle = KLineSingle()
            klinelist.klinelist.append(klinesingle)

        # 收盘价全都相等的情况
        if True:
            for i in range(10):
                klinelist.klinelist[i].close = 100.0
            tech_indicat = FutureTechnicalIndicator(klinelist)
            for i in range(10):
                self.assertEqual(tech_indicat.close_list[i], 100.0)

            short_day_num = 5
            long_day_num = 10
            ma_simple = MA_Simple(tech_indicat.close_list, short_day_num,
                                  long_day_num)
            self.assertEqual(ma_simple.short_day_num, 5)
            self.assertEqual(ma_simple.long_day_num, 10)
            self.assertEqual(len(ma_simple.ma_short_list), 10)
            self.assertEqual(len(ma_simple.ma_long_list), 10)

            self.assertEqual(ma_simple.ma_short_list[0], 100.0)
            self.assertEqual(ma_simple.ma_short_list[1], 100.0)
            self.assertEqual(ma_simple.ma_short_list[2], 100.0)
            self.assertEqual(ma_simple.ma_short_list[3], 100.0)
            self.assertEqual(ma_simple.ma_short_list[4], 100.0)
            self.assertEqual(ma_simple.ma_short_list[5], 100.0)
            self.assertEqual(ma_simple.ma_short_list[6], 100.0)
            self.assertEqual(ma_simple.ma_short_list[7], 100.0)
            self.assertEqual(ma_simple.ma_short_list[8], 100.0)
            self.assertEqual(ma_simple.ma_short_list[9], 100.0)
            self.assertEqual(ma_simple.ma_long_list[0], 100.0)
            self.assertEqual(ma_simple.ma_long_list[1], 100.0)
            self.assertEqual(ma_simple.ma_long_list[2], 100.0)
            self.assertEqual(ma_simple.ma_long_list[3], 100.0)
            self.assertEqual(ma_simple.ma_long_list[4], 100.0)
            self.assertEqual(ma_simple.ma_long_list[5], 100.0)
            self.assertEqual(ma_simple.ma_long_list[6], 100.0)
            self.assertEqual(ma_simple.ma_long_list[7], 100.0)
            self.assertEqual(ma_simple.ma_long_list[8], 100.0)
            self.assertEqual(ma_simple.ma_long_list[9], 100.0)

        # 收盘价不相等的情况
        if True:
            klinelist.klinelist[0].close = 100.0
            klinelist.klinelist[1].close = 50.0
            klinelist.klinelist[2].close = 100.0
            klinelist.klinelist[3].close = 60.0
            klinelist.klinelist[4].close = 100.0
            klinelist.klinelist[5].close = 70.0
            klinelist.klinelist[6].close = 100.0
            klinelist.klinelist[7].close = 80.0
            klinelist.klinelist[8].close = 100.0
            klinelist.klinelist[9].close = 90.0
            tech_indicat = FutureTechnicalIndicator(klinelist)  # sum5  sum10
            self.assertEqual(tech_indicat.close_list[0], 100.0)  # 100   100
            self.assertEqual(tech_indicat.close_list[1], 50.0)  # 150   150
            self.assertEqual(tech_indicat.close_list[2], 100.0)  # 250   250
            self.assertEqual(tech_indicat.close_list[3], 60.0)  # 310   310
            self.assertEqual(tech_indicat.close_list[4], 100.0)  # 410   410
            self.assertEqual(tech_indicat.close_list[5], 70.0)  ##380   480
            self.assertEqual(tech_indicat.close_list[6], 100.0)  # 430   580
            self.assertEqual(tech_indicat.close_list[7], 80.0)  # 410   660
            self.assertEqual(tech_indicat.close_list[8], 100.0)  # 450   760
            self.assertEqual(tech_indicat.close_list[9], 90.0)  # 440   850

            short_day_num = 5
            long_day_num = 10
            ma_simple = MA_Simple(tech_indicat.close_list, short_day_num,
                                  long_day_num)
            self.assertEqual(ma_simple.short_day_num, 5)
            self.assertEqual(ma_simple.long_day_num, 10)
            self.assertEqual(len(ma_simple.ma_short_list), 10)
            self.assertEqual(len(ma_simple.ma_long_list), 10)

            self.assertEqual(ma_simple.ma_short_list[0], 100.0 / 1)
            self.assertEqual(ma_simple.ma_short_list[1], 150.0 / 2)
            self.assertEqual(ma_simple.ma_short_list[2], 250.0 / 3)
            self.assertEqual(ma_simple.ma_short_list[3], 310.0 / 4)
            self.assertEqual(ma_simple.ma_short_list[4], 410.0 / 5)
            self.assertEqual(ma_simple.ma_short_list[5], 380.0 / 5)
            self.assertEqual(ma_simple.ma_short_list[6], 430.0 / 5)
            self.assertEqual(ma_simple.ma_short_list[7], 410.0 / 5)
            self.assertEqual(ma_simple.ma_short_list[8], 450.0 / 5)
            self.assertEqual(ma_simple.ma_short_list[9], 440.0 / 5)

            self.assertEqual(ma_simple.ma_long_list[0], 100.0 / 1)
            self.assertEqual(ma_simple.ma_long_list[1], 150.0 / 2)
            self.assertEqual(ma_simple.ma_long_list[2], 250.0 / 3)
            self.assertEqual(ma_simple.ma_long_list[3], 310.0 / 4)
            self.assertEqual(ma_simple.ma_long_list[4], 410.0 / 5)
            self.assertEqual(ma_simple.ma_long_list[5], 480.0 / 6)
            self.assertEqual(ma_simple.ma_long_list[6], 580.0 / 7)
            self.assertEqual(ma_simple.ma_long_list[7], 660.0 / 8)
            self.assertEqual(ma_simple.ma_long_list[8], 760.0 / 9)
            self.assertEqual(ma_simple.ma_long_list[9], 850.0 / 10)

        pass
Пример #5
0
    def test_OBV_Simple(self):
        klinelist = KLineList()
        for i in range(10):
            klinesingle = KLineSingle()
            klinelist.klinelist.append(klinesingle)

        # 收盘价一直上涨的情况
        if True:
            for i in range(10):
                klinelist.klinelist[i].close = (i + 1) + 100
                klinelist.klinelist[i].vol = (i + 1) * 100
            tech_indicat = FutureTechnicalIndicator(klinelist)
            for i in range(10):
                self.assertEqual(tech_indicat.close_list[i], (i + 1) + 100)
                self.assertEqual(tech_indicat.vol_list[i], (i + 1) * 100)

            ma_day_num = 5
            obv_simple = OBV_Simple(tech_indicat.vol_list,
                                    tech_indicat.close_list, ma_day_num)
            self.assertEqual(obv_simple.ma_day_num, 5)
            self.assertEqual(len(obv_simple.obv_list), 10)
            self.assertEqual(len(obv_simple.ma_obv_list), 10)

            self.assertEqual(obv_simple.obv_list[0], 100.0)
            self.assertEqual(obv_simple.obv_list[1], 300.0)
            self.assertEqual(obv_simple.obv_list[2], 600.0)
            self.assertEqual(obv_simple.obv_list[3], 1000.0)
            self.assertEqual(obv_simple.obv_list[4], 1500.0)
            self.assertEqual(obv_simple.obv_list[5], 2100.0)
            self.assertEqual(obv_simple.obv_list[6], 2800.0)
            self.assertEqual(obv_simple.obv_list[7], 3600.0)
            self.assertEqual(obv_simple.obv_list[8], 4500.0)
            self.assertEqual(obv_simple.obv_list[9], 5500.0)
            self.assertEqual(obv_simple.ma_obv_list[0], 100.0 / 1)
            self.assertEqual(obv_simple.ma_obv_list[1], 400.0 / 2)
            self.assertEqual(obv_simple.ma_obv_list[2], 1000.0 / 3)
            self.assertEqual(obv_simple.ma_obv_list[3], 2000.0 / 4)
            self.assertEqual(obv_simple.ma_obv_list[4], 3500.0 / 5)
            self.assertEqual(obv_simple.ma_obv_list[5], 5500.0 / 5)  #
            self.assertEqual(obv_simple.ma_obv_list[6], 8000.0 / 5)
            self.assertEqual(obv_simple.ma_obv_list[7], 11000.0 / 5)
            self.assertEqual(obv_simple.ma_obv_list[8], 14500.0 / 5)
            self.assertEqual(obv_simple.ma_obv_list[9], 18500.0 / 5)

        # 收盘价一直下跌的情况
        if True:
            for i in range(10):
                klinelist.klinelist[i].close = 100 - (i + 1)
                klinelist.klinelist[i].vol = i * 100
            tech_indicat = FutureTechnicalIndicator(klinelist)
            for i in range(10):
                self.assertEqual(tech_indicat.close_list[i], 100 - (i + 1))
                self.assertEqual(tech_indicat.vol_list[i], i * 100)

            ma_day_num = 5
            obv_simple = OBV_Simple(tech_indicat.vol_list,
                                    tech_indicat.close_list, ma_day_num)
            self.assertEqual(obv_simple.ma_day_num, 5)
            self.assertEqual(len(obv_simple.obv_list), 10)
            self.assertEqual(len(obv_simple.ma_obv_list), 10)

            self.assertEqual(obv_simple.obv_list[0], 0.0)
            self.assertEqual(obv_simple.obv_list[1], -100.0)
            self.assertEqual(obv_simple.obv_list[2], -300.0)
            self.assertEqual(obv_simple.obv_list[3], -600.0)
            self.assertEqual(obv_simple.obv_list[4], -1000.0)
            self.assertEqual(obv_simple.obv_list[5], -1500.0)
            self.assertEqual(obv_simple.obv_list[6], -2100.0)
            self.assertEqual(obv_simple.obv_list[7], -2800.0)
            self.assertEqual(obv_simple.obv_list[8], -3600.0)
            self.assertEqual(obv_simple.obv_list[9], -4500.0)
            self.assertEqual(obv_simple.ma_obv_list[0], 0.0 / 1)
            self.assertEqual(obv_simple.ma_obv_list[1], -100.0 / 2)
            self.assertEqual(obv_simple.ma_obv_list[2], -400.0 / 3)
            self.assertEqual(obv_simple.ma_obv_list[3], -1000.0 / 4)
            self.assertEqual(obv_simple.ma_obv_list[4], -2000.0 / 5)
            self.assertEqual(obv_simple.ma_obv_list[5], -3500.0 / 5)  #
            self.assertEqual(obv_simple.ma_obv_list[6], -5500.0 / 5)
            self.assertEqual(obv_simple.ma_obv_list[7], -8000.0 / 5)
            self.assertEqual(obv_simple.ma_obv_list[8], -11000.0 / 5)
            self.assertEqual(obv_simple.ma_obv_list[9], -14500.0 / 5)

        # 收盘价有涨有跌的情况
        if True:
            klinelist.klinelist[0].close = 100.0
            klinelist.klinelist[1].close = 50.0
            klinelist.klinelist[2].close = 100.0
            klinelist.klinelist[3].close = 60.0
            klinelist.klinelist[4].close = 70.0
            klinelist.klinelist[5].close = 80.0
            klinelist.klinelist[6].close = 100.0
            klinelist.klinelist[7].close = 90.0
            klinelist.klinelist[8].close = 80.0
            klinelist.klinelist[9].close = 70.0
            for i in range(10):
                klinelist.klinelist[i].vol = (i + 1) * 100
            tech_indicat = FutureTechnicalIndicator(klinelist)
            self.assertEqual(tech_indicat.close_list[0], 100.0)
            self.assertEqual(tech_indicat.close_list[1], 50.0)
            self.assertEqual(tech_indicat.close_list[2], 100.0)
            self.assertEqual(tech_indicat.close_list[3], 60.0)
            self.assertEqual(tech_indicat.close_list[4], 70.0)
            self.assertEqual(tech_indicat.close_list[5], 80.0)
            self.assertEqual(tech_indicat.close_list[6], 100.0)
            self.assertEqual(tech_indicat.close_list[7], 90.0)
            self.assertEqual(tech_indicat.close_list[8], 80.0)
            self.assertEqual(tech_indicat.close_list[9], 70.0)
            for i in range(10):
                self.assertEqual(tech_indicat.vol_list[i], (i + 1) * 100)

            ma_day_num = 5
            obv_simple = OBV_Simple(tech_indicat.vol_list,
                                    tech_indicat.close_list, ma_day_num)
            self.assertEqual(obv_simple.ma_day_num, 5)
            self.assertEqual(len(obv_simple.obv_list), 10)
            self.assertEqual(len(obv_simple.ma_obv_list), 10)

            self.assertEqual(obv_simple.obv_list[0], 100.0)  #  +100
            self.assertEqual(obv_simple.obv_list[1], -100.0)  #  -200
            self.assertEqual(obv_simple.obv_list[2], 200.0)  #  +300
            self.assertEqual(obv_simple.obv_list[3], -200.0)  #  -400
            self.assertEqual(obv_simple.obv_list[4], 300.0)  #  +500
            self.assertEqual(obv_simple.obv_list[5], 900.0)  #  +600
            self.assertEqual(obv_simple.obv_list[6], 1600.0)  #  +700
            self.assertEqual(obv_simple.obv_list[7], 800.0)  #  -800
            self.assertEqual(obv_simple.obv_list[8], -100.0)  #  -900
            self.assertEqual(obv_simple.obv_list[9], -1100.0)  # -1000
            self.assertEqual(obv_simple.ma_obv_list[0], 100.0 / 1)
            self.assertEqual(obv_simple.ma_obv_list[1], 0.0 / 2)
            self.assertEqual(obv_simple.ma_obv_list[2], 200.0 / 3)
            self.assertEqual(obv_simple.ma_obv_list[3], 0.0 / 4)
            self.assertEqual(obv_simple.ma_obv_list[4], 300.0 / 5)
            self.assertEqual(obv_simple.ma_obv_list[5], 1100.0 / 5)  #
            self.assertEqual(obv_simple.ma_obv_list[6], 2800.0 / 5)
            self.assertEqual(obv_simple.ma_obv_list[7], 3400.0 / 5)
            self.assertEqual(obv_simple.ma_obv_list[8], 3500.0 / 5)
            self.assertEqual(obv_simple.ma_obv_list[9], 2100.0 / 5)

        pass
    def trade_buy_for_one_contract(self):
        future_api_client = FutureAPIClient(Future_REST_URL, Future_Api_Key, Future_Secret_Key)
        while True:
            for i in range(len(self.ticker_infos)):
                if (i % self.ma_day_num_group_count) == 0:
                    print ('\n')
                symbol = self.ticker_infos[i]['symbol']
                contract_type = self.ticker_infos[i]['contract']
                type = self.ticker_infos[i]['type']
                klinelist = future_api_client.get_kline(symbol, contract_type, type)
                if len(klinelist.klinelist) < 10:
                    print(str(self.ticker_infos[i]) + '\tFuture_API_Client_ERROR!')
                    continue
                tech_indicat = FutureTechnicalIndicator(klinelist)
                ma_day_num = self.ticker_infos[i]['ma_day_num']
                obv_simple = OBV_Simple(tech_indicat.vol_list, tech_indicat.close_list, ma_day_num)
                buy_count = 0
                buy_price_sum = 0.0
                last_buy_price = 0.0
                sell_count = 0
                sell_price_sum = 0.0
                last_sell_price = 0.0
                profit_sum = 0.0
                for j in range(len(tech_indicat.close_list)):
                    s = ''
                    s += str(self.ticker_infos[i])
                    s += ' close[%d]' % j
                    s += ' ma_day[%d]' % self.ticker_infos[i]['ma_day_num']
                    s += ' %.2f' % obv_simple.close_list[j]
                    s += ' %d' % (obv_simple.vol_list[j] / 10000)
                    s += ' %d' % (obv_simple.obv_list[j] / 10000)
                    s += ' %d' % (obv_simple.ma_obv_list[j] / 10000)
                    if obv_simple.ma_obv_list[j] > obv_simple.ma_obv_list[j-1]:
                        s += '\t     ++++'
                        if j - 2 >= 0 and obv_simple.ma_obv_list[j-1] < obv_simple.ma_obv_list[j-2]:
                            s += '  Buy'
                            last_buy_price = obv_simple.close_list[j]
                            if last_sell_price > 0:
                                sell_count += 1
                                sell_price_sum += last_sell_price
                                buy_count += 1
                                buy_price_sum += obv_simple.close_list[j]
                                s += '\t\t%+.2f' % (last_sell_price - last_buy_price)
                                s += ' =%.2f-%.2f' % (last_sell_price, last_buy_price)
                                profit_sum += last_sell_price - last_buy_price
                                s += '\t\tsum= %+.2f' % profit_sum
                                #print(s)
                    else:
                        s += '\t----     '
                        if j - 2 >= 0 and obv_simple.ma_obv_list[j-1] > obv_simple.ma_obv_list[j-2]:
                            s += '  Sell'
                            last_sell_price = obv_simple.close_list[j]
                            if last_buy_price > 0:
                                buy_count += 1
                                buy_price_sum += last_buy_price
                                sell_count += 1
                                sell_price_sum += obv_simple.close_list[j]
                                s += '\t\t%+.2f' % (last_sell_price - last_buy_price)
                                s += ' =%.2f-%.2f' % (last_sell_price, last_buy_price)
                                profit_sum += last_sell_price - last_buy_price
                                s += '\t\tsum= %+.2f' % profit_sum
                                #print(s)
                        
                    #print(s)
                s = ''
                s += str(self.ticker_infos[i])
                s += '\tProfit_Sum=\t%+6.2f' % profit_sum
                s += '\tProfit_Per=\t%+.2f' % (profit_sum / (buy_price_sum / buy_count) * 100)
                s += '%'
                s += '\tDiff_Trade=\t%+6.2f' % (sell_price_sum - buy_price_sum)
                s += '\tBUY_Trade=\t%3d\t* %6.2f' % (buy_count, buy_price_sum / buy_count)
                s += '\tSELL_Trade=\t%3d\t* %6.2f' % (sell_count, sell_price_sum / sell_count)
                                
                print(s)

                time.sleep(0.5)
            break
        
        pass
    def trade_buy_for_one_contract(self):
        future_api_client = FutureAPIClient(Future_REST_URL, Future_Api_Key,
                                            Future_Secret_Key)
        while True:
            for k in range(len(self.ticker_infos_list)):
                print('\n')
                time.sleep(1)
                self.ticker_infos = self.ticker_infos_list[k]
                symbol = self.ticker_infos[0]['symbol']
                contract_type = self.ticker_infos[0]['contract']
                type = self.ticker_infos[0]['type']
                klinelist = future_api_client.get_kline(
                    symbol, contract_type, type)
                if len(klinelist.klinelist) < 10:
                    print(
                        str(self.ticker_infos[0]) +
                        '\tFuture_API_Client_ERROR!\n\n')
                    continue
                tech_indicat = FutureTechnicalIndicator(klinelist)

                obv_simple_list = []
                for i in range(len(self.ticker_infos)):
                    ma_day_num = self.ticker_infos[i]['ma_day_num']
                    obv_simple = OBV_Simple(tech_indicat.vol_list,
                                            tech_indicat.close_list,
                                            ma_day_num)
                    obv_simple_list.append(obv_simple)

                order_count_list = []
                for j in range(len(tech_indicat.close_list)):
                    order_count_list.append(0)
                    if j == 0:
                        continue
                    if j < len(tech_indicat.close_list) * 10 / 100:
                        continue
                    for i in range(len(obv_simple_list)):
                        if obv_simple_list[i].ma_obv_list[j] > obv_simple_list[
                                i].ma_obv_list[j - 1]:
                            order_count_list[j] += 1
                        else:
                            order_count_list[j] -= 1

                profit_sum = 0.0
                order_list = []
                for j in range(len(tech_indicat.close_list)):
                    for i in range(len(obv_simple_list)):
                        if i < len(obv_simple_list) - 1:
                            continue
                        else:
                            s = ''
                            s += str(self.ticker_infos[i])
                            s += '\tclose[%d]' % j
                            s += ' ma_day[%d]' % self.ticker_infos[i][
                                'ma_day_num']
                            s += ' %.2f' % obv_simple_list[i].close_list[j]
                            s += ' %d' % (obv_simple_list[i].vol_list[j] /
                                          10000)
                            s += ' %d' % (obv_simple_list[i].obv_list[j] /
                                          10000)
                            s += ' %d' % (obv_simple_list[i].ma_obv_list[j] /
                                          10000)
                            diff_order_count = 0
                            if j == 0:
                                diff_order_count = order_count_list[j]
                            else:
                                diff_order_count = order_count_list[
                                    j] - order_count_list[j - 1]
                            s += ' %+2d' % order_count_list[j]
                            s += ' %+2d' % diff_order_count
                            stat_orders = Stat_Orders()
                            closed_profit = stat_orders.trade_orders(
                                order_list, diff_order_count,
                                obv_simple_list[i].close_list[j])
                            opened_profit = stat_orders.profit_opened_orders(
                                order_list, obv_simple_list[i].close_list[j])
                            profit_sum += closed_profit
                            s += '\tclo_prof_one=\t%+6.2f' % closed_profit
                            s += '\tProfit_Sum=\t%+6.2f' % (profit_sum +
                                                            opened_profit)
                            s += '\tclo_prof_all=\t%+6.2f' % profit_sum
                            s += '\topn_prof_one=\t%+6.2f' % opened_profit
                            #s += '\torder_list=%s' % str(order_list)
                            #if j % 24 == 0:
                            #    print(s)
                            #if j == len(tech_indicat.close_list) - 1:
                            #    print(s)
                            print(s)
                    #print()

                print(
                    '----------------------------Game Over----------------------------\n\n'
                )
            break

        pass