Jump to content
Lordaster

Прошу помощи с API Poloniex python3

Recommended Posts

Добрый день!

Пытаюсь отправить запрос в следующем виде

def NewOrder(currencyPair, rate, amount, OrderType):
    nonce = int(time.time() * 10000)
    parms = {"nonce": nonce,
             "command": OrderType,
             "currencyPair": currencyPair,
             "rate": rate,
             "amount": amount}

    parms = urllib.parse.urlencode(parms)
    parms = parms.encode('utf-8')
    api_secret = b'api_secret'
    sign = hmac.new(api_secret, parms, hashlib.sha512).hexdigest()

    headers = {"Key": api_key,
               "Sign": sign,
              }
    
    public = requests.post('https://poloniex.com/tradingApi', headers)    
    TempOrder = json.loads(public.text)

на выходе получаю "{'error': 'Invalid API key/secret pair.'}"

API ключи верные. Наверное как-то неправильно шифрую sign? Не пойму никак в чем дело. Помогите, пожалуйста.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...