Пример #1
0
def send_order(amount, source, symbol, _type, price=0):
    """
    :param amount: 
    :param source: 
    :param symbol: 
    :param _type: 可选值 {buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖}
    :param price: 
    :return: 
    """
    try:
        accounts = get_accounts()
        acct_id = accounts['data'][0]['id']
    except BaseException as e:
        #xie begin , #print 'get acct_id error.%s'%e
        Logger.error("HuobiService", "Unrecognised message:\n" % e)
        #xie end
        acct_id = hbu.ACCOUNT_ID

    params = {
        "account-id": acct_id,
        "amount": amount,
        "symbol": symbol,
        "type": _type,
        "source": source
    }
    if price:
        params["price"] = price

    url = '/v1/order/orders/place'
    return hbu.api_key_post(params, url)
Пример #2
0
def cancel_order(order_id):
    """
    
    :param order_id: 
    :return: 
    """
    params = {}
    url = "/v1/order/orders/{0}/submitcancel".format(order_id)
    return hbu.api_key_post(params, url)
Пример #3
0
def place_order(order_id):
    """
    
    :param order_id: 
    :return: 
    """
    params = {}
    url = "/v1/order/orders/{0}/place".format(order_id)
    return hbu.api_key_post(params, url)
Пример #4
0
def cancel_withdraw(address_id):
    """
    
    :param address_id: 
    :return: {
              "status": "ok",
              "data": 700
            }
    """
    params = {}
    url = '/v1/dw/withdraw-virtual/{0}/cancel'.format(address_id)
    return hbu.api_key_post(params, url)
Пример #5
0
def withdraw(address_id, amount, currency, fee=0, addr_tag=""):
    """
    
    :param address_id: 
    :param amount: 
    :param currency:btc, ltc, bcc, eth, etc ...(火币Pro支持的币种)
    :param fee: 
    :param addr-tag:
    :return: {
              "status": "ok",
              "data": 700
            }
    """

    params = {
        'address-id': address_id,
        'amount': amount,
        "currency": currency,
        "fee": fee,
        "addr-tag": addr_tag
    }
    url = '/v1/dw/withdraw/api/create'
    return hbu.api_key_post(params, url)