Exemplo n.º 1
0
def batchSellOrder(email, password, url_login, pl, cl, url_order):
    access_token = robot_fun.get_access_token(url_login, email, password)
    chip_order_headers = {
        "content-type": "application/json",
        "access_token": access_token
    }
    amount = 0
    for i in range(0, 5):
        amount = amount + pl[i] * cl[i]
        order_data = {
            "direction": "S",
            "orderType": '200',
            "price": pl[i],
            "count": cl[i],
            "tradePairCode": "BTC_ETH"
        }
        sell_request = requests.post(url_order,
                                     headers=chip_order_headers,
                                     json=order_data)
    print("批量挂卖单:", sell_request.json()['msg'])


#调试代码
# batchBuyOrder(test2,password,url_login,buyPriceList,buyCountList,url_order)
# batchSellOrder(test1,password,url_login,sellPriceList,sellCountList,url_order)

# token = robot_fun.get_access_token(url_login,email2,password)
# req = robot_fun.cancelOrder(cancel_order,1024,'wtf',token)
# print(req)
#
# token = robot_fun.get_access_token(url_login,'*****@*****.**','123456')
# print(token)
Exemplo n.º 2
0
def cancelOrder(request):

    email = request.POST.get('email')
    password = request.POST.get('password')
    orderId = request.POST.get('orderId')
    remark = request.POST.get('remark')

    if email != '' and password != '' and orderId != '' and remark != '':
        token = robot_fun.get_access_token(loginUrl, email, password)
        robot_fun.cancelOrder(cancel_order, orderId, remark, token)
        return render(request, 'order.html', {'cancelmsg': '撤单成功!'})
    else:
        return render(request, 'order.html', {'cancelmsg': '请填写完整!'})
Exemplo n.º 3
0
def batchBuyOrder(email, password, url_login, pl, cl, url_order):
    access_token = robot_fun.get_access_token(url_login, email, password)
    chip_order_headers = {
        "content-type": "application/json",
        "access_token": access_token
    }
    amount = 0
    for i in range(0, 5):
        amount = amount + pl[i] * cl[i]
        order_data = {
            "direction": "B",
            "orderType": '100',
            "price": pl[i],
            "count": cl[i],
            "tradePairCode": "btc_usdt"
        }
        buy_request = requests.post(url_order,
                                    headers=chip_order_headers,
                                    json=order_data)
    print("批量挂买单:", buy_request.json()['msg'])
Exemplo n.º 4
0
def takeOrder(request):

    email = request.POST.get('inputEmail')
    password = request.POST.get('inputPassword')
    orderType = request.POST.get('inputBS')
    price = request.POST.get('inputPrice')
    count = request.POST.get('inputCount')

    if email != '' and password != '' and orderUrl != '' and price != '' and count != '':
        token = robot_fun.get_access_token(loginUrl, email, password)
        robot_fun.takeOrder(orderType, price, count, orderUrl, token)
        return render(
            request, 'order.html', {
                'msg': '挂单成功!',
                'email': email.split('@')[0],
                'orderType': orderType,
                'price': price,
                'count': count
            })
    else:
        return render(request, 'order.html', {'msg': '请填写完整!'})