Skip to content

Commit

Permalink
MarketDataRequest can parse full month names
Browse files Browse the repository at this point in the history
  • Loading branch information
saeedamen committed Jan 5, 2021
1 parent 1d789ed commit ab3ce65
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 6 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ individual data providers)

# Coding log

* 05 Jan 2020
* MarketDataRequest accepts parsing of full month names
* 28 Dec 2020
* Spun out Calendar into separate Python script
* 26 Dec 2020
Expand Down
4 changes: 2 additions & 2 deletions findatapy/conf/base_depos_tickers_list.csv
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ base-depos,bloomberg,daily,JPY1Y,NYC,close,JYDR1 CMPN Index,5:00pm NYC
base-depos,bloomberg,daily,JPY2Y,NYC,close,JYDR2 CMPN Index,5:00pm NYC
base-depos,bloomberg,daily,JPY3Y,NYC,close,JYDR3 CMPN Index,5:00pm NYC
base-depos,bloomberg,daily,JPY5Y,NYC,close,JYDR5 CMPN Index,5:00pm NYC
base-depos,bloomberg,daily,Fed Funds Effective Rate,LDN,close,FEDL01 Index,6:00pm LDN
base-depos,bloomberg,daily,USDFedEffectiveRate,LDN,close,FEDL01 Index,6:00pm LDN
base-depos,bloomberg,daily,USDON,LDN,close,USDR1T CMPL Index,6:00pm LDN
base-depos,bloomberg,daily,USDTN,LDN,close,USDR2T CMPL Index,6:00pm LDN
base-depos,bloomberg,daily,USDSN,LDN,close,USDR3T CMPL Index,6:00pm LDN
Expand Down Expand Up @@ -353,7 +353,7 @@ base-depos,bloomberg,daily,JPY1Y,LDN,close,JYDR1 CMPL Index,6:00pm LDN
base-depos,bloomberg,daily,JPY2Y,LDN,close,JYDR2 CMPL Index,6:00pm LDN
base-depos,bloomberg,daily,JPY3Y,LDN,close,JYDR3 CMPL Index,6:00pm LDN
base-depos,bloomberg,daily,JPY5Y,LDN,close,JYDR5 CMPL Index,6:00pm LDN
base-depos,bloomberg,daily,Fed Funds Effective Rate,TOK,close,FEDL01 Index,8:00pm TOK
base-depos,bloomberg,daily,USDFedEffectiveRate,TOK,close,FEDL01 Index,8:00pm TOK
base-depos,bloomberg,daily,USDON,TOK,close,USDR1T CMPT Index,8:00pm TOK
base-depos,bloomberg,daily,USDTN,TOK,close,USDR2T CMPT Index,8:00pm TOK
base-depos,bloomberg,daily,USDSN,TOK,close,USDR3T CMPT Index,8:00pm TOK
Expand Down
9 changes: 6 additions & 3 deletions findatapy/market/datavendorweb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1590,15 +1590,18 @@ def retrieve_df(self, data, symbol, epoch):
df.drop('temp', axis = 1)
df.index.name = 'Date'

# Default FX divisior
divisor = 100000.0

# where JPY is the terms currency we have different divisor
# Where JPY is the terms currency we have different divisor
if symbol[3:6] == 'JPY':
divisor = 1000.0

# special case!
if symbol == 'BRENTCMDUSD':
# Special case! You may need to add more here
elif symbol == 'BRENTCMDUSD':
divisor = 1000.0
elif len(symbol) > 6:
divisor = 1.0

# prices are returned without decimal point (need to divide)
df['bid'] = df['bid'] / divisor
Expand Down
5 changes: 4 additions & 1 deletion findatapy/market/market.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ def __init__(self, market_data_generator=None, md_request=None):
# NOT CURRENTLY IMPLEMENTED FOR FUTURE USE
from finaddpy.market import CachedMarketDataGenerator
market_data_generator = CachedMarketDataGenerator()
else:
from findatapy.market import MarketDataGenerator
market_data_generator = MarketDataGenerator()

self.speed_cache = SpeedCache()
self._market_data_generator = market_data_generator
Expand Down Expand Up @@ -804,7 +807,7 @@ def get_base_depos(self, start, end, currencies, tenor, cut="NYC", data_source="
for tn in tenor:
tickers.append(cr + tn)

# Special case for Fed Funds Effective Rate
# Special case for Fed Funds Effective Rate which we add in all instances
if 'USDFedEffectiveRate' not in tickers:
tickers.append("USDFedEffectiveRate")

Expand Down
19 changes: 19 additions & 0 deletions findatapy/market/marketdatarequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,13 @@ def date_parser(self, date):
# self.logger.warning("Attempted to parse date")
i = 0

# format expected '1 June 2005 01:33', '%d %B %Y %H:%M'
try:
date1 = datetime.datetime.strptime(date, '%d %B %Y %H:%M')
except:
# self.logger.warning("Attempted to parse date")
i = 0

try:
date1 = datetime.datetime.strptime(date, '%b %d %Y')
except:
Expand All @@ -457,6 +464,18 @@ def date_parser(self, date):
except:
# self.logger.warning("Attempted to parse date")
i = 0

try:
date1 = datetime.datetime.strptime(date, '%B %d %Y')
except:
# self.logger.warning("Attempted to parse date")
i = 0

try:
date1 = datetime.datetime.strptime(date, '%d %B %Y')
except:
# self.logger.warning("Attempted to parse date")
i = 0
else:
import pandas

Expand Down

0 comments on commit ab3ce65

Please sign in to comment.