1
0
mirror of https://github.com/bspeice/metrik synced 2024-11-23 07:38:09 -05:00

Add a flow for options quotes

This commit is contained in:
bspeice 2016-11-24 18:33:52 -05:00
parent 6fc85653cb
commit a8871af4e7
3 changed files with 25 additions and 3 deletions

View File

@ -1,2 +1,2 @@
__version__ = '0.4.2'
__version__ = '0.5.0'
__release__ = __version__

View File

@ -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

View File

@ -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}