def __init__(self): self.logger = LoggerManager().getLogger(__name__) self.DUMP_PATH = 'output_data/' + datetime.date.today().strftime("%Y%m%d") + ' ' self.SCALE_FACTOR = 3 self.DEFAULT_PLOT_ENGINE = GraphicsConstants().plotfactory_default_adapter return
def __init__(self, data_source = None, start_date = None, finish_date = None, tickers = None, category = None, freq_mult = None, freq = None, gran_freq = None, cut = None, fields = None, cache_algo = None, vendor_tickers = None, vendor_fields = None, environment = None ): self.logger = LoggerManager().getLogger(__name__) self.freq_mult = 1 if data_source is not None: self.data_source = data_source if start_date is not None: self.start_date = start_date if finish_date is not None: self.finish_date = finish_date if tickers is not None: self.tickers = tickers if category is not None: self.category = category if freq_mult is not None: self.freq_mult = freq_mult if freq is not None: self.freq = freq if cut is not None: self.cut = cut if fields is not None: self.fields = fields if cache_algo is not None: self.cache_algo = cache_algo if vendor_tickers is not None: self.vendor_tickers = vendor_tickers if vendor_fields is not None: self.vendor_fields = vendor_fields if environment is not None: self.environment = environment
def __init__(self, symbol, interval, start=None, end=None, event='TRADE'): """ Intraday bar request for bbg Parameters ---------- symbols : string interval : number of minutes start : start date end : end date (if None then use today) event : (TRADE,BID,ASK,BEST_BID,BEST_ASK) """ Request.__init__(self) self.logger = LoggerManager().getLogger(__name__) assert event in ('TRADE', 'BID', 'ASK', 'BEST_BID', 'BEST_ASK') assert isinstance(symbol, str) if start is None: start = datetime.today() - timedelta(30) if end is None: end = datetime.utcnow() self.symbol = symbol self.interval = interval self.start = to_datetime(start) self.end = to_datetime(end) self.event = event # response related self.response = defaultdict(list)
def __init__(self): self.logger = LoggerManager().getLogger(__name__) self.fxconv = FXConv() if Constants().default_time_series_factory == 'lighttimeseriesfactory': self.time_series_factory = LightTimeSeriesFactory() else: self.time_series_factory = CachedTimeSeriesFactory() return
def __init__(self): # self.config = ConfigManager() self.logger = LoggerManager().getLogger(__name__) self.time_series_filter = TimeSeriesFilter() self.time_series_io = TimeSeriesIO() self._bbg_default_api = Constants().bbg_default_api self._intraday_code = -1 return
def __init__(self): self.logger = LoggerManager().getLogger(__name__) self._all_econ_tickers = pandas.read_csv(Constants().all_econ_tickers) self._econ_country_codes = pandas.read_csv( Constants().econ_country_codes) self._econ_country_groups = pandas.read_csv( Constants().econ_country_groups) self.time_series_factory = LightTimeSeriesFactory()
def __init__(self): super(EventStudy, self).__init__() self.config = ConfigManager() self.logger = LoggerManager().getLogger(__name__) self.time_series_filter = TimeSeriesFilter() self.time_series_io = TimeSeriesIO() if (LightEventsFactory._econ_data_frame is None): self.load_economic_events() return
def __init__(self): super(StrategyTemplate, self).__init__() self.logger = LoggerManager().getLogger(__name__) ##### FILL IN WITH YOUR OWN PARAMETERS FOR display, dumping, TSF etc. self.tsfactory = LightTimeSeriesFactory() self.DUMP_CSV = 'output_data/' self.DUMP_PATH = 'output_data/' + datetime.date.today().strftime("%Y%m%d") + ' ' self.FINAL_STRATEGY = 'Thalesians FX CTA' self.SCALE_FACTOR = 3 return
def __init__(self): super(BBGLowLevelIntraday, self).__init__() self.logger = LoggerManager().getLogger(__name__) # constants self.BAR_DATA = blpapi.Name("barData") self.BAR_TICK_DATA = blpapi.Name("barTickData") self.OPEN = blpapi.Name("open") self.HIGH = blpapi.Name("high") self.LOW = blpapi.Name("low") self.CLOSE = blpapi.Name("close") self.VOLUME = blpapi.Name("volume") self.NUM_EVENTS = blpapi.Name("numEvents") self.TIME = blpapi.Name("time")
def __init__(self): super(BBGLowLevelTick, self).__init__() self.logger = LoggerManager().getLogger(__name__) # constants self.TICK_DATA = blpapi.Name("tickData") self.COND_CODE = blpapi.Name("conditionCodes") self.TICK_SIZE = blpapi.Name("size") self.TIME = blpapi.Name("time") self.TYPE = blpapi.Name("type") self.VALUE = blpapi.Name("value") self.RESPONSE_ERROR = blpapi.Name("responseError") self.CATEGORY = blpapi.Name("category") self.MESSAGE = blpapi.Name("message") self.SESSION_TERMINATED = blpapi.Name("SessionTerminated")
def __init__(self, symbols, fields, start=None, end=None, period='DAILY', addtl_sets=None, ignore_security_error=0, ignore_field_error=0): """ Historical data request for bbg. Parameters ---------- symbols : string or list fields : string or list start : start date (if None then use 1 year ago) end : end date (if None then use today) period : ('DAILY', 'WEEKLY', 'MONTHLY', 'QUARTERLY', 'SEMI-ANNUAL', 'YEARLY') ignore_field_errors : bool ignore_security_errors : bool """ Request.__init__(self, ignore_security_error=ignore_security_error, ignore_field_error=ignore_field_error) assert period in ('DAILY', 'WEEKLY', 'MONTHLY', 'QUARTERLY', 'SEMI-ANNUAL', 'YEARLY') self.symbols = isinstance(symbols, str) and [symbols] or symbols self.fields = isinstance(fields, str) and [fields] or fields if start is None: start = datetime.today() - timedelta( 365) # by default download the past year if end is None: end = datetime.today() self.start = to_datetime(start) self.end = to_datetime(end) self.period = period self.logger = LoggerManager().getLogger(__name__) # response related self.response = {}
def __init__(self, symbols, fields, overrides=None, response_type='frame', ignore_security_error=0, ignore_field_error=0): """ response_type: (frame, map) how to return the results """ assert response_type in ('frame', 'map') Request.__init__(self, ignore_security_error=ignore_security_error, ignore_field_error=ignore_field_error) self.symbols = isinstance(symbols, str) and [symbols] or symbols self.fields = isinstance(fields, str) and [fields] or fields self.overrides = overrides # response related self.response = {} if response_type == 'map' else defaultdict(list) self.response_type = response_type self.logger = LoggerManager().getLogger(__name__)
def __init__(self): super(LoaderBBGCOM, self).__init__() self.logger = LoggerManager().getLogger(__name__)
def __init__(self): self.logger = LoggerManager().getLogger(__name__) self.DUMP_PATH = 'output_data/' + datetime.date.today().strftime( "%Y%m%d") + ' ' self.scale_factor = 3 return
def __init__(self): # self.config = ConfigManager() self.logger = LoggerManager().getLogger(__name__) return
def __init__(self): self.logger = LoggerManager().getLogger(__name__) self.hist_econ_data_factory = HistEconDataFactory()
def __init__(self): super(BBGLowLevelRef, self).__init__() self.logger = LoggerManager().getLogger(__name__) self._options = []
def __init__(self): super(TimeSeriesRequest, self).__init__() self.logger = LoggerManager().getLogger(__name__) self.__signal_name = None self.__tech_params = TechParams()
def __init__(self): self.logger = LoggerManager().getLogger(__name__) self._techind = None self._signal = None
def __init__(self): self.logger = LoggerManager().getLogger(__name__) self._pnl = None self._portfolio = None return
def __init__(self, # captions title = '', x_title = '', y_title = '', units = '', # type of plot (can be defined as list) chart_type = None, # colors color = [], color_2 = [], color_2_series = [], exclude_from_color = [], # display sizes scale_factor = Constants().plotfactory_scale_factor, dpi = Constants().plotfactory_dpi, width = Constants().plotfactory_width, height = Constants().plotfactory_height, resample = None, # lines and multiple y-axis y_axis_2_series = [], linewidth_2_series = [], linewidth = None, linewidth_2 = None, marker_size = 1, line_of_best_fit = False, # labelling of sources brand_label = Constants().plotfactory_brand_label, display_brand_label = Constants().plotfactory_display_brand_label, source = Constants().plotfactory_source, source_color = 'black', display_source_label = Constants().plotfactory_display_source_label, display_legend = True, # display output silent_display = False, file_output = None, date_formatter = None, # output html_file_output = None, display_mpld3 = False, # plotly only plotly_url = None, plotly_as_image = False, plotly_username = Constants().plotly_default_username, plotly_api_key = None, plotly_world_readable = Constants().plotly_world_readable, plotly_theme = None, # plotly choropleth fields # matplotlib only style_sheet = Constants().plotfactory_default_stylesheet, convert_matplotlib_to_plotly = False ): self.logger = LoggerManager().getLogger(__name__) # captions self.title = title self.x_title = x_title self.y_title = y_title self.units = units # chart type self.chart_type = chart_type # colors self.color = color self.color_2 = color_2 self.color_2_series = color_2_series self.exclude_from_color = exclude_from_color # display sizes self.scale_factor = scale_factor self.dpi = dpi self.width = width self.height = height self.resample = resample # lines and multiple y-axis self.y_axis_2_series = y_axis_2_series self.linewidth_2_series = linewidth_2_series self.linewidth = linewidth self.linewidth_2 = linewidth_2 self.marker_size = marker_size self.line_of_best_fit = line_of_best_fit # labelling of sources self.brand_label = brand_label self.display_brand_label = display_brand_label self.source = source self.source_color = source_color self.display_source_label = display_source_label self.display_legend = display_legend # display output self.silent_display = silent_display self.file_output = file_output self.date_formatter = date_formatter # output self.html_file_output = html_file_output self.display_mpld3 = display_mpld3 # plotly only if plotly_url is None: plotly_url = title + datetime.datetime.utcnow().strftime("%b-%d-%Y-%H-%M-%S") self.plotly_url = plotly_url self.plotly_as_image = plotly_as_image self.plotly_username = plotly_username # try to get API key from constants file try: if plotly_api_key is None: plotly_api_key = Constants().plotly_creds[plotly_username] except: pass self.plotly_api_key = plotly_api_key self.plotly_world_readable = plotly_world_readable self.plotly_theme = plotly_theme # matplotlib only self.style_sheet = style_sheet self.convert_matplotlib_to_plotly = convert_matplotlib_to_plotly
def __init__(self, *args, **kwargs): self.logger = LoggerManager().getLogger(__name__)
Gives several examples of how to compute and plot correlations of assets. """ # for logging from chartesians.graphs.graphproperties import GraphProperties from chartesians.graphs.plotfactory import PlotFactory from pythalesians.market.loaders.lighttimeseriesfactory import LightTimeSeriesFactory from pythalesians.market.requests.timeseriesrequest import TimeSeriesRequest from pythalesians.timeseries.calcs.timeseriescalcs import TimeSeriesCalcs from pythalesians.util.loggermanager import LoggerManager if True: logger = LoggerManager().getLogger(__name__) import datetime # just change "False" to "True" to run any of the below examples ###### download daily data from Bloomberg for EUR/USD and GBP/USD spot, then calculate correlation if True: time_series_request = TimeSeriesRequest( start_date="01 Jan 2014", # start date finish_date=datetime.date.today(), # finish date freq='daily', # daily data data_source='bloomberg', # use Bloomberg as data source tickers=[ 'EURUSD', # ticker (Thalesians)
def __init__(self): super(LoaderPandasWeb, self).__init__() self.logger = LoggerManager().getLogger(__name__)
def __init__(self): self.logger = LoggerManager().getLogger(__name__)
def __init__(self): super(LoaderTemplate, self).__init__() self.logger = LoggerManager().getLogger(__name__) import logging logging.getLogger("requests").setLevel(logging.WARNING)