Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from datetime import timedelta
import numpy
from finmarketpy.util.marketconstants import MarketConstants
from findatapy.market import IOEngine
from findatapy.util import ConfigManager
from findatapy.market import SpeedCache
try:
from numbapro import autojit
except: pass
marketconstants = MarketConstants()
class EventsFactory(EventStudy):
"""Provides methods to fetch data on economic data events and to perform basic event studies for market data around
these events. Note, requires a file of input of the following (transposed as columns!) - we give an example for
NFP released on 7 Feb 2003 (note, that release-date-time-full, need not be fully aligned by row).
USD-US Employees on Nonfarm Payrolls Total MoM Net Change SA.Date 31/01/2003 00:00
USD-US Employees on Nonfarm Payrolls Total MoM Net Change SA.close xyz
USD-US Employees on Nonfarm Payrolls Total MoM Net Change SA.actual-release 143
USD-US Employees on Nonfarm Payrolls Total MoM Net Change SA.survey-median xyz
USD-US Employees on Nonfarm Payrolls Total MoM Net Change SA.survey-average xyz
USD-US Employees on Nonfarm Payrolls Total MoM Net Change SA.survey-high xyz
USD-US Employees on Nonfarm Payrolls Total MoM Net Change SA.survey-low xyz
USD-US Employees on Nonfarm Payrolls Total MoM Net Change SA.survey-high.1 xyz
USD-US Employees on Nonfarm Payrolls Total MoM Net Change SA.number-observations xyz
USD-US Employees on Nonfarm Payrolls Total MoM Net Change SA.first-revision 185
USD-US Employees on Nonfarm Payrolls Total MoM Net Change SA.first-revision-date 20030307
USD-US Employees on Nonfarm Payrolls Total MoM Net Change SA.release-dt 20030207
def __init__(self, df = None):
super(EventStudy, self).__init__()
self.config = ConfigManager()
self.logger = LoggerManager().getLogger(__name__)
self.filter = Filter()
self.io_engine = IOEngine()
self.speed_cache = SpeedCache()
if df is not None:
self._econ_data_frame = df
else:
self.load_economic_events()
return