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

Method fetch_time

python/ccxt/binance.py:2941–2965  ·  view source on GitHub ↗

fetches the current integer timestamp in milliseconds from the exchange server https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-endpoints#check-server-time # spot https://developers.binance.com/docs/derivatives/usds-margined-futures/market

(self, params={})

Source from the content-addressed store, hash-verified

2939 self.options['enableDemoTrading'] = enable
2940
2941 def fetch_time(self, params={}) -> Int:
2942 """
2943 fetches the current integer timestamp in milliseconds from the exchange server
2944
2945 https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-endpoints#check-server-time # spot
2946 https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Check-Server-Time # swap
2947 https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Check-Server-time # future
2948
2949 :param dict [params]: extra parameters specific to the exchange API endpoint
2950 :param str [params.subType]: "linear" or "inverse"
2951 :returns int: the current integer timestamp in milliseconds from the exchange server
2952 """
2953 defaultType = self.safe_string_2(self.options, 'fetchTime', 'defaultType', 'spot')
2954 type = self.safe_string(params, 'type', defaultType)
2955 query = self.omit(params, 'type')
2956 subType = None
2957 subType, params = self.handle_sub_type_and_params('fetchTime', None, params)
2958 response = None
2959 if self.is_linear(type, subType):
2960 response = self.fapiPublicGetTime(query)
2961 elif self.is_inverse(type, subType):
2962 response = self.dapiPublicGetTime(query)
2963 else:
2964 response = self.publicGetTime(query)
2965 return self.safe_integer(response, 'serverTime')
2966
2967 def fetch_currencies(self, params={}) -> Currencies:
2968 """

Callers

nothing calls this directly

Calls 10

is_linearMethod · 0.95
fapiPublicGetTimeMethod · 0.95
is_inverseMethod · 0.95
dapiPublicGetTimeMethod · 0.95
publicGetTimeMethod · 0.95
safe_string_2Method · 0.80
safe_stringMethod · 0.80
safe_integerMethod · 0.80
omitMethod · 0.45

Tested by

no test coverage detected