diff --git a/metrik/__init__.py b/metrik/__init__.py index ba0e4af..fa7fdae 100644 --- a/metrik/__init__.py +++ b/metrik/__init__.py @@ -1,2 +1,2 @@ -__version__ = '0.4.2' +__version__ = '0.5.0' __release__ = __version__ \ No newline at end of file diff --git a/metrik/flows/options_flow.py b/metrik/flows/options_flow.py new file mode 100644 index 0000000..1644cf7 --- /dev/null +++ b/metrik/flows/options_flow.py @@ -0,0 +1,23 @@ +from metrik.flows.base import Flow, MarketClose +from metrik.conf import get_config +from metrik.tasks.cboe import CboeOptionableList +from metrik.tasks.tradeking import TradekingOptionsQuotes + +class EquitiesFlow(Flow): + def __init__(self, *args, **kwargs): + super(EquitiesFlow, self).__init__(*args, **kwargs) + + @staticmethod + def get_schedule(): + return MarketClose() + + def _run(self): + optionable = CboeOptionableList(current_datetime=self.present, + live=self.live) + yield optionable + + options_quotes = [TradekingOptionsQuotes(symbol=s, + current_datetime=self.present, + live=self.live) + for s in optionable.output().retrieve()['companies']] + yield options_quotes \ No newline at end of file diff --git a/metrik/tasks/tradeking.py b/metrik/tasks/tradeking.py index ba361a4..1e7b227 100644 --- a/metrik/tasks/tradeking.py +++ b/metrik/tasks/tradeking.py @@ -134,7 +134,6 @@ class TradekingOptionsQuotes(MongoNoBackCreateTask): if not chain_acquire: return {} - chain = TradekingOptionsQuotes.retrieve_chain_syms(api, symbol) results = [] for b in batch(chain, TradekingOptionsQuotes.batch_size): @@ -147,4 +146,4 @@ class TradekingOptionsQuotes(MongoNoBackCreateTask): batch_results = TradekingOptionsQuotes.retrieve_quotes(api, b) results += batch_results - return results + return {'symbol': symbol, 'chain': results}