mirror of
https://github.com/bspeice/metrik
synced 2024-11-23 07:38:09 -05:00
Add NASDAQ processing
This commit is contained in:
parent
49953e9da4
commit
d1d58a1bd7
@ -1,2 +1,2 @@
|
||||
__version__ = '0.1.2'
|
||||
__version__ = '0.2.0'
|
||||
__release__ = __version__
|
@ -11,8 +11,8 @@ flows = {
|
||||
}
|
||||
|
||||
|
||||
def run_flow(flow_class, present):
|
||||
build([flow_class(present=present)])
|
||||
def run_flow(flow_class, present, live):
|
||||
build([flow_class(present=present, live=live)])
|
||||
|
||||
|
||||
def build_cron_file():
|
||||
@ -30,10 +30,11 @@ def build_cron_file():
|
||||
|
||||
|
||||
def list_flows():
|
||||
return "Avaiable:\n\t" + "\n\t".join(flows.keys())
|
||||
return "Available:\n\t" + "\n\t".join(flows.keys())
|
||||
|
||||
|
||||
def handle_commandline():
|
||||
present_moment = datetime.now()
|
||||
parser = ArgumentParser(description='Capture ALL THE DATA off the Internet.')
|
||||
parser.add_argument('-c', '--cron', dest='cron', action='store_true',
|
||||
help='Build the cron file used to schedule'
|
||||
@ -41,7 +42,7 @@ def handle_commandline():
|
||||
parser.add_argument('-d', '--date', dest='present',
|
||||
help='Run a flow as if it was this time '
|
||||
'(default: %(default)s).',
|
||||
default=datetime.now())
|
||||
default=present_moment)
|
||||
parser.add_argument('-f', '--flow', dest='flow', help='The flow to be run')
|
||||
parser.add_argument('-l', '--list-flows', dest='list', action='store_true',
|
||||
help='List all available flows to be run.')
|
||||
@ -53,9 +54,9 @@ def handle_commandline():
|
||||
print(list_flows())
|
||||
elif args.flow:
|
||||
if type(args.present) is datetime:
|
||||
run_flow(flows[args.flow], args.present)
|
||||
run_flow(flows[args.flow], args.present, True)
|
||||
else:
|
||||
run_flow(flows[args.flow], parse(args.present))
|
||||
run_flow(flows[args.flow], parse(args.present), False)
|
||||
else:
|
||||
print("No actions specified, exiting.")
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
from luigi.task import WrapperTask
|
||||
from luigi.parameter import DateMinuteParameter
|
||||
from luigi.parameter import DateMinuteParameter, BoolParameter
|
||||
import pandas as pd
|
||||
|
||||
from metrik.trading_days import is_trading_day
|
||||
@ -7,6 +7,7 @@ from metrik.trading_days import is_trading_day
|
||||
|
||||
class Flow(WrapperTask):
|
||||
present = DateMinuteParameter()
|
||||
live = BoolParameter()
|
||||
|
||||
def __init__(self, force=False, *args, **kwargs):
|
||||
super(Flow, self).__init__(*args, **kwargs)
|
||||
|
13
metrik/flows/equities_flow.py
Normal file
13
metrik/flows/equities_flow.py
Normal file
@ -0,0 +1,13 @@
|
||||
from metrik.flows.base import Flow, MarketClose
|
||||
from metrik.tasks.nasdaq import NasdaqETFList, NasdaqCompanyList
|
||||
|
||||
|
||||
class EquitiesFlow(Flow):
|
||||
@staticmethod
|
||||
def get_schedule():
|
||||
MarketClose()
|
||||
|
||||
def _requires(self):
|
||||
return [NasdaqETFList(current_datetime=self.present, live=self.live),
|
||||
NasdaqCompanyList(current_datetime=self.present,
|
||||
live=self.live)]
|
Loading…
Reference in New Issue
Block a user