1
0
mirror of https://github.com/bspeice/metrik synced 2025-08-03 06:04:47 -04:00

Get command-line tools up and running

I now have something that actually gets stuff done.
This commit is contained in:
Bradlee Speice
2016-08-22 21:34:54 -04:00
parent 96c503a106
commit f2390ba34f
12 changed files with 173 additions and 31 deletions

View File

@ -11,6 +11,7 @@ from luigi.parameter import DateParameter, Parameter
from six.moves.urllib.parse import quote_plus
from metrik.tasks.base import MongoCreateTask
from metrik.trading_days import TradingDay
LiborRate = namedtuple('LiborRate', [
'publication', 'overnight', 'one_week', 'one_month', 'two_month',
@ -27,7 +28,7 @@ class LiborRateTask(MongoCreateTask):
return 'libor'
@staticmethod
def retrieve_data(date, currency):
def retrieve_historical_libor(date, currency):
url = ('https://www.theice.com/marketdata/reports/icebenchmarkadmin/'
'ICELiborHistoricalRates.shtml?excelExport='
'&criteria.reportDate={}&criteria.currencyCode={}').format(
@ -80,3 +81,12 @@ class LiborRateTask(MongoCreateTask):
'six_month': six_month,
'one_year': one_year
}
@staticmethod
def retrieve_data(date, currency):
# ICE publish data a day late, so we actually need to retrieve data
# for the trading day prior to this.
return LiborRateTask.retrieve_historical_libor(
date - TradingDay(1),
currency
)