Bitcoin Forum
June 14, 2024, 04:20:16 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: bittrex api v3 issues  (Read 145 times)
mtm18 (OP)
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
April 07, 2019, 10:31:37 AM
 #1

Hi guys,
I made a bot in Python 2.7 on windows 10, for bittrex api v2. version 2 because of the necessity to use immediate_or_cancel.
now they dropped v2, and added version 3, but for some reason I cannot get the authentication procedure correct, can anybody help me with this?
I am a high-volume trader(so bittrex support was quite quick to try and help out), but even in this case, Bittrex support couldn't help me(because he could only copy/paste it seemed, and was using python 3.7).
examples are very welcome, of course without any personal info Wink
my code looks along the lines of this:

           if self.api_version == "v3":
                request_url = https://api.bittrex.com/v3/balances
                Timestamp = str(int(time.time() * 1000))
                Method = "GET"
                Content = ""
                ContentHash = hashlib.sha512(Content.encode()).hexdigest()
                print ContentHash
                Array = [Timestamp, request_url, Method, ContentHash]
                S = ""
                PreSign = S.join(str(v) for v in Array)
                print PreSign
                Signature = hmac.new(self.api_secret.encode(),
                                     PreSign.encode(),
                                     hashlib.sha512).hexdigest()
                Header = {
                    'Accept':'application/json',
                    'Api-Key':self.api_key,
                    'Api-Timestamp':Timestamp,
                    'Api-Content-Hash':ContentHash,
                    'Api-Signature':Signature,
                    'Content-Type':'application/json'
                    }
                return requests.get(request_url, data = Content, headers = Header, timeout=10).json()


please don't take notice of indentation, that is not the problem.
It gives an error on the last line, saying: ValueError: No JSON object could be decoded. So this must mean that my authentication is not working for some reason
any help will be very appreciated, so don't forget to leave an altcoin address in case it might solve my problem, and I wish to be thankfull!
If I just print the outcome of the URl sent, then I get <error 403>
jovana-btc
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
June 11, 2019, 05:15:17 PM
 #2

Hay,

Did you solve this already? I was also working on the new API.
I think your problem is on this line:

```
Array = [Timestamp, request_url, Method, ContentHash]
```

I have have solved this on simplify this part to make one string of it:

```
timestamp + url + method + contentHash + subaccountId
```

Let me know, I could share my class if you like.

Jo
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!