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

Method throttle

python/ccxt/base/exchange.py:488–495  ·  view source on GitHub ↗
(self, cost=None)

Source from the content-addressed store, hash-verified

486 pass
487
488 def throttle(self, cost=None):
489 now = float(self.milliseconds())
490 elapsed = now - self.lastRestRequestTimestamp
491 cost = 1 if cost is None else cost
492 sleep_time = self.rateLimit * cost
493 if elapsed < sleep_time:
494 delay = sleep_time - elapsed
495 time.sleep(delay / 1000.0)
496
497 def read_file(self, path: str, encoding: str = 'utf-8'):
498 """

Callers 2

fetch2Method · 0.95
throttle_callFunction · 0.45

Calls 2

millisecondsMethod · 0.95
sleepMethod · 0.45

Tested by 1

throttle_callFunction · 0.36