Docstring tweaks
parent
ffd8bdac5f
commit
a7f7de32b4
|
@ -90,7 +90,7 @@ async def stream_requests(
|
||||||
"""Stream requests for quotes for a set of symbols at the given
|
"""Stream requests for quotes for a set of symbols at the given
|
||||||
``rate`` (per second).
|
``rate`` (per second).
|
||||||
|
|
||||||
A stock-broker client ``get_quotes()`` async context manager must be
|
A stock-broker client ``get_quotes()`` async function must be
|
||||||
provided which returns an async quote retrieval function.
|
provided which returns an async quote retrieval function.
|
||||||
"""
|
"""
|
||||||
broker_limit = getattr(feed.mod, '_rate_limit', float('inf'))
|
broker_limit = getattr(feed.mod, '_rate_limit', float('inf'))
|
||||||
|
@ -268,7 +268,7 @@ async def start_quote_stream(
|
||||||
|
|
||||||
Spawns new quoter tasks for each broker backend on-demand.
|
Spawns new quoter tasks for each broker backend on-demand.
|
||||||
Since most brokers seems to support batch quote requests we
|
Since most brokers seems to support batch quote requests we
|
||||||
limit to one task per process for now.
|
limit to one task per process (for now).
|
||||||
"""
|
"""
|
||||||
# XXX: why do we need this again?
|
# XXX: why do we need this again?
|
||||||
get_console_log(tractor.current_actor().loglevel)
|
get_console_log(tractor.current_actor().loglevel)
|
||||||
|
@ -313,7 +313,7 @@ async def start_quote_stream(
|
||||||
|
|
||||||
await stream_requests(
|
await stream_requests(
|
||||||
|
|
||||||
# pub required kwargs
|
# ``msg.pub`` required kwargs
|
||||||
task_name=feed_type,
|
task_name=feed_type,
|
||||||
ctx=ctx,
|
ctx=ctx,
|
||||||
topics=symbols,
|
topics=symbols,
|
||||||
|
@ -358,7 +358,7 @@ class DataFeed:
|
||||||
feed_type: str,
|
feed_type: str,
|
||||||
rate: int = 1,
|
rate: int = 1,
|
||||||
diff_cached: bool = True,
|
diff_cached: bool = True,
|
||||||
test: bool = None,
|
test: str = '',
|
||||||
) -> (AsyncGenerator, dict):
|
) -> (AsyncGenerator, dict):
|
||||||
if feed_type not in self._allowed:
|
if feed_type not in self._allowed:
|
||||||
raise ValueError(f"Only feed types {self._allowed} are supported")
|
raise ValueError(f"Only feed types {self._allowed} are supported")
|
||||||
|
@ -416,6 +416,8 @@ class DataFeed:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def format_quotes(self, quotes, symbol_data={}):
|
def format_quotes(self, quotes, symbol_data={}):
|
||||||
|
"""Format ``quotes`` using broker defined formatter.
|
||||||
|
"""
|
||||||
self._symbol_data_cache.update(symbol_data)
|
self._symbol_data_cache.update(symbol_data)
|
||||||
formatter = getattr(self.brokermod, f'format_{self._quote_type}_quote')
|
formatter = getattr(self.brokermod, f'format_{self._quote_type}_quote')
|
||||||
records, displayables = zip(*[
|
records, displayables = zip(*[
|
||||||
|
@ -449,7 +451,7 @@ async def stream_to_file(
|
||||||
# an async generator instance
|
# an async generator instance
|
||||||
agen = await portal.run(
|
agen = await portal.run(
|
||||||
"piker.brokers.data", 'start_quote_stream',
|
"piker.brokers.data", 'start_quote_stream',
|
||||||
broker=brokermod.name, tickers=tickers)
|
broker=brokermod.name, symbols=tickers)
|
||||||
|
|
||||||
fname = filename or f'{watchlist_name}.jsonstream'
|
fname = filename or f'{watchlist_name}.jsonstream'
|
||||||
with open(fname, 'a') as f:
|
with open(fname, 'a') as f:
|
||||||
|
|
Loading…
Reference in New Issue