Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Response1011 #12

Open
Eisei-Shimizu opened this issue Jul 7, 2019 · 3 comments
Open

Error Response1011 #12

Eisei-Shimizu opened this issue Jul 7, 2019 · 3 comments

Comments

@Eisei-Shimizu
Copy link

Eisei-Shimizu commented Jul 7, 2019

    access_key = setting_data['access_key']
    secret_key = setting_data['secret_key']

    method = "POST"
    param = {
        'accessKey' : access_key,
        'amount' : 0.03,
        'nonce' : datetime.now().timestamp(),
        'price' : 0.01,
        'state' : 0,
        'symbol': 'coin-usd-btc',
        'tradeType' : 1
    }
    
    url_query = createURLQuery(Const.BITFOREX_ENDPOINT_PLACE_ORDER_PATH, param)
    
    sign_data = createSignData(secret_key, url_query)
    param["signData"] = sign_data
    data = json.dumps(param).encode("UTF-8")
    order_infos_req = urllib.request.Request(Const.BITFOREX_PLACE_ORDER_URL, data, method=method)
    order_infos_res = urllib.request.urlopen(order_infos_req)

def createURLQuery(path, param):
    url_query = path + "?"
    for key, value in sorted(param.items()):
        url_query += key + "=" + str(value) + "&"
    
    return url_query[:-1]
    
    
def createSignData(secret_key, content):
    print(content)
    return hmac.new(secret_key.encode("UTF-8"), content.encode('UTF-8'), hashlib.sha256).hexdigest()

↓placeOrder request's responce
{
"code": "1011",
"success": false,
"time": 1562501191642,
"message": "NeedParam accessKey and signData"
}

↓order_infos_req.data
b'{"accessKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "amount": 0.03, "nonce": 1562501190.60496, "price": 0.01, "state": 0, "symbol": "coin-usd-btc", "tradeType": 1, "signData": "d197ae200e7fea43c895b6a091f3a320b31956869809411ffd470e08c4984bdf"}'

Why is Error1011 returned even though both accessKey and signData are included?

@foxter51
Copy link

СДаров! Пропали токены при покупке-прожаде, че делать?

@foxter51
Copy link

Сдаров! куда мои токены попиздились? че наебать меня решил да?

@foxter51
Copy link

китайиц

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants