Exemplo n.º 1
0
while 1:
    try:
        eth_btc_lastprice = float(robot_fun.getMarketPrice(eth_btc_url))

    except Exception as e:
        continue

    nowTime = time.time()

    for i in range(1,10000):

        count1 = round(random.uniform(0.001, data['tradePair']['eth_btcMaxCount']), 3)
        req1 = robot_fun.order_buy(robot03, eth_btc_lastprice, url_order, token01, tradePairCode, count1)

        count2 = round(random.uniform(0.001, data['tradePair']['eth_btcMaxCount']), 3)
        req2 = robot_fun.order_sell(robot04, eth_btc_lastprice, url_order, token02, tradePairCode, count2)

        #设置等待时间
        if round(nowTime) % random.randint(1, i + 2):
            time.sleep(random.uniform(3, 5))
        else:
            time.sleep(random.randint(3, 6))

        #30秒后跳出循环重新获取最新交易价格
        runTime = time.time()
        if ((runTime - nowTime) > 60):
            req_cancel_1 = robot_fun.cancelOrderWithTradePair(url_cancel_order,tradePairCode,token01)
            req_cancel_2 = robot_fun.cancelOrderWithTradePair(url_cancel_order,tradePairCode,token02)

            print req_cancel_1.text
            print req_cancel_2.text
Exemplo n.º 2
0
    nowTime = time.time()

    for i in range(1, 1000000):
        count1 = round(
            random.uniform(0.001, data['tradePair']['bch_usdtMaxCount']), 5)
        req1 = robot_fun.order_buy(robot05, bch_usdt_lastprice, url_order,
                                   token01, tradePairCode, count1)
        #设置等待时间
        if round(nowTime) % random.randint(1, i + 2):
            time.sleep(random.uniform(0, 5))
        else:
            time.sleep(numpy.random.random(5)[random.randint(0, 4)] + 0.5)

        count2 = round(
            random.uniform(0.001, data['tradePair']['bch_usdtMaxCount']), 5)
        req2 = robot_fun.order_sell(robot06, bch_usdt_lastprice, url_order,
                                    token02, tradePairCode, count2)
        #设置等待时间
        if round(nowTime) % random.randint(1, i + 2):
            time.sleep(random.uniform(0, 5))
        else:
            time.sleep(numpy.random.random(5)[random.randint(0, 4)] + 0.5)

        if req1.json()['msg'] == u'AccessToken已过期':
            robot_fun.get_access_token(url_login, robot05, password1)

        if req2.json()['msg'] == u'AccessToken已过期':
            robot_fun.get_access_token(url_login, robot06, password2)

        #30秒后跳出循环重新获取最新交易价格
        runTime = time.time()
        if ((runTime - nowTime) > 60):
Exemplo n.º 3
0
    nowTime = time.time()

    for i in range(1, 1000000):
        count1 = round(random.uniform(1, data['tradePair']['xrp_ethMaxCount']),
                       0)
        req1 = robot_fun.order_buy(robot21, xrp_eth_lastprice, url_order,
                                   token01, tradePairCode, count1)
        #设置等待时间
        if round(nowTime) % random.randint(1, i + 2):
            time.sleep(random.uniform(0, 5))
        else:
            time.sleep(numpy.random.random(5)[random.randint(0, 4)] + 0.5)

        count2 = round(random.uniform(1, data['tradePair']['xrp_ethMaxCount']),
                       0)
        req2 = robot_fun.order_sell(robot22, xrp_eth_lastprice, url_order,
                                    token02, tradePairCode, count2)
        #设置等待时间
        if round(nowTime) % random.randint(1, i + 2):
            time.sleep(random.uniform(0, 5))
        else:
            time.sleep(numpy.random.random(5)[random.randint(0, 4)] + 0.5)

        if req1.json()['msg'] == u'AccessToken已过期':
            robot_fun.get_access_token(url_login, robot21, password1)

        if req2.json()['msg'] == u'AccessToken已过期':
            robot_fun.get_access_token(url_login, robot22, password2)

        #30秒后跳出循环重新获取最新交易价格
        runTime = time.time()
        if ((runTime - nowTime) > 60):
Exemplo n.º 4
0
    nowTime = time.time()

    for i in range(1, 1000000):
        count1 = round(random.uniform(1, data['tradePair']['ltc_ethMaxCount']),
                       3)
        req1 = robot_fun.order_buy(tester01, ltc_eth_lastprice, url_order,
                                   token01, tradePairCode, count1)
        #设置等待时间
        if round(nowTime) % random.randint(1, i + 2):
            time.sleep(random.uniform(0, 5))
        else:
            time.sleep(numpy.random.random(5)[random.randint(0, 4)] + 0.5)

        count2 = round(random.uniform(1, data['tradePair']['ltc_ethMaxCount']),
                       3)
        req2 = robot_fun.order_sell(tester02, ltc_eth_lastprice, url_order,
                                    token02, tradePairCode, count2)
        #设置等待时间
        if round(nowTime) % random.randint(1, i + 2):
            time.sleep(random.uniform(0, 5))
        else:
            time.sleep(numpy.random.random(5)[random.randint(0, 4)] + 0.5)

        if req1.json()['msg'] == 'AccessToken已过期':
            robot_fun.get_access_token(url_login, tester01, password1)

        if req2.json()['msg'] == 'AccessToken已过期':
            robot_fun.get_access_token(url_login, tester02, password2)

        #30秒后跳出循环重新获取最新交易价格
        runTime = time.time()
        if ((runTime - nowTime) > 60):