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

Method parse_date

python/ccxt/base/exchange.py:1323–1336  ·  view source on GitHub ↗
(timestamp=None)

Source from the content-addressed store, hash-verified

1321
1322 @staticmethod
1323 def parse_date(timestamp=None):
1324 if timestamp is None:
1325 return None
1326 if not isinstance(timestamp, str):
1327 return None
1328 if 'GMT' in timestamp:
1329 try:
1330 parsed = parsedate(timestamp)
1331 if parsed is None:
1332 return None
1333 return calendar.timegm(parsed[:6]) * 1000
1334 except (TypeError, OverflowError, OSError):
1335 return None
1336 return Exchange.parse8601(timestamp)
1337
1338 _PARSE8601_ISO8601_PATTERN = re.compile(
1339 r'([0-9]{4})-?([0-9]{2})-?([0-9]{2})(?:T|[\s])?'

Callers 11

test_parse_dateFunction · 0.95
parse_tickerMethod · 0.80
parse_tradeMethod · 0.80
parse_orderMethod · 0.80
parse_transactionMethod · 0.80
parse_transferMethod · 0.80
parse_tickerMethod · 0.80
parse_tradeMethod · 0.80
parse_orderMethod · 0.80
parse_transactionMethod · 0.80
parse_transferMethod · 0.80

Calls 1

parse8601Method · 0.45

Tested by 1

test_parse_dateFunction · 0.76