(self, path, api: Any = 'public', method='GET', params={}, headers: dict = None, body: Str = None)
| 4413 | return tiers |
| 4414 | |
| 4415 | def sign(self, path, api: Any = 'public', method='GET', params={}, headers: dict = None, body: Str = None): |
| 4416 | query = self.omit(params, self.extract_params(path)) |
| 4417 | requestPath = '/' + self.implode_params(path, params) |
| 4418 | url = requestPath |
| 4419 | queryString = '' |
| 4420 | if (method == 'GET') or (method == 'DELETE') or (method == 'PUT') or (url == '/positions/assign'): |
| 4421 | if query: |
| 4422 | queryString = self.urlencode_with_array_repeat(query) |
| 4423 | url += '?' + queryString |
| 4424 | if api == 'private': |
| 4425 | self.check_required_credentials() |
| 4426 | timestamp = self.seconds() |
| 4427 | xPhemexRequestExpiry = self.safe_integer(self.options, 'x-phemex-request-expiry', 60) |
| 4428 | expiry = self.sum(timestamp, xPhemexRequestExpiry) |
| 4429 | expiryString = str(expiry) |
| 4430 | headers = { |
| 4431 | 'x-phemex-access-token': self.apiKey, |
| 4432 | 'x-phemex-request-expiry': expiryString, |
| 4433 | } |
| 4434 | payload = '' |
| 4435 | if method == 'POST': |
| 4436 | isOrderPlacement = (path == 'g-orders') or (path == 'spot/orders') or (path == 'orders') |
| 4437 | if isOrderPlacement: |
| 4438 | if self.safe_string(params, 'clOrdID') is None: |
| 4439 | id = self.safe_string(self.options, 'brokerId', 'CCXT123456') |
| 4440 | params['clOrdID'] = id + self.uuid16() |
| 4441 | payload = self.json(params) |
| 4442 | body = payload |
| 4443 | headers['Content-Type'] = 'application/json' |
| 4444 | auth = requestPath + queryString + expiryString + payload |
| 4445 | headers['x-phemex-request-signature'] = self.hmac(self.encode(auth), self.encode(self.secret), hashlib.sha256) |
| 4446 | url = self.implode_hostname(self.urls['api'][api]) + url |
| 4447 | return {'url': url, 'method': method, 'body': body, 'headers': headers} |
| 4448 | |
| 4449 | def set_leverage(self, leverage: int, symbol: Str = None, params={}): |
| 4450 | """ |
nothing calls this directly
no test coverage detected