mirror of
https://github.com/bspeice/metrik
synced 2025-08-03 06:04:47 -04:00
Can now fetch LIBOR data correctly
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
from luigi.task import Task
|
||||
from luigi.parameter import DateParameter, Parameter
|
||||
# noinspection PyUnresolvedReferences
|
||||
from six.moves.urllib.parse import quote_plus
|
||||
import pytz
|
||||
@ -9,6 +10,8 @@ import csv
|
||||
from io import StringIO
|
||||
from dateutil.parser import parse
|
||||
|
||||
from metrik.targets.mongo_target import MongoTarget
|
||||
|
||||
|
||||
LiborRate = namedtuple('LiborRate', [
|
||||
'publication', 'overnight', 'one_week', 'one_month', 'two_month',
|
||||
@ -18,6 +21,16 @@ LiborRate = namedtuple('LiborRate', [
|
||||
|
||||
class LiborRateTask(Task):
|
||||
|
||||
date = DateParameter()
|
||||
currency = Parameter()
|
||||
|
||||
def output(self):
|
||||
return MongoTarget('libor', hash(self.task_id))
|
||||
|
||||
def run(self):
|
||||
libor_record = self.retrieve_data(self.date, self.currency)
|
||||
self.output().persist(libor_record._asdict())
|
||||
|
||||
@staticmethod
|
||||
def retrieve_data(date, currency):
|
||||
url = ('https://www.theice.com/marketdata/reports/icebenchmarkadmin/'
|
||||
|
Reference in New Issue
Block a user