MCPcopy Create free account
hub / github.com/ccxt/ccxt / request_private

Method request_private

python/ccxt/pro/gate.py:2043–2073  ·  view source on GitHub ↗
(self, url, reqParams, channel, requestId: Str = None)

Source from the content-addressed store, hash-verified

2041 future.resolve(True)
2042
2043 async def request_private(self, url, reqParams, channel, requestId: Str = None):
2044 self.check_required_credentials()
2045 # uid is required for some subscriptions only so it's not a part of required credentials
2046 event = 'api'
2047 if requestId is None:
2048 reqId = self.request_id()
2049 requestId = str(reqId)
2050 messageHash = requestId
2051 time = self.seconds()
2052 # unfortunately, PHP demands double quotes for the escaped newline symbol
2053 signatureString = "\n".join([event, channel, self.json(reqParams), str(time)]) # eslint-disable-line quotes
2054 signature = self.hmac(self.encode(signatureString), self.encode(self.secret), hashlib.sha512, 'hex')
2055 payload = {
2056 'req_id': requestId,
2057 'timestamp': str(time),
2058 'api_key': self.apiKey,
2059 'signature': signature,
2060 'req_param': reqParams,
2061 }
2062 if (channel == 'spot.order_place') or (channel == 'futures.order_place'):
2063 payload['req_header'] = {
2064 'X-Gate-Channel-Id': 'ccxt',
2065 }
2066 request = {
2067 'id': requestId,
2068 'time': time,
2069 'channel': channel,
2070 'event': event,
2071 'payload': payload,
2072 }
2073 return await self.watch(url, messageHash, request, messageHash, requestId)
2074
2075 async def subscribe_private(self, url, messageHash, payload, channel, params, requiresUid=False):
2076 self.check_required_credentials()

Callers 8

create_order_wsMethod · 0.95
create_orders_wsMethod · 0.95
cancel_all_orders_wsMethod · 0.95
cancel_order_wsMethod · 0.95
edit_order_wsMethod · 0.95
fetch_order_wsMethod · 0.95
authenticateMethod · 0.95

Calls 7

request_idMethod · 0.95
secondsMethod · 0.45
jsonMethod · 0.45
hmacMethod · 0.45
encodeMethod · 0.45
watchMethod · 0.45

Tested by

no test coverage detected