(self, path, section='public', method='GET', params={}, headers: dict = None, body: Any = None)
| 2744 | return self.milliseconds() |
| 2745 | |
| 2746 | def sign(self, path, section='public', method='GET', params={}, headers: dict = None, body: Any = None): |
| 2747 | version = section[0] |
| 2748 | access = section[1] |
| 2749 | pathWithParams = self.implode_params(path, params) |
| 2750 | url = self.urls['api'][access] + '/' + version + '/' |
| 2751 | params = self.omit(params, self.extract_params(path)) |
| 2752 | params = self.keysort(params) |
| 2753 | if access == 'public': |
| 2754 | url += pathWithParams |
| 2755 | if params: |
| 2756 | url += '?' + self.urlencode(params) |
| 2757 | else: |
| 2758 | self.check_required_credentials() |
| 2759 | isPostOrPut = method == 'POST' or method == 'PUT' |
| 2760 | isOrder = path == 'algo/order' or path == 'order' or path == 'batch-order' |
| 2761 | if isPostOrPut and isOrder: |
| 2762 | isSandboxMode = self.safe_bool(self.options, 'sandboxMode', False) |
| 2763 | if not isSandboxMode: |
| 2764 | brokerId = self.safe_string(self.options, 'brokerId', 'CCXTMODE') |
| 2765 | if path == 'batch-order': |
| 2766 | ordersList = self.safe_list(params, 'orders', []) |
| 2767 | for i in range(0, len(ordersList)): |
| 2768 | params['orders'][i]['order_tag'] = brokerId |
| 2769 | else: |
| 2770 | params['order_tag'] = brokerId |
| 2771 | params = self.keysort(params) |
| 2772 | auth = '' |
| 2773 | ts = str(self.nonce()) |
| 2774 | url += pathWithParams |
| 2775 | apiKey = self.apiKey |
| 2776 | if apiKey.find('ed25519:') < 0: |
| 2777 | apiKey = 'ed25519:' + apiKey |
| 2778 | headers = { |
| 2779 | 'orderly-account-id': self.accountId, |
| 2780 | 'orderly-key': apiKey, |
| 2781 | 'orderly-timestamp': ts, |
| 2782 | } |
| 2783 | auth = ts + method + '/' + version + '/' + pathWithParams |
| 2784 | if method == 'POST' or method == 'PUT': |
| 2785 | body = self.json(params) |
| 2786 | auth += body |
| 2787 | headers['content-type'] = 'application/json' |
| 2788 | else: |
| 2789 | if params: |
| 2790 | url += '?' + self.urlencode(params) |
| 2791 | auth += '?' + self.rawencode(params) |
| 2792 | headers['content-type'] = 'application/x-www-form-urlencoded' |
| 2793 | if method == 'DELETE': |
| 2794 | body = '' |
| 2795 | secret = self.secret |
| 2796 | if secret.find('ed25519:') >= 0: |
| 2797 | parts = secret.split('ed25519:') |
| 2798 | secret = parts[1] |
| 2799 | signature = self.eddsa(self.encode(auth), self.base58_to_binary(secret), 'ed25519') |
| 2800 | headers['orderly-signature'] = self.urlencode_base64(self.base64_to_binary(signature)) |
| 2801 | return {'url': url, 'method': method, 'body': body, 'headers': headers} |
| 2802 | |
| 2803 | def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody): |
nothing calls this directly
no test coverage detected