def get_data_vendor(self, source): """Loads appropriate data service class Parameters ---------- source : str the data service to use "bloomberg", "quandl", "yahoo", "google", "fred" etc. we can also have forms like "bloomberg-boe" separated by hyphens Returns ------- DataVendor """ data_vendor = None try: source = source.split("-")[0] except: self.logger.error("Was data source specified?") return None if source == 'bloomberg': from findatapy.market.datavendorbbg import DataVendorBBGOpen data_vendor = DataVendorBBGOpen() elif source == 'quandl': from findatapy.market.datavendorweb import DataVendorQuandl data_vendor = DataVendorQuandl() elif source == 'ons': from findatapy.market.datavendorweb import DataVendorONS data_vendor = DataVendorONS() elif source == 'boe': from findatapy.market.datavendorweb import DataVendorBOE data_vendor = DataVendorBOE() elif source == 'dukascopy': from findatapy.market.datavendorweb import DataVendorDukasCopy data_vendor = DataVendorDukasCopy() elif source == 'fxcm': from findatapy.market.datavendorweb import DataVendorFXCM data_vendor = DataVendorFXCM() elif source == 'alfred': from findatapy.market.datavendorweb import DataVendorALFRED data_vendor = DataVendorALFRED() elif source in [ 'yahoo', 'google', 'fred', 'oecd', 'eurostat', 'edgar-index' ]: from findatapy.market.datavendorweb import DataVendorPandasWeb data_vendor = DataVendorPandasWeb() # TODO add support for other data sources (like Reuters) return data_vendor
def get_data_vendor(self, source): """Loads appropriate data service class Parameters ---------- source : str the data service to use "bloomberg", "quandl", "yahoo", "google", "fred" etc. we can also have forms like "bloomberg-boe" separated by hyphens Returns ------- DataVendor """ data_vendor = None try: source = source.split("-")[0] except: self.logger.error("Was data source specified?") return None if source == 'bloomberg': try: from findatapy.market.datavendorbbg import DataVendorBBGOpen data_vendor = DataVendorBBGOpen() except: self.logger.warn("Bloomberg needs to be installed") elif source == 'quandl': from findatapy.market.datavendorweb import DataVendorQuandl data_vendor = DataVendorQuandl() elif source == 'ons': from findatapy.market.datavendorweb import DataVendorONS data_vendor = DataVendorONS() elif source == 'boe': from findatapy.market.datavendorweb import DataVendorBOE data_vendor = DataVendorBOE() elif source == 'dukascopy': from findatapy.market.datavendorweb import DataVendorDukasCopy data_vendor = DataVendorDukasCopy() elif source == 'fxcm': from findatapy.market.datavendorweb import DataVendorFXCM data_vendor = DataVendorFXCM() elif source == 'alfred': from findatapy.market.datavendorweb import DataVendorALFRED data_vendor = DataVendorALFRED() elif source == 'yahoo': from findatapy.market.datavendorweb import DataVendorYahoo data_vendor = DataVendorYahoo() elif source in ['google', 'fred', 'oecd', 'eurostat', 'edgar-index']: from findatapy.market.datavendorweb import DataVendorPandasWeb data_vendor = DataVendorPandasWeb() elif source == 'bitcoincharts': from findatapy.market.datavendorweb import DataVendorBitcoincharts data_vendor = DataVendorBitcoincharts() elif source == 'poloniex': from findatapy.market.datavendorweb import DataVendorPoloniex data_vendor = DataVendorPoloniex() elif source == 'binance': from findatapy.market.datavendorweb import DataVendorBinance data_vendor = DataVendorBinance() elif source == 'bitfinex': from findatapy.market.datavendorweb import DataVendorBitfinex data_vendor = DataVendorBitfinex() elif source == 'gdax': from findatapy.market.datavendorweb import DataVendorGdax data_vendor = DataVendorGdax() elif source == 'kraken': from findatapy.market.datavendorweb import DataVendorKraken data_vendor = DataVendorKraken() elif source == 'bitmex': from findatapy.market.datavendorweb import DataVendorBitmex data_vendor = DataVendorBitmex() elif '.csv' in source or '.h5' in source: from findatapy.market.datavendorweb import DataVendorFlatFile data_vendor = DataVendorFlatFile() elif source == 'alphavantage': from findatapy.market.datavendorweb import DataVendorAlphaVantage data_vendor = DataVendorAlphaVantage() elif source == 'huobi': from findatapy.market.datavendorweb import DataVendorHuobi data_vendor = DataVendorHuobi() # TODO add support for other data sources (like Reuters) return data_vendor
def get_data_vendor(self, md_request): """Loads appropriate data vendor class Parameters ---------- md_request : MarketDataRequest the data_source to use "bloomberg", "quandl", "yahoo", "google", "fred" etc. we can also have forms like "bloomberg-boe" separated by hyphens Returns ------- DataVendor """ logger = LoggerManager().getLogger(__name__) data_source = md_request.data_source data_engine = md_request.data_engine # Special case for files (csv, h5, parquet or zip) if ".csv" in str(data_source) or ".h5" in str(data_source) or \ ".parquet" in str(data_source) or ".zip" in str(data_source) \ or data_engine is not None: from findatapy.market.datavendorweb import DataVendorFlatFile data_vendor = DataVendorFlatFile() else: try: data_source = data_source.split("-")[0] except: logger.error("Was data data_source specified?") return None if data_source == "bloomberg": try: from findatapy.market.datavendorbbg import \ DataVendorBBGOpen data_vendor = DataVendorBBGOpen() except: logger.warn("Bloomberg needs to be installed") elif data_source == "quandl": from findatapy.market.datavendorweb import DataVendorQuandl data_vendor = DataVendorQuandl() elif data_source == "eikon": from findatapy.market.datavendorweb import DataVendorEikon data_vendor = DataVendorEikon() elif data_source == "ons": from findatapy.market.datavendorweb import DataVendorONS data_vendor = DataVendorONS() elif data_source == "boe": from findatapy.market.datavendorweb import DataVendorBOE data_vendor = DataVendorBOE() elif data_source == "dukascopy": from findatapy.market.datavendorweb import DataVendorDukasCopy data_vendor = DataVendorDukasCopy() elif data_source == "fxcm": from findatapy.market.datavendorweb import DataVendorFXCM data_vendor = DataVendorFXCM() elif data_source == "alfred": from findatapy.market.datavendorweb import DataVendorALFRED data_vendor = DataVendorALFRED() elif data_source == "yahoo": from findatapy.market.datavendorweb import DataVendorYahoo data_vendor = DataVendorYahoo() elif data_source in ["google", "fred", "oecd", "eurostat", "edgar-index"]: from findatapy.market.datavendorweb import DataVendorPandasWeb data_vendor = DataVendorPandasWeb() elif data_source == "bitcoincharts": from findatapy.market.datavendorweb import \ DataVendorBitcoincharts data_vendor = DataVendorBitcoincharts() elif data_source == "poloniex": from findatapy.market.datavendorweb import DataVendorPoloniex data_vendor = DataVendorPoloniex() elif data_source == "binance": from findatapy.market.datavendorweb import DataVendorBinance data_vendor = DataVendorBinance() elif data_source == "bitfinex": from findatapy.market.datavendorweb import DataVendorBitfinex data_vendor = DataVendorBitfinex() elif data_source == "gdax": from findatapy.market.datavendorweb import DataVendorGdax data_vendor = DataVendorGdax() elif data_source == "kraken": from findatapy.market.datavendorweb import DataVendorKraken data_vendor = DataVendorKraken() elif data_source == "bitmex": from findatapy.market.datavendorweb import DataVendorBitmex data_vendor = DataVendorBitmex() elif data_source == "alphavantage": from findatapy.market.datavendorweb import \ DataVendorAlphaVantage data_vendor = DataVendorAlphaVantage() elif data_source == "huobi": from findatapy.market.datavendorweb import DataVendorHuobi data_vendor = DataVendorHuobi() elif data_source in self._data_vendor_dict: data_vendor = self._data_vendor_dict[data_source] else: logger.warn(str(data_source) + " is an unrecognized data source") return data_vendor
def get_data_vendor(self, md_request): """Loads appropriate data service class Parameters ---------- md_request : MarketDataRequest the data_source to use "bloomberg", "quandl", "yahoo", "google", "fred" etc. we can also have forms like "bloomberg-boe" separated by hyphens Returns ------- DataVendor """ logger = LoggerManager().getLogger(__name__) data_source = md_request.data_source data_engine = md_request.data_engine # Special case for files (csv, h5, parquet or zip) if '.csv' in str(data_source) or '.h5' in str(data_source) or '.parquet' in str(data_source) or '.zip' in str(data_source) \ or data_engine is not None: from findatapy.market.datavendorweb import DataVendorFlatFile data_vendor = DataVendorFlatFile() else: try: data_source = data_source.split("-")[0] except: logger.error("Was data data_source specified?") return None if data_source == 'bloomberg': try: from findatapy.market.datavendorbbg import DataVendorBBGOpen data_vendor = DataVendorBBGOpen() except: logger.warn("Bloomberg needs to be installed") elif data_source == 'quandl': from findatapy.market.datavendorweb import DataVendorQuandl data_vendor = DataVendorQuandl() elif data_source == 'eikon': from findatapy.market.datavendorweb import DataVendorEikon data_vendor = DataVendorEikon() elif data_source == 'ons': from findatapy.market.datavendorweb import DataVendorONS data_vendor = DataVendorONS() elif data_source == 'boe': from findatapy.market.datavendorweb import DataVendorBOE data_vendor = DataVendorBOE() elif data_source == 'dukascopy': from findatapy.market.datavendorweb import DataVendorDukasCopy data_vendor = DataVendorDukasCopy() elif data_source == 'fxcm': from findatapy.market.datavendorweb import DataVendorFXCM data_vendor = DataVendorFXCM() elif data_source == 'alfred': from findatapy.market.datavendorweb import DataVendorALFRED data_vendor = DataVendorALFRED() elif data_source == 'yahoo': from findatapy.market.datavendorweb import DataVendorYahoo data_vendor = DataVendorYahoo() elif data_source in ['google', 'fred', 'oecd', 'eurostat', 'edgar-index']: from findatapy.market.datavendorweb import DataVendorPandasWeb data_vendor = DataVendorPandasWeb() elif data_source == 'bitcoincharts': from findatapy.market.datavendorweb import DataVendorBitcoincharts data_vendor = DataVendorBitcoincharts() elif data_source == 'poloniex': from findatapy.market.datavendorweb import DataVendorPoloniex data_vendor = DataVendorPoloniex() elif data_source == 'binance': from findatapy.market.datavendorweb import DataVendorBinance data_vendor = DataVendorBinance() elif data_source == 'bitfinex': from findatapy.market.datavendorweb import DataVendorBitfinex data_vendor = DataVendorBitfinex() elif data_source == 'gdax': from findatapy.market.datavendorweb import DataVendorGdax data_vendor = DataVendorGdax() elif data_source == 'kraken': from findatapy.market.datavendorweb import DataVendorKraken data_vendor = DataVendorKraken() elif data_source == 'bitmex': from findatapy.market.datavendorweb import DataVendorBitmex data_vendor = DataVendorBitmex() elif data_source == 'alphavantage': from findatapy.market.datavendorweb import DataVendorAlphaVantage data_vendor = DataVendorAlphaVantage() elif data_source == 'huobi': from findatapy.market.datavendorweb import DataVendorHuobi data_vendor = DataVendorHuobi() # TODO add support for other data sources (like Reuters) return data_vendor