for t in range(0, 4):
            if t == 0:

                Symbol1 = Symbol_BN
                Kommis1 = Kommis_BN
                AskPrice1 = AskPrice_BN
                BidPrice1 = BidPrice_BN

                for q in range(0, 3):
                    if q == 0:
                        Bundle = []
                        Symbol2 = Symbol_HB
                        Kommis2 = Kommis_HB
                        AskPrice2 = AskPrice_HB
                        BidPrice2 = BidPrice_HB
                        SymbolLast1 = []
                        SymbolLast2 = []

                        for i in range(len(Symbol1)):
                            if Symbol1[i][:len(FirstCoin)] == FirstCoin:
                                Coin2 = Symbol1[i][len(FirstCoin):]
                                PriceWithKommis1 = BidPrice1[i] * (1 - Kommis1)
                                CountCoin = CountUSDT * PriceWithKommis1

                                for j in range(len(Symbol2)):
                                    if Symbol2[j][:len(Coin2)] == Coin2:
                                        Coin3 = Symbol2[j][len(Coin2):]
                                        PriceWithKommis2 = BidPrice2[j] * (1 - Kommis2)
                                        CountCoin2 = CountCoin * PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['бинанс', 'хуоби', FirstCoin, 'по цене', BidPrice1[i], Coin2, 'по цене',
                                                 BidPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                                    if Symbol2[j][-len(Coin2):] == Coin2:
                                        Coin3 = Symbol2[j][:-len(Coin2)]
                                        PriceWithKommis2 = AskPrice2[j] * (1 + Kommis2)
                                        CountCoin2 = CountCoin / PriceWithKommis2


                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['бинанс', 'хуоби', FirstCoin, 'по цене', BidPrice1[i], Coin2, 'по цене',
                                                 AskPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                            if Symbol1[i][(-len(FirstCoin)):] == FirstCoin:
                                Coin2 = Symbol1[i][:-len(FirstCoin)]
                                PriceWithKommis1 = AskPrice1[i] * (1 + Kommis1)
                                CountCoin = CountUSDT / PriceWithKommis1

                                for j in range(len(Symbol2)):
                                    if Symbol2[j][-len(Coin2):] == Coin2:
                                        Coin3 = Symbol2[j][:-len(Coin2)]
                                        PriceWithKommis2 = AskPrice2[j] * (1 + Kommis2)
                                        CountCoin2 = CountCoin / PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['бинанс', 'хуоби', FirstCoin, 'по цене', AskPrice1[i], Coin2, 'по цене',
                                                 AskPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                                    if Symbol2[j][:len(Coin2)] == Coin2:
                                        Coin3 = Symbol2[j][len(Coin2):]
                                        PriceWithKommis2 = BidPrice2[j] * (1 - Kommis2)
                                        CountCoin2 = CountCoin * PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['бинанс', 'хуоби', FirstCoin, 'по цене', AskPrice1[i], Coin2, 'по цене',
                                                 BidPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                        for l in range(len(Bundle)):
                            Index1 = Currency_HB.index(Bundle[l][5])
                            Index2 = Currency_BN.index(Bundle[l][5])

                            Index5 = Symbol_BN.index(SymbolLast1[l])
                            Index6 = Symbol_HB.index(SymbolLast2[l])
                            bid1 = askAmm_BN[Index5]
                            bid2 = bidAmm_HB[Index6]

                            for el in ChainAll_BN[Index2]:
                                if el in ChainAll_HB[Index1] and Bundle[l][9] > 0 and Bundle[l][9] < 30:
                                    Index3 = ChainAll_HB[Index1].index(el)
                                    Index4 = ChainAll_BN[Index2].index(el)
                                    if WithdrawStatus_BN[Index2][Index4] == 'True' and DepositStatus_HB[Index1][Index3] == 'allowed' and Bundle[l][5] not in CoinNotInBundle:
                                        Bundle[l].append(ChainAll_BN[Index2][Index4])
                                        Bundle[l].append(ChainAll_HB[Index1][Index3])
                                        Bundle[l].append(bid1)
                                        Bundle[l].append(bid2)
                                        Bundledf.append(Bundle[l])

                    if q == 1:
                        Bundle = []
                        Symbol2 = Symbol_GT
                        Kommis2 = Kommis_GT
                        AskPrice2 = AskPrice_GT
                        BidPrice2 = BidPrice_GT
                        SymbolLast1 = []
                        SymbolLast2 = []

                        for i in range(len(Symbol1)):
                            if Symbol1[i][:len(FirstCoin)] == FirstCoin:
                                Coin2 = Symbol1[i][len(FirstCoin):]
                                PriceWithKommis1 = BidPrice1[i] * (1 - Kommis1)
                                CountCoin = CountUSDT * PriceWithKommis1

                                for j in range(len(Symbol2)):
                                    if Symbol2[j][:len(Coin2)] == Coin2:
                                        Coin3 = Symbol2[j][len(Coin2):]
                                        PriceWithKommis2 = BidPrice2[j] * (1 - Kommis2)
                                        CountCoin2 = CountCoin * PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['бинанс', 'гейт', FirstCoin, 'по цене', BidPrice1[i], Coin2,
                                                 'по цене', BidPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                                    if Symbol2[j][-len(Coin2):] == Coin2:
                                        Coin3 = Symbol2[j][:-len(Coin2)]
                                        PriceWithKommis2 = AskPrice2[j] * (1 + Kommis2)
                                        CountCoin2 = CountCoin / PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['бинанс', 'гейт', FirstCoin, 'по цене', BidPrice1[i], Coin2,
                                                 'по цене', AskPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                            if Symbol1[i][(-len(FirstCoin)):] == FirstCoin:
                                Coin2 = Symbol1[i][:-len(FirstCoin)]
                                PriceWithKommis1 = AskPrice1[i] * (1 + Kommis1)
                                CountCoin = CountUSDT / PriceWithKommis1

                                for j in range(len(Symbol2)):
                                    if Symbol2[j][-len(Coin2):] == Coin2:
                                        Coin3 = Symbol2[j][:-len(Coin2)]
                                        PriceWithKommis2 = AskPrice2[j] * (1 + Kommis2)
                                        CountCoin2 = CountCoin / PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['бинанс', 'гейт', FirstCoin, 'по цене', AskPrice1[i], Coin2,
                                                 'по цене', AskPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                                    if Symbol2[j][:len(Coin2)] == Coin2:
                                        Coin3 = Symbol2[j][len(Coin2):]
                                        PriceWithKommis2 = BidPrice2[j] * (1 - Kommis2)
                                        CountCoin2 = CountCoin * PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['бинанс', 'гейт', FirstCoin, 'по цене', AskPrice1[i], Coin2,
                                                 'по цене', BidPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                        for l in range(len(Bundle)):
                            try:
                                Index1 = Currency_GT.index(Bundle[l][5])
                                Index2 = Currency_BN.index(Bundle[l][5])

                                Index5 = Symbol_BN.index(SymbolLast1[l])
                                Index6 = Symbol_GT.index(SymbolLast2[l])
                                bid1 = askAmm_BN[Index5]
                                bid2 = bidAmm_GT[Index6]

                                for el in ChainAll_BN[Index2]:
                                    if el in ChainAll_GT[Index1] and Bundle[l][9] > 0 and Bundle[l][9] < 30:
                                        Index3 = ChainAll_GT[Index1].index(el)
                                        Index4 = ChainAll_BN[Index2].index(el)
                                        if WithdrawStatus_BN[Index2][Index4] == 'True' and DepositStatus_GT[Index1][Index3] == 'False' and Bundle[l][5] not in CoinNotInBundle:
                                            Bundle[l].append(ChainAll_BN[Index2][Index4])
                                            Bundle[l].append(ChainAll_GT[Index1][Index3])
                                            Bundle[l].append(bid1)
                                            Bundle[l].append(bid2)
                                            Bundledf.append(Bundle[l])
                            except Exception as e:
                                print(e)

                    if q == 2:
                        Bundle = []
                        Symbol2 = Symbol_MX
                        Kommis2 = Kommis_MX
                        AskPrice2 = AskPrice_MX
                        BidPrice2 = BidPrice_MX
                        SymbolLast1 = []
                        SymbolLast2 = []

                        for i in range(len(Symbol1)):
                            if Symbol1[i][:len(FirstCoin)] == FirstCoin:
                                Coin2 = Symbol1[i][len(FirstCoin):]
                                PriceWithKommis1 = BidPrice1[i] * (1 - Kommis1)
                                CountCoin = CountUSDT * PriceWithKommis1

                                for j in range(len(Symbol2)):
                                    if Symbol2[j][:len(Coin2)] == Coin2:
                                        Coin3 = Symbol2[j][len(Coin2):]
                                        PriceWithKommis2 = BidPrice2[j] * (1 - Kommis2)
                                        CountCoin2 = CountCoin * PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['бинанс', 'мекс', FirstCoin, 'по цене', BidPrice1[i], Coin2,
                                                 'по цене', BidPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                                    if Symbol2[j][-len(Coin2):] == Coin2:
                                        Coin3 = Symbol2[j][:-len(Coin2)]
                                        PriceWithKommis2 = AskPrice2[j] * (1 + Kommis2)
                                        CountCoin2 = CountCoin / PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['бинанс', 'мекс', FirstCoin, 'по цене', BidPrice1[i], Coin2,
                                                 'по цене', AskPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                            if Symbol1[i][(-len(FirstCoin)):] == FirstCoin:
                                Coin2 = Symbol1[i][:-len(FirstCoin)]
                                PriceWithKommis1 = AskPrice1[i] * (1 + Kommis1)
                                CountCoin = CountUSDT / PriceWithKommis1

                                for j in range(len(Symbol2)):
                                    if Symbol2[j][-len(Coin2):] == Coin2:
                                        Coin3 = Symbol2[j][:-len(Coin2)]
                                        PriceWithKommis2 = AskPrice2[j] * (1 + Kommis2)
                                        CountCoin2 = CountCoin / PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['бинанс', 'мекс', FirstCoin, 'по цене', AskPrice1[i], Coin2,
                                                 'по цене', AskPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                                    if Symbol2[j][:len(Coin2)] == Coin2:
                                        Coin3 = Symbol2[j][len(Coin2):]
                                        PriceWithKommis2 = BidPrice2[j] * (1 - Kommis2)
                                        CountCoin2 = CountCoin * PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['бинанс', 'мекс', FirstCoin, 'по цене', AskPrice1[i], Coin2,
                                                 'по цене', BidPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                        for l in range(len(Bundle)):
                            try:
                                Index1 = Currency_MX.index(Bundle[l][5])
                                Index2 = Currency_BN.index(Bundle[l][5])

                                Index5 = Symbol_BN.index(SymbolLast1[l])
                                Index6 = Symbol_MX.index(SymbolLast2[l])
                                bid1 = askAmm_BN[Index5]
                                bid2 = bidAmm_MX[Index6]

                                for el in ChainAll_BN[Index2]:
                                    if el in ChainAll_MX[Index1] and Bundle[l][9] > 0 and Bundle[l][9] < 30:
                                        Index3 = ChainAll_MX[Index1].index(el)
                                        Index4 = ChainAll_BN[Index2].index(el)
                                        if WithdrawStatus_BN[Index2][Index4] == 'True' and DepositStatus_MX[Index1][Index3] == 'True' and Bundle[l][5] not in CoinNotInBundle:
                                            Bundle[l].append(ChainAll_BN[Index2][Index4])
                                            Bundle[l].append(ChainAll_MX[Index1][Index3])
                                            Bundle[l].append(bid1)
                                            Bundle[l].append(bid2)
                                            Bundledf.append(Bundle[l])
                            except Exception as e:
                                print(e)

            if t == 1:
                Symbol1 = Symbol_HB
                Kommis1 = Kommis_HB
                AskPrice1 = AskPrice_HB
                BidPrice1 = BidPrice_HB

                for q in range(0, 3):
                    if q == 0:
                        Bundle = []
                        Symbol2 = Symbol_BN
                        Kommis2 = Kommis_BN
                        AskPrice2 = AskPrice_BN
                        BidPrice2 = BidPrice_BN
                        SymbolLast1 = []
                        SymbolLast2 = []

                        for i in range(len(Symbol1)):
                            if Symbol1[i][:len(FirstCoin)] == FirstCoin:
                                Coin2 = Symbol1[i][len(FirstCoin):]
                                PriceWithKommis1 = BidPrice1[i] * (1 - Kommis1)
                                CountCoin = CountUSDT * PriceWithKommis1

                                for j in range(len(Symbol2)):
                                    if Symbol2[j][:len(Coin2)] == Coin2:
                                        Coin3 = Symbol2[j][len(Coin2):]
                                        PriceWithKommis2 = BidPrice2[j] * (1 - Kommis2)
                                        CountCoin2 = CountCoin * PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['хуоби', 'бинанс', FirstCoin, 'по цене', BidPrice1[i], Coin2, 'по цене',
                                                 BidPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                                    if Symbol2[j][-len(Coin2):] == Coin2:
                                        Coin3 = Symbol2[j][:-len(Coin2)]
                                        PriceWithKommis2 = AskPrice2[j] * (1 + Kommis2)
                                        CountCoin2 = CountCoin / PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['хуоби', 'бинанс', FirstCoin, 'по цене', BidPrice1[i], Coin2, 'по цене',
                                                 AskPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                            if Symbol1[i][(-len(FirstCoin)):] == FirstCoin:
                                Coin2 = Symbol1[i][:-len(FirstCoin)]
                                PriceWithKommis1 = AskPrice1[i] * (1 + Kommis1)
                                CountCoin = CountUSDT / PriceWithKommis1

                                for j in range(len(Symbol2)):
                                    if Symbol2[j][-len(Coin2):] == Coin2:
                                        Coin3 = Symbol2[j][:-len(Coin2)]
                                        PriceWithKommis2 = AskPrice2[j] * (1 + Kommis2)
                                        CountCoin2 = CountCoin / PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['хуоби', 'бинанс', FirstCoin, 'по цене', AskPrice1[i], Coin2, 'по цене',
                                                 AskPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                                    if Symbol2[j][:len(Coin2)] == Coin2:
                                        Coin3 = Symbol2[j][len(Coin2):]
                                        PriceWithKommis2 = BidPrice2[j] * (1 - Kommis2)
                                        CountCoin2 = CountCoin * PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['хуоби', 'бинанс', FirstCoin, 'по цене', AskPrice1[i], Coin2, 'по цене',
                                                 BidPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                        for l in range(len(Bundle)):
                            try:
                                Index1 = Currency_HB.index(Bundle[l][5])
                                Index2 = Currency_BN.index(Bundle[l][5])

                                Index5 = Symbol_HB.index(SymbolLast1[l])
                                Index6 = Symbol_BN.index(SymbolLast2[l])
                                bid1 = askAmm_HB[Index5]
                                bid2 = bidAmm_BN[Index6]

                                for el in ChainAll_BN[Index2]:
                                    if el in ChainAll_HB[Index1] and Bundle[l][9] > 0 and Bundle[l][9] < 30:
                                        Index3 = ChainAll_HB[Index1].index(el)
                                        Index4 = ChainAll_BN[Index2].index(el)
                                        if DepositStatus_BN[Index2][Index4] == 'True' and WithdrawStatus_HB[Index1][Index3] == 'allowed' and Bundle[l][5] not in CoinNotInBundle:
                                            Bundle[l].append(ChainAll_BN[Index2][Index4])
                                            Bundle[l].append(ChainAll_HB[Index1][Index3])
                                            Bundle[l].append(bid1)
                                            Bundle[l].append(bid2)
                                            Bundledf.append(Bundle[l])
                            except Exception as e:
                                print(e)

                    if q == 1:
                        Bundle = []
                        Symbol2 = Symbol_GT
                        Kommis2 = Kommis_GT
                        AskPrice2 = AskPrice_GT
                        BidPrice2 = BidPrice_GT
                        SymbolLast1 = []
                        SymbolLast2 = []

                        for i in range(len(Symbol1)):
                            if Symbol1[i][:len(FirstCoin)] == FirstCoin:
                                Coin2 = Symbol1[i][len(FirstCoin):]
                                PriceWithKommis1 = BidPrice1[i] * (1 - Kommis1)
                                CountCoin = CountUSDT * PriceWithKommis1

                                for j in range(len(Symbol2)):
                                    if Symbol2[j][:len(Coin2)] == Coin2:
                                        Coin3 = Symbol2[j][len(Coin2):]
                                        PriceWithKommis2 = BidPrice2[j] * (1 - Kommis2)
                                        CountCoin2 = CountCoin * PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['хуоби', 'гейт', FirstCoin, 'по цене', BidPrice1[i], Coin2,
                                                 'по цене', BidPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                                    if Symbol2[j][-len(Coin2):] == Coin2:
                                        Coin3 = Symbol2[j][:-len(Coin2)]
                                        PriceWithKommis2 = AskPrice2[j] * (1 + Kommis2)
                                        CountCoin2 = CountCoin / PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['хуоби', 'гейт', FirstCoin, 'по цене', BidPrice1[i], Coin2,
                                                 'по цене', AskPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                            if Symbol1[i][(-len(FirstCoin)):] == FirstCoin:
                                Coin2 = Symbol1[i][:-len(FirstCoin)]
                                PriceWithKommis1 = AskPrice1[i] * (1 + Kommis1)
                                CountCoin = CountUSDT / PriceWithKommis1

                                for j in range(len(Symbol2)):
                                    if Symbol2[j][-len(Coin2):] == Coin2:
                                        Coin3 = Symbol2[j][:-len(Coin2)]
                                        PriceWithKommis2 = AskPrice2[j] * (1 + Kommis2)
                                        CountCoin2 = CountCoin / PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['хуоби', 'гейт', FirstCoin, 'по цене', AskPrice1[i], Coin2,
                                                 'по цене', AskPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                                    if Symbol2[j][:len(Coin2)] == Coin2:
                                        Coin3 = Symbol2[j][len(Coin2):]
                                        PriceWithKommis2 = BidPrice2[j] * (1 - Kommis2)
                                        CountCoin2 = CountCoin * PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['хуоби', 'гейт', FirstCoin, 'по цене', AskPrice1[i], Coin2,
                                                 'по цене', BidPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                        for l in range(len(Bundle)):
                            Index1 = Currency_HB.index(Bundle[l][5])
                            Index2 = Currency_GT.index(Bundle[l][5])

                            Index5 = Symbol_HB.index(SymbolLast1[l])
                            Index6 = Symbol_GT.index(SymbolLast2[l])
                            bid1 = askAmm_HB[Index5]
                            bid2 = bidAmm_GT[Index6]

                            for el in ChainAll_GT[Index2]:
                                if el in ChainAll_HB[Index1] and Bundle[l][9] > 0 and Bundle[l][9] < 30:
                                    Index3 = ChainAll_HB[Index1].index(el)
                                    Index4 = ChainAll_GT[Index2].index(el)
                                    if DepositStatus_GT[Index2][Index4] == 'False' and WithdrawStatus_HB[Index1][Index3] == 'allowed' and Bundle[l][5] not in CoinNotInBundle:
                                        Bundle[l].append(ChainAll_GT[Index2][Index4])
                                        Bundle[l].append(ChainAll_HB[Index1][Index3])
                                        Bundle[l].append(bid1)
                                        Bundle[l].append(bid2)
                                        Bundledf.append(Bundle[l])

                    if q == 2:
                        Bundle = []
                        Symbol2 = Symbol_MX
                        Kommis2 = Kommis_MX
                        AskPrice2 = AskPrice_MX
                        BidPrice2 = BidPrice_MX
                        SymbolLast1 = []
                        SymbolLast2 = []

                        for i in range(len(Symbol1)):
                            if Symbol1[i][:len(FirstCoin)] == FirstCoin:
                                Coin2 = Symbol1[i][len(FirstCoin):]
                                PriceWithKommis1 = BidPrice1[i] * (1 - Kommis1)
                                CountCoin = CountUSDT * PriceWithKommis1

                                for j in range(len(Symbol2)):
                                    if Symbol2[j][:len(Coin2)] == Coin2:
                                        Coin3 = Symbol2[j][len(Coin2):]
                                        PriceWithKommis2 = BidPrice2[j] * (1 - Kommis2)
                                        CountCoin2 = CountCoin * PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['хуоби', 'мекс', FirstCoin, 'по цене', BidPrice1[i], Coin2,
                                                 'по цене', BidPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                                    if Symbol2[j][-len(Coin2):] == Coin2:
                                        Coin3 = Symbol2[j][:-len(Coin2)]
                                        PriceWithKommis2 = AskPrice2[j] * (1 + Kommis2)
                                        CountCoin2 = CountCoin / PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['хуоби', 'мекс', FirstCoin, 'по цене', BidPrice1[i], Coin2,
                                                 'по цене', AskPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                            if Symbol1[i][(-len(FirstCoin)):] == FirstCoin:
                                Coin2 = Symbol1[i][:-len(FirstCoin)]
                                PriceWithKommis1 = AskPrice1[i] * (1 + Kommis1)
                                CountCoin = CountUSDT / PriceWithKommis1

                                for j in range(len(Symbol2)):
                                    if Symbol2[j][-len(Coin2):] == Coin2:
                                        Coin3 = Symbol2[j][:-len(Coin2)]
                                        PriceWithKommis2 = AskPrice2[j] * (1 + Kommis2)
                                        CountCoin2 = CountCoin / PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['хуоби', 'мекс', FirstCoin, 'по цене', AskPrice1[i], Coin2,
                                                 'по цене', AskPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                                    if Symbol2[j][:len(Coin2)] == Coin2:
                                        Coin3 = Symbol2[j][len(Coin2):]
                                        PriceWithKommis2 = BidPrice2[j] * (1 - Kommis2)
                                        CountCoin2 = CountCoin * PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['хуоби', 'мекс', FirstCoin, 'по цене', AskPrice1[i], Coin2,
                                                 'по цене', BidPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                        for l in range(len(Bundle)):
                            Index1 = Currency_HB.index(Bundle[l][5])
                            Index2 = Currency_MX.index(Bundle[l][5])

                            Index5 = Symbol_HB.index(SymbolLast1[l])
                            Index6 = Symbol_MX.index(SymbolLast2[l])
                            bid1 = askAmm_HB[Index5]
                            bid2 = bidAmm_MX[Index6]

                            for el in ChainAll_MX[Index2]:
                                if el in ChainAll_HB[Index1] and Bundle[l][9] > 0 and Bundle[l][9] < 30:
                                    Index3 = ChainAll_HB[Index1].index(el)
                                    Index4 = ChainAll_MX[Index2].index(el)
                                    if DepositStatus_MX[Index2][Index4] == 'True' and WithdrawStatus_HB[Index1][Index3] == 'allowed' and Bundle[l][5] not in CoinNotInBundle:
                                        Bundle[l].append(ChainAll_MX[Index2][Index4])
                                        Bundle[l].append(ChainAll_HB[Index1][Index3])
                                        Bundle[l].append(bid1)
                                        Bundle[l].append(bid2)
                                        Bundledf.append(Bundle[l])

            if t == 2:

                Symbol1 = Symbol_GT
                Kommis1 = Kommis_GT
                AskPrice1 = AskPrice_GT
                BidPrice1 = BidPrice_GT

                for q in range(0, 3):
                    if q == 0:
                        Bundle = []
                        Symbol2 = Symbol_BN
                        Kommis2 = Kommis_BN
                        AskPrice2 = AskPrice_BN
                        BidPrice2 = BidPrice_BN
                        SymbolLast1 = []
                        SymbolLast2 = []

                        for i in range(len(Symbol1)):
                            if Symbol1[i][:len(FirstCoin)] == FirstCoin:
                                Coin2 = Symbol1[i][len(FirstCoin):]
                                PriceWithKommis1 = BidPrice1[i] * (1 - Kommis1)
                                CountCoin = CountUSDT * PriceWithKommis1

                                for j in range(len(Symbol2)):
                                    if Symbol2[j][:len(Coin2)] == Coin2:
                                        Coin3 = Symbol2[j][len(Coin2):]
                                        PriceWithKommis2 = BidPrice2[j] * (1 - Kommis2)
                                        CountCoin2 = CountCoin * PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['гейт', 'бинанс', FirstCoin, 'по цене', BidPrice1[i], Coin2,
                                                 'по цене', BidPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                                    if Symbol2[j][-len(Coin2):] == Coin2:
                                        Coin3 = Symbol2[j][:-len(Coin2)]
                                        PriceWithKommis2 = AskPrice2[j] * (1 + Kommis2)
                                        CountCoin2 = CountCoin / PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['гейт', 'бинанс', FirstCoin, 'по цене', BidPrice1[i], Coin2,
                                                 'по цене', AskPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                            if Symbol1[i][(-len(FirstCoin)):] == FirstCoin:
                                Coin2 = Symbol1[i][:-len(FirstCoin)]
                                PriceWithKommis1 = AskPrice1[i] * (1 + Kommis1)
                                CountCoin = CountUSDT / PriceWithKommis1

                                for j in range(len(Symbol2)):
                                    if Symbol2[j][-len(Coin2):] == Coin2:
                                        Coin3 = Symbol2[j][:-len(Coin2)]
                                        PriceWithKommis2 = AskPrice2[j] * (1 + Kommis2)
                                        CountCoin2 = CountCoin / PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['гейт', 'бинанс', FirstCoin, 'по цене', AskPrice1[i], Coin2,
                                                 'по цене', AskPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                                    if Symbol2[j][:len(Coin2)] == Coin2:
                                        Coin3 = Symbol2[j][len(Coin2):]
                                        PriceWithKommis2 = BidPrice2[j] * (1 - Kommis2)
                                        CountCoin2 = CountCoin * PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['гейт', 'бинанс', FirstCoin, 'по цене', AskPrice1[i], Coin2,
                                                 'по цене', BidPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                        for l in range(len(Bundle)):
                            try:
                                Index1 = Currency_GT.index(Bundle[l][5])
                                Index2 = Currency_BN.index(Bundle[l][5])

                                Index5 = Symbol_GT.index(SymbolLast1[l])
                                Index6 = Symbol_BN.index(SymbolLast2[l])
                                bid1 = askAmm_GT[Index5]
                                bid2 = bidAmm_BN[Index6]

                                for el in ChainAll_BN[Index2]:
                                    if el in ChainAll_GT[Index1] and Bundle[l][9] > 0 and Bundle[l][9] < 30:
                                        Index3 = ChainAll_GT[Index1].index(el)
                                        Index4 = ChainAll_BN[Index2].index(el)
                                        if DepositStatus_BN[Index2][Index4] == 'True' and WithdrawStatus_GT[Index1][Index3] == 'False' and Bundle[l][5] not in CoinNotInBundle:
                                            Bundle[l].append(ChainAll_BN[Index2][Index4])
                                            Bundle[l].append(ChainAll_GT[Index1][Index3])
                                            Bundle[l].append(bid1)
                                            Bundle[l].append(bid2)
                                            Bundledf.append(Bundle[l])
                            except Exception as e:
                                print(e)

                    if q == 1:
                        Bundle = []
                        Symbol2 = Symbol_HB
                        Kommis2 = Kommis_HB
                        AskPrice2 = AskPrice_HB
                        BidPrice2 = BidPrice_HB
                        SymbolLast1 = []
                        SymbolLast2 = []

                        for i in range(len(Symbol1)):
                            if Symbol1[i][:len(FirstCoin)] == FirstCoin:
                                Coin2 = Symbol1[i][len(FirstCoin):]
                                PriceWithKommis1 = BidPrice1[i] * (1 - Kommis1)
                                CountCoin = CountUSDT * PriceWithKommis1

                                for j in range(len(Symbol2)):
                                    if Symbol2[j][:len(Coin2)] == Coin2:
                                        Coin3 = Symbol2[j][len(Coin2):]
                                        PriceWithKommis2 = BidPrice2[j] * (1 - Kommis2)
                                        CountCoin2 = CountCoin * PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['гейт', 'хуоби', FirstCoin, 'по цене', BidPrice1[i], Coin2,
                                                 'по цене', BidPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                                    if Symbol2[j][-len(Coin2):] == Coin2:
                                        Coin3 = Symbol2[j][:-len(Coin2)]
                                        PriceWithKommis2 = AskPrice2[j] * (1 + Kommis2)
                                        CountCoin2 = CountCoin / PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['гейт', 'хуоби', FirstCoin, 'по цене', BidPrice1[i], Coin2,
                                                 'по цене', AskPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                            if Symbol1[i][(-len(FirstCoin)):] == FirstCoin:
                                Coin2 = Symbol1[i][:-len(FirstCoin)]
                                PriceWithKommis1 = AskPrice1[i] * (1 + Kommis1)
                                CountCoin = CountUSDT / PriceWithKommis1

                                for j in range(len(Symbol2)):
                                    if Symbol2[j][-len(Coin2):] == Coin2:
                                        Coin3 = Symbol2[j][:-len(Coin2)]
                                        PriceWithKommis2 = AskPrice2[j] * (1 + Kommis2)
                                        CountCoin2 = CountCoin / PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['гейт', 'хуоби', FirstCoin, 'по цене', AskPrice1[i], Coin2,
                                                 'по цене', AskPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                                    if Symbol2[j][:len(Coin2)] == Coin2:
                                        Coin3 = Symbol2[j][len(Coin2):]
                                        PriceWithKommis2 = BidPrice2[j] * (1 - Kommis2)
                                        CountCoin2 = CountCoin * PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['гейт', 'хуоби', FirstCoin, 'по цене', AskPrice1[i], Coin2,
                                                 'по цене', BidPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                        for l in range(len(Bundle)):
                            Index1 = Currency_HB.index(Bundle[l][5])
                            Index2 = Currency_GT.index(Bundle[l][5])

                            Index5 = Symbol_GT.index(SymbolLast1[l])
                            Index6 = Symbol_HB.index(SymbolLast2[l])
                            bid1 = askAmm_GT[Index5]
                            bid2 = bidAmm_HB[Index6]

                            for el in ChainAll_GT[Index2]:
                                if el in ChainAll_HB[Index1] and Bundle[l][9] > 0 and Bundle[l][9] < 30:
                                    Index3 = ChainAll_HB[Index1].index(el)
                                    Index4 = ChainAll_GT[Index2].index(el)
                                    if WithdrawStatus_GT[Index2][Index4] == 'False' and DepositStatus_HB[Index1][Index3] == 'allowed' and Bundle[l][5] not in CoinNotInBundle:
                                        Bundle[l].append(ChainAll_GT[Index2][Index4])
                                        Bundle[l].append(ChainAll_HB[Index1][Index3])
                                        Bundle[l].append(bid1)
                                        Bundle[l].append(bid2)
                                        Bundledf.append(Bundle[l])

                    if q == 2:
                        Bundle = []
                        Symbol2 = Symbol_MX
                        Kommis2 = Kommis_MX
                        AskPrice2 = AskPrice_MX
                        BidPrice2 = BidPrice_MX
                        SymbolLast1 = []
                        SymbolLast2 = []

                        for i in range(len(Symbol1)):
                            if Symbol1[i][:len(FirstCoin)] == FirstCoin:
                                Coin2 = Symbol1[i][len(FirstCoin):]
                                PriceWithKommis1 = BidPrice1[i] * (1 - Kommis1)
                                CountCoin = CountUSDT * PriceWithKommis1

                                for j in range(len(Symbol2)):
                                    if Symbol2[j][:len(Coin2)] == Coin2:
                                        Coin3 = Symbol2[j][len(Coin2):]
                                        PriceWithKommis2 = BidPrice2[j] * (1 - Kommis2)
                                        CountCoin2 = CountCoin * PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['гейт', 'мекс', FirstCoin, 'по цене', BidPrice1[i], Coin2,
                                                 'по цене', BidPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                                    if Symbol2[j][-len(Coin2):] == Coin2:
                                        Coin3 = Symbol2[j][:-len(Coin2)]
                                        PriceWithKommis2 = AskPrice2[j] * (1 + Kommis2)
                                        CountCoin2 = CountCoin / PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['гейт', 'мекс', FirstCoin, 'по цене', BidPrice1[i], Coin2,
                                                 'по цене', AskPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                            if Symbol1[i][(-len(FirstCoin)):] == FirstCoin:
                                Coin2 = Symbol1[i][:-len(FirstCoin)]
                                PriceWithKommis1 = AskPrice1[i] * (1 + Kommis1)
                                CountCoin = CountUSDT / PriceWithKommis1

                                for j in range(len(Symbol2)):
                                    if Symbol2[j][-len(Coin2):] == Coin2:
                                        Coin3 = Symbol2[j][:-len(Coin2)]
                                        PriceWithKommis2 = AskPrice2[j] * (1 + Kommis2)
                                        CountCoin2 = CountCoin / PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['гейт', 'мекс', FirstCoin, 'по цене', AskPrice1[i], Coin2,
                                                 'по цене', AskPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                                    if Symbol2[j][:len(Coin2)] == Coin2:
                                        Coin3 = Symbol2[j][len(Coin2):]
                                        PriceWithKommis2 = BidPrice2[j] * (1 - Kommis2)
                                        CountCoin2 = CountCoin * PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['гейт', 'мекс', FirstCoin, 'по цене', AskPrice1[i], Coin2,
                                                 'по цене', BidPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                        for l in range(len(Bundle)):
                            Index1 = Currency_MX.index(Bundle[l][5])
                            Index2 = Currency_GT.index(Bundle[l][5])

                            Index5 = Symbol_GT.index(SymbolLast1[l])
                            Index6 = Symbol_MX.index(SymbolLast2[l])
                            bid1 = askAmm_GT[Index5]
                            bid2 = bidAmm_MX[Index6]

                            for el in ChainAll_GT[Index2]:
                                if el in ChainAll_MX[Index1] and Bundle[l][9] > 0 and Bundle[l][9] < 30:
                                    Index3 = ChainAll_MX[Index1].index(el)
                                    Index4 = ChainAll_GT[Index2].index(el)
                                    if WithdrawStatus_GT[Index2][Index4] == 'False' and DepositStatus_MX[Index1][Index3] == 'True' and Bundle[l][5] not in CoinNotInBundle:
                                        Bundle[l].append(ChainAll_GT[Index2][Index4])
                                        Bundle[l].append(ChainAll_MX[Index1][Index3])
                                        Bundle[l].append(bid1)
                                        Bundle[l].append(bid2)
                                        Bundledf.append(Bundle[l])
            if t == 3:
                Symbol1 = Symbol_MX
                Kommis1 = Kommis_MX
                AskPrice1 = AskPrice_MX
                BidPrice1 = BidPrice_MX

                for q in range(0, 3):
                    if q == 0:
                        Bundle = []
                        Symbol2 = Symbol_BN
                        Kommis2 = Kommis_BN
                        AskPrice2 = AskPrice_BN
                        BidPrice2 = BidPrice_BN
                        SymbolLast1 = []
                        SymbolLast2 = []

                        for i in range(len(Symbol1)):
                            if Symbol1[i][:len(FirstCoin)] == FirstCoin:
                                Coin2 = Symbol1[i][len(FirstCoin):]
                                PriceWithKommis1 = BidPrice1[i] * (1 - Kommis1)
                                CountCoin = CountUSDT * PriceWithKommis1


                                for j in range(len(Symbol2)):
                                    if Symbol2[j][:len(Coin2)] == Coin2:
                                        Coin3 = Symbol2[j][len(Coin2):]
                                        PriceWithKommis2 = BidPrice2[j] * (1 - Kommis2)
                                        CountCoin2 = CountCoin * PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['мекс', 'бинанс', FirstCoin, 'по цене', BidPrice1[i], Coin2,
                                                 'по цене', BidPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                                    if Symbol2[j][-len(Coin2):] == Coin2:
                                        Coin3 = Symbol2[j][:-len(Coin2)]
                                        PriceWithKommis2 = AskPrice2[j] * (1 + Kommis2)
                                        CountCoin2 = CountCoin / PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['мекс', 'бинанс', FirstCoin, 'по цене', BidPrice1[i], Coin2,
                                                 'по цене', AskPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                            if Symbol1[i][(-len(FirstCoin)):] == FirstCoin:
                                Coin2 = Symbol1[i][:-len(FirstCoin)]
                                PriceWithKommis1 = AskPrice1[i] * (1 + Kommis1)
                                CountCoin = CountUSDT / PriceWithKommis1

                                for j in range(len(Symbol2)):
                                    if Symbol2[j][-len(Coin2):] == Coin2:
                                        Coin3 = Symbol2[j][:-len(Coin2)]
                                        PriceWithKommis2 = AskPrice2[j] * (1 + Kommis2)
                                        CountCoin2 = CountCoin / PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['мекс', 'бинанс', FirstCoin, 'по цене', AskPrice1[i], Coin2,
                                                 'по цене', AskPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                                    if Symbol2[j][:len(Coin2)] == Coin2:
                                        Coin3 = Symbol2[j][len(Coin2):]
                                        PriceWithKommis2 = BidPrice2[j] * (1 - Kommis2)
                                        CountCoin2 = CountCoin * PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['мекс', 'бинанс', FirstCoin, 'по цене', AskPrice1[i], Coin2,
                                                 'по цене', BidPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                        for l in range(len(Bundle)):
                            try:
                                Index1 = Currency_MX.index(Bundle[l][5])
                                Index2 = Currency_BN.index(Bundle[l][5])

                                Index5 = Symbol_MX.index(SymbolLast1[l])
                                Index6 = Symbol_BN.index(SymbolLast2[l])
                                bid1 = askAmm_MX[Index5]
                                bid2 = bidAmm_BN[Index6]

                                for el in ChainAll_BN[Index2]:
                                    if el in ChainAll_MX[Index1] and Bundle[l][9] > 0 and Bundle[l][9] < 30:
                                        Index3 = ChainAll_MX[Index1].index(el)
                                        Index4 = ChainAll_BN[Index2].index(el)
                                        if DepositStatus_BN[Index2][Index4] == 'True' and WithdrawStatus_MX[Index1][Index3] == 'True' and Bundle[l][5] not in CoinNotInBundle:
                                            Bundle[l].append(ChainAll_BN[Index2][Index4])
                                            Bundle[l].append(ChainAll_MX[Index1][Index3])
                                            Bundle[l].append(bid1)
                                            Bundle[l].append(bid2)
                                            Bundledf.append(Bundle[l])
                            except Exception as e:
                                print(e)

                    if q == 1:
                        Bundle = []
                        Symbol2 = Symbol_HB
                        Kommis2 = Kommis_HB
                        AskPrice2 = AskPrice_HB
                        BidPrice2 = BidPrice_HB
                        SymbolLast1 = []
                        SymbolLast2 = []

                        for i in range(len(Symbol1)):
                            if Symbol1[i][:len(FirstCoin)] == FirstCoin:
                                Coin2 = Symbol1[i][len(FirstCoin):]
                                PriceWithKommis1 = BidPrice1[i] * (1 - Kommis1)
                                CountCoin = CountUSDT * PriceWithKommis1

                                for j in range(len(Symbol2)):
                                    if Symbol2[j][:len(Coin2)] == Coin2:
                                        Coin3 = Symbol2[j][len(Coin2):]
                                        PriceWithKommis2 = BidPrice2[j] * (1 - Kommis2)
                                        CountCoin2 = CountCoin * PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['мекс', 'хуоби', FirstCoin, 'по цене', BidPrice1[i], Coin2,
                                                 'по цене', BidPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                                    if Symbol2[j][-len(Coin2):] == Coin2:
                                        Coin3 = Symbol2[j][:-len(Coin2)]
                                        PriceWithKommis2 = AskPrice2[j] * (1 + Kommis2)
                                        CountCoin2 = CountCoin / PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['мекс', 'хуоби', FirstCoin, 'по цене', BidPrice1[i], Coin2,
                                                 'по цене', AskPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                            if Symbol1[i][(-len(FirstCoin)):] == FirstCoin:
                                Coin2 = Symbol1[i][:-len(FirstCoin)]
                                PriceWithKommis1 = AskPrice1[i] * (1 + Kommis1)
                                CountCoin = CountUSDT / PriceWithKommis1

                                for j in range(len(Symbol2)):
                                    if Symbol2[j][-len(Coin2):] == Coin2:
                                        Coin3 = Symbol2[j][:-len(Coin2)]
                                        PriceWithKommis2 = AskPrice2[j] * (1 + Kommis2)
                                        CountCoin2 = CountCoin / PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['мекс', 'хуоби', FirstCoin, 'по цене', AskPrice1[i], Coin2,
                                                 'по цене', AskPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                                    if Symbol2[j][:len(Coin2)] == Coin2:
                                        Coin3 = Symbol2[j][len(Coin2):]
                                        PriceWithKommis2 = BidPrice2[j] * (1 - Kommis2)
                                        CountCoin2 = CountCoin * PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['мекс', 'хуоби', FirstCoin, 'по цене', AskPrice1[i], Coin2,
                                                 'по цене', BidPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                        for l in range(len(Bundle)):
                            Index1 = Currency_HB.index(Bundle[l][5])
                            Index2 = Currency_MX.index(Bundle[l][5])

                            Index5 = Symbol_MX.index(SymbolLast1[l])
                            Index6 = Symbol_HB.index(SymbolLast2[l])
                            bid1 = askAmm_MX[Index5]
                            bid2 = bidAmm_HB[Index6]

                            for el in ChainAll_MX[Index2]:
                                if el in ChainAll_HB[Index1] and Bundle[l][9] > 0 and Bundle[l][9] < 30:
                                    Index3 = ChainAll_HB[Index1].index(el)
                                    Index4 = ChainAll_MX[Index2].index(el)
                                    if WithdrawStatus_MX[Index2][Index4] == 'True' and DepositStatus_HB[Index1][Index3] == 'allowed' and Bundle[l][5] not in CoinNotInBundle:
                                        Bundle[l].append(ChainAll_MX[Index2][Index4])
                                        Bundle[l].append(ChainAll_HB[Index1][Index3])
                                        Bundle[l].append(bid1)
                                        Bundle[l].append(bid2)
                                        Bundledf.append(Bundle[l])

                    if q == 2:
                        Bundle = []
                        Symbol2 = Symbol_GT
                        Kommis2 = Kommis_GT
                        AskPrice2 = AskPrice_GT
                        BidPrice2 = BidPrice_GT
                        SymbolLast1 = []
                        SymbolLast2 = []

                        for i in range(len(Symbol1)):
                            if Symbol1[i][:len(FirstCoin)] == FirstCoin:
                                Coin2 = Symbol1[i][len(FirstCoin):]
                                PriceWithKommis1 = BidPrice1[i] * (1 - Kommis1)
                                CountCoin = CountUSDT * PriceWithKommis1

                                for j in range(len(Symbol2)):
                                    if Symbol2[j][:len(Coin2)] == Coin2:
                                        Coin3 = Symbol2[j][len(Coin2):]
                                        PriceWithKommis2 = BidPrice2[j] * (1 - Kommis2)
                                        CountCoin2 = CountCoin * PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['мекс', 'гейт', FirstCoin, 'по цене', BidPrice1[i], Coin2,
                                                 'по цене', BidPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                                    if Symbol2[j][-len(Coin2):] == Coin2:
                                        Coin3 = Symbol2[j][:-len(Coin2)]
                                        PriceWithKommis2 = AskPrice2[j] * (1 + Kommis2)
                                        CountCoin2 = CountCoin / PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['мекс', 'гейт', FirstCoin, 'по цене', BidPrice1[i], Coin2,
                                                 'по цене', AskPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                            if Symbol1[i][(-len(FirstCoin)):] == FirstCoin:
                                Coin2 = Symbol1[i][:-len(FirstCoin)]
                                PriceWithKommis1 = AskPrice1[i] * (1 + Kommis1)
                                CountCoin = CountUSDT / PriceWithKommis1

                                for j in range(len(Symbol2)):
                                    if Symbol2[j][-len(Coin2):] == Coin2:
                                        Coin3 = Symbol2[j][:-len(Coin2)]
                                        PriceWithKommis2 = AskPrice2[j] * (1 + Kommis2)
                                        CountCoin2 = CountCoin / PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['мекс', 'гейт', FirstCoin, 'по цене', AskPrice1[i], Coin2,
                                                 'по цене', AskPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                                    if Symbol2[j][:len(Coin2)] == Coin2:
                                        Coin3 = Symbol2[j][len(Coin2):]
                                        PriceWithKommis2 = BidPrice2[j] * (1 - Kommis2)
                                        CountCoin2 = CountCoin * PriceWithKommis2

                                        if Coin3 == FirstCoin:
                                            SymbolLast2.append(Symbol2[j])
                                            SymbolLast1.append(Symbol1[i])
                                            Bundle.append(
                                                ['мекс', 'гейт', FirstCoin, 'по цене', AskPrice1[i], Coin2,
                                                 'по цене', BidPrice2[j], Coin3, (CountCoin2 - 1) * 100])

                        for l in range(len(Bundle)):
                            Index1 = Currency_MX.index(Bundle[l][5])
                            Index2 = Currency_GT.index(Bundle[l][5])

                            Index5 = Symbol_MX.index(SymbolLast1[l])
                            Index6 = Symbol_GT.index(SymbolLast2[l])
                            bid1 = askAmm_MX[Index5]
                            bid2 = bidAmm_GT[Index6]

                            for el in ChainAll_GT[Index2]:
                                if el in ChainAll_MX[Index1] and Bundle[l][9] > 0 and Bundle[l][9] < 30:
                                    Index3 = ChainAll_MX[Index1].index(el)
                                    Index4 = ChainAll_GT[Index2].index(el)
                                    if DepositStatus_GT[Index2][Index4] == 'False' and WithdrawStatus_MX[Index1][Index3] == 'True' and Bundle[l][5] not in CoinNotInBundle:
                                        Bundle[l].append(ChainAll_GT[Index2][Index4])
                                        Bundle[l].append(ChainAll_MX[Index1][Index3])
                                        Bundle[l].append(bid1)
                                        Bundle[l].append(bid2)
                                        Bundledf.append(Bundle[l]) переработай и улучши