Doh, set sleeptime after adjusting the rate limit
parent
030ecdcce8
commit
dd5e1e7ea7
|
@ -139,14 +139,14 @@ async def poll_tickers(
|
||||||
A broker-client ``quoter`` async context manager must be provided which
|
A broker-client ``quoter`` async context manager must be provided which
|
||||||
returns an async quote function.
|
returns an async quote function.
|
||||||
"""
|
"""
|
||||||
sleeptime = round(1. / rate, 3)
|
|
||||||
_cache = {} # ticker to quote caching
|
|
||||||
|
|
||||||
broker_limit = getattr(brokermod, '_rate_limit', float('inf'))
|
broker_limit = getattr(brokermod, '_rate_limit', float('inf'))
|
||||||
if broker_limit < rate:
|
if broker_limit < rate:
|
||||||
rate = broker_limit
|
rate = broker_limit
|
||||||
log.warn(f"Limiting {brokermod.__name__} query rate to {rate}/sec")
|
log.warn(f"Limiting {brokermod.__name__} query rate to {rate}/sec")
|
||||||
|
|
||||||
|
sleeptime = round(1. / rate, 3)
|
||||||
|
_cache = {} # ticker to quote caching
|
||||||
|
|
||||||
while True: # use an event here to trigger exit?
|
while True: # use an event here to trigger exit?
|
||||||
prequote_start = time.time()
|
prequote_start = time.time()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue