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

Method fetch_time

python/ccxt/coinbase.py:519–554  ·  view source on GitHub ↗

fetches the current integer timestamp in milliseconds from the exchange server https://docs.cdp.coinbase.com/coinbase-app/track-apis/time https://docs.cdp.coinbase.com/api-reference/advanced-trade-api/rest-api/public/get-server-time :param dict [params]: extra para

(self, params={})

Source from the content-addressed store, hash-verified

517 })
518
519 def fetch_time(self, params={}) -> Int:
520 """
521 fetches the current integer timestamp in milliseconds from the exchange server
522
523 https://docs.cdp.coinbase.com/coinbase-app/track-apis/time
524 https://docs.cdp.coinbase.com/api-reference/advanced-trade-api/rest-api/public/get-server-time
525
526 :param dict [params]: extra parameters specific to the exchange API endpoint
527 :param str [params.method]: 'v2PublicGetTime' or 'v3PublicGetBrokerageTime' default is 'v2PublicGetTime'
528 :returns int: the current integer timestamp in milliseconds from the exchange server
529 """
530 defaultMethod = self.safe_string(self.options, 'fetchTime', 'v2PublicGetTime')
531 method = self.safe_string(params, 'method', defaultMethod)
532 params = self.omit(params, 'method')
533 response = None
534 if method == 'v2PublicGetTime':
535 response = self.v2PublicGetTime(params)
536 #
537 # {
538 # "data": {
539 # "epoch": 1589295679,
540 # "iso": "2020-05-12T15:01:19Z"
541 # }
542 # }
543 #
544 response = self.safe_dict(response, 'data', {})
545 else:
546 response = self.v3PublicGetBrokerageTime(params)
547 #
548 # {
549 # "iso": "2024-02-27T03:37:14Z",
550 # "epochSeconds": "1709005034",
551 # "epochMillis": "1709005034333"
552 # }
553 #
554 return self.safe_timestamp_2(response, 'epoch', 'epochSeconds')
555
556 def fetch_accounts(self, params={}) -> List[Account]:
557 """

Callers

nothing calls this directly

Calls 6

safe_stringMethod · 0.80
safe_dictMethod · 0.80
safe_timestamp_2Method · 0.80
v2PublicGetTimeMethod · 0.65
omitMethod · 0.45

Tested by

no test coverage detected