Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

Commit

Permalink
moved 'api' suffix to endpoint and into signed message for private ca…
Browse files Browse the repository at this point in the history
…lls #115
  • Loading branch information
nlsdfnbch committed Dec 7, 2017
1 parent 5b78455 commit e9c79c4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions bitex/api/REST/hitbtc.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

class HitBTCREST(APIClient):
def __init__(self, key=None, secret=None, api_version='1',
url='http://api.hitbtc.com/api/', timeout=5):
url='http://api.hitbtc.com/', timeout=5):
api_version = '' if not api_version else api_version
super(HitBTCREST, self).__init__(url, api_version=api_version,
key=key, secret=secret,
Expand All @@ -32,7 +32,7 @@ def sign(self, uri, endpoint, endpoint_path, method_verb, *args, **kwargs):
nonce = self.nonce()
params['nonce'] = nonce
params['apikey'] = self.key
msg = endpoint_path + '?' + urllib.parse.urlencode(params)
msg = 'api' + endpoint_path + '?' + urllib.parse.urlencode(params)

signature = hmac.new(self.secret.encode(encoding='utf-8'),
msg.encode(encoding='utf-8'), hashlib.sha512).hexdigest()
Expand Down
8 changes: 4 additions & 4 deletions bitex/interfaces/hitbtc.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,20 @@ def private_query(self, endpoint, method_verb=None, **kwargs):
@return_api_response(fmt.order_book)
def order_book(self, pair, **kwargs):
q = kwargs
return self.public_query('%s/orderbook' % pair, params=q)
return self.public_query('api/%s/orderbook' % pair, params=q)

@return_api_response(fmt.ticker)
def ticker(self, pair, **kwargs):
q = kwargs
if pair == 'all':
return self.public_query('ticker', params=q)
return self.public_query('api/ticker', params=q)
else:
return self.public_query('%s/ticker' % pair, params=q)
return self.public_query('api/%s/ticker' % pair, params=q)

@return_api_response(fmt.trades)
def trades(self, pair, **kwargs):
q = kwargs
return self.public_query('%s/trades' % pair, params=q)
return self.public_query('api/%s/trades' % pair, params=q)

def _place_order(self, pair, size, price, side, order_id, **kwargs):
q = {'symbol': pair, 'price': price, 'quantity': size, 'side': side,
Expand Down

0 comments on commit e9c79c4

Please sign in to comment.